Index: src/image/SkImage.cpp |
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp |
index 654b848fce22073ba274c57cbe0768c3464093dc..eef9f08d05ef1a24392d9df7c3838a3202121fd9 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" |
@@ -33,6 +34,8 @@ SkImage::SkImage(int width, int height, uint32_t uniqueID) |
SkASSERT(height > 0); |
} |
+SkImage::~SkImage() { } |
reed1
2015/09/18 14:32:53
nit: I think we can put this impl ( {} ) in the he
f(malita)
2015/09/18 15:00:40
Dropped the SkImage dtor completely.
|
+ |
const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { |
SkImageInfo infoStorage; |
size_t rowBytesStorage; |
@@ -210,6 +213,23 @@ 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); |
mtklein
2015/09/18 14:32:36
We might even think about adding SkSurfaceProps::S
|
+} |
+ |
+SkImage_Base::SkImage_Base(int width, int height, uint32_t uniqueID, const SkSurfaceProps* props) |
+ : INHERITED(width, height, uniqueID) |
+ , fProps(copy_or_safe_defaults(props)) |
mtklein
2015/09/18 14:32:36
You ought to be able to do fAddedToCache(false) he
f(malita)
2015/09/18 15:00:40
Thanks, done.
|
+{ |
+ fAddedToCache.store(false); |
+} |
+ |
+SkImage_Base::~SkImage_Base() { |
+ if (fAddedToCache.load()) { |
+ SkNotifyBitmapGenIDIsStale(this->uniqueID()); |
mtklein
2015/09/18 14:32:36
Are bitmap genids and skimage genids in the same n
f(malita)
2015/09/18 15:00:40
Yes.
|
+ } |
+} |
+ |
bool SkImage_Base::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, |
int srcX, int srcY) const { |
if (!raster_canvas_supports(dstInfo)) { |