Index: include/core/SkPixmap.h |
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h |
index 913d007c4dc98d82a4d5c51db4a65e62de684db9..a32b40c58d434cd6e007e81e3698f3da22500339 100644 |
--- a/include/core/SkPixmap.h |
+++ b/include/core/SkPixmap.h |
@@ -133,6 +133,14 @@ public: |
return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(), 0, 0); |
} |
+ /** |
+ * Returns true if pixels were written to (e.g. if colorType is kUnknown_SkColorType, this |
+ * will return false). If subset does not intersect the bounds of this pixmap, returns false. |
+ */ |
+ bool erase(SkColor, const SkIRect& subset) const; |
+ |
+ bool erase(SkColor color) const { return this->erase(color, this->bounds()); } |
+ |
private: |
const void* fPixels; |
SkColorTable* fCTable; |
@@ -165,8 +173,34 @@ public: |
*/ |
void alloc(const SkImageInfo&); |
+ // We wrap these so we can clear our internal storage |
+ |
+ void reset() { |
+ this->freeStorage(); |
+ this->INHERITED::reset(); |
+ } |
+ void reset(const SkImageInfo& info, const void* addr, size_t rb, SkColorTable* ctable = NULL) { |
+ this->freeStorage(); |
+ this->INHERITED::reset(info, addr, rb, ctable); |
+ } |
+ void reset(const SkImageInfo& info) { |
+ this->freeStorage(); |
+ this->INHERITED::reset(info); |
+ } |
+ bool SK_WARN_UNUSED_RESULT reset(const SkMask& mask) { |
+ this->freeStorage(); |
+ return this->INHERITED::reset(mask); |
+ } |
+ |
private: |
void* fStorage; |
+ |
+ void freeStorage() { |
+ sk_free(fStorage); |
+ fStorage = NULL; |
+ } |
+ |
+ typedef SkPixmap INHERITED; |
}; |
///////////////////////////////////////////////////////////////////////////////////////////// |