Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: src/core/SkBlitter.h

Issue 399593007: Let blitters be notified when they're done being used (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove constructor definition. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkScan_AntiPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter.h
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h
index 0f1006fcfb70909e640f47b735771dea1b796e5a..992eb86fa043db3d74da1b24cc93890c97f10698 100644
--- a/src/core/SkBlitter.h
+++ b/src/core/SkBlitter.h
@@ -76,6 +76,16 @@ public:
*/
virtual int requestRowsPreserved() const { return 1; }
+ /**
+ * This function allocates memory for the blitter that the blitter then owns.
+ * The memory can be used by the calling function at will, but it will be
+ * released when the blitter's destructor is called. This function returns
+ * NULL if no persistent memory is needed by the blitter.
+ */
+ virtual void* allocBlitMemory(size_t sz) {
+ return fBlitMemory.reset(sz, SkAutoMalloc::kReuse_OnShrink);
+ }
+
///@name non-virtual helpers
void blitMaskRegion(const SkMask& mask, const SkRegion& clip);
void blitRectRegion(const SkIRect& rect, const SkRegion& clip);
@@ -98,6 +108,10 @@ public:
SkTBlitterAllocator*);
///@}
+protected:
+
+ SkAutoMalloc fBlitMemory;
+
private:
};
@@ -137,6 +151,10 @@ public:
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE;
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value) SK_OVERRIDE;
+ virtual void* allocBlitMemory(size_t sz) SK_OVERRIDE {
+ return fBlitter->allocBlitMemory(sz);
+ }
+
private:
SkBlitter* fBlitter;
SkIRect fClipRect;
@@ -164,6 +182,10 @@ public:
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE;
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value) SK_OVERRIDE;
+ virtual void* allocBlitMemory(size_t sz) SK_OVERRIDE {
+ return fBlitter->allocBlitMemory(sz);
+ }
+
private:
SkBlitter* fBlitter;
const SkRegion* fRgn;
« no previous file with comments | « no previous file | src/core/SkScan_AntiPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698