Line data Source code
1 : /*
2 : * Copyright 2015 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 : #include "SkBitmapProvider.h"
9 : #include "SkImage_Base.h"
10 : #include "SkImageCacherator.h"
11 : #include "SkPixelRef.h"
12 :
13 0 : int SkBitmapProvider::width() const {
14 0 : return fImage->width();
15 : }
16 :
17 0 : int SkBitmapProvider::height() const {
18 0 : return fImage->height();
19 : }
20 :
21 0 : uint32_t SkBitmapProvider::getID() const {
22 0 : return fImage->uniqueID();
23 : }
24 :
25 423 : SkImageInfo SkBitmapProvider::info() const {
26 423 : return as_IB(fImage)->onImageInfo();
27 : }
28 :
29 0 : bool SkBitmapProvider::isVolatile() const {
30 : // add flag to images?
31 0 : const SkBitmap* bm = as_IB(fImage)->onPeekBitmap();
32 0 : return bm ? bm->isVolatile() : false;
33 : }
34 :
35 0 : SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const {
36 0 : return SkBitmapCacheDesc::Make(fImage, w, h);
37 : }
38 :
39 0 : SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const {
40 0 : return SkBitmapCacheDesc::Make(fImage);
41 : }
42 :
43 0 : void SkBitmapProvider::notifyAddedToCache() const {
44 0 : as_IB(fImage)->notifyAddedToCache();
45 0 : }
46 :
47 141 : bool SkBitmapProvider::asBitmap(SkBitmap* bm) const {
48 141 : return as_IB(fImage)->getROPixels(bm, fDstColorSpace, SkImage::kAllow_CachingHint);
49 : }
|