• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
width() const13 int SkBitmapProvider::width() const {
14     return fImage->width();
15 }
16 
height() const17 int SkBitmapProvider::height() const {
18     return fImage->height();
19 }
20 
getID() const21 uint32_t SkBitmapProvider::getID() const {
22     return fImage->uniqueID();
23 }
24 
info() const25 SkImageInfo SkBitmapProvider::info() const {
26     return as_IB(fImage)->onImageInfo();
27 }
28 
isVolatile() const29 bool SkBitmapProvider::isVolatile() const {
30     // add flag to images?
31     const SkBitmap* bm = as_IB(fImage)->onPeekBitmap();
32     return bm ? bm->isVolatile() : false;
33 }
34 
makeCacheDesc(int w,int h) const35 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const {
36     return SkBitmapCacheDesc::Make(fImage, w, h);
37 }
38 
makeCacheDesc() const39 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const {
40     return SkBitmapCacheDesc::Make(fImage);
41 }
42 
notifyAddedToCache() const43 void SkBitmapProvider::notifyAddedToCache() const {
44     as_IB(fImage)->notifyAddedToCache();
45 }
46 
asBitmap(SkBitmap * bm) const47 bool SkBitmapProvider::asBitmap(SkBitmap* bm) const {
48     return as_IB(fImage)->getROPixels(bm, fDstColorSpace, SkImage::kAllow_CachingHint);
49 }
50