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 "SkPixelRef.h" 11 width() const12int SkBitmapProvider::width() const { 13 return fImage->width(); 14 } 15 height() const16int SkBitmapProvider::height() const { 17 return fImage->height(); 18 } 19 getID() const20uint32_t SkBitmapProvider::getID() const { 21 return fImage->uniqueID(); 22 } 23 info() const24SkImageInfo SkBitmapProvider::info() const { 25 return as_IB(fImage)->onImageInfo(); 26 } 27 isVolatile() const28bool SkBitmapProvider::isVolatile() const { 29 // add flag to images? 30 const SkBitmap* bm = as_IB(fImage)->onPeekBitmap(); 31 return bm ? bm->isVolatile() : false; 32 } 33 makeCacheDesc(int w,int h) const34SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const { 35 return SkBitmapCacheDesc::Make(fImage, w, h); 36 } 37 makeCacheDesc() const38SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const { 39 return SkBitmapCacheDesc::Make(fImage); 40 } 41 notifyAddedToCache() const42void SkBitmapProvider::notifyAddedToCache() const { 43 as_IB(fImage)->notifyAddedToCache(); 44 } 45 asBitmap(SkBitmap * bm) const46bool SkBitmapProvider::asBitmap(SkBitmap* bm) const { 47 return as_IB(fImage)->getROPixels(bm, fDstColorSpace, SkImage::kAllow_CachingHint); 48 } 49