Index: src/image/SkImage.cpp |
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp |
index 654b848fce22073ba274c57cbe0768c3464093dc..6f4655758e36cb7b50a565f514655cb51921db75 100644 |
--- a/src/image/SkImage.cpp |
+++ b/src/image/SkImage.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "SkBitmap.h" |
+#include "SkBitmapCache.h" |
#include "SkCanvas.h" |
#include "SkData.h" |
#include "SkImageGenerator.h" |
@@ -210,6 +211,22 @@ static bool raster_canvas_supports(const SkImageInfo& info) { |
return false; |
} |
+static SkSurfaceProps copy_or_safe_defaults(const SkSurfaceProps* props) { |
+ return props ? *props : SkSurfaceProps(0, kUnknown_SkPixelGeometry); |
+} |
+ |
+SkImage_Base::SkImage_Base(int width, int height, uint32_t uniqueID, const SkSurfaceProps* props) |
+ : INHERITED(width, height, uniqueID) |
+ , fProps(copy_or_safe_defaults(props)) |
+ , fAddedToCache(false) |
+{ } |
+ |
+SkImage_Base::~SkImage_Base() { |
+ if (fAddedToCache.load()) { |
+ SkNotifyBitmapGenIDIsStale(this->uniqueID()); |
+ } |
+} |
+ |
bool SkImage_Base::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, |
int srcX, int srcY) const { |
if (!raster_canvas_supports(dstInfo)) { |