Let blitters be notified when they're done being used
R=reed@google.com, robertphillips@google.com Author: krajcevski@google.com Review URL: https://codereview.chromium.org/399593007
This commit is contained in:
parent
63e99f7a03
commit
75f88512a1
@ -76,6 +76,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual int requestRowsPreserved() const { return 1; }
|
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
|
///@name non-virtual helpers
|
||||||
void blitMaskRegion(const SkMask& mask, const SkRegion& clip);
|
void blitMaskRegion(const SkMask& mask, const SkRegion& clip);
|
||||||
void blitRectRegion(const SkIRect& rect, const SkRegion& clip);
|
void blitRectRegion(const SkIRect& rect, const SkRegion& clip);
|
||||||
@ -98,6 +108,10 @@ public:
|
|||||||
SkTBlitterAllocator*);
|
SkTBlitterAllocator*);
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
SkAutoMalloc fBlitMemory;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -137,6 +151,10 @@ public:
|
|||||||
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE;
|
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE;
|
||||||
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value) SK_OVERRIDE;
|
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value) SK_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void* allocBlitMemory(size_t sz) SK_OVERRIDE {
|
||||||
|
return fBlitter->allocBlitMemory(sz);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkBlitter* fBlitter;
|
SkBlitter* fBlitter;
|
||||||
SkIRect fClipRect;
|
SkIRect fClipRect;
|
||||||
@ -164,6 +182,10 @@ public:
|
|||||||
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE;
|
virtual void blitMask(const SkMask&, const SkIRect& clip) SK_OVERRIDE;
|
||||||
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value) SK_OVERRIDE;
|
virtual const SkBitmap* justAnOpaqueColor(uint32_t* value) SK_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void* allocBlitMemory(size_t sz) SK_OVERRIDE {
|
||||||
|
return fBlitter->allocBlitMemory(sz);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkBlitter* fBlitter;
|
SkBlitter* fBlitter;
|
||||||
const SkRegion* fRgn;
|
const SkRegion* fRgn;
|
||||||
|
@ -108,7 +108,6 @@ public:
|
|||||||
|
|
||||||
virtual ~SuperBlitter() {
|
virtual ~SuperBlitter() {
|
||||||
this->flush();
|
this->flush();
|
||||||
sk_free(fRunsBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Once fRuns contains a complete supersampled row, flush() blits
|
/// Once fRuns contains a complete supersampled row, flush() blits
|
||||||
@ -154,7 +153,7 @@ SuperBlitter::SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir,
|
|||||||
const SkRegion& clip)
|
const SkRegion& clip)
|
||||||
: BaseSuperBlitter(realBlitter, ir, clip) {
|
: BaseSuperBlitter(realBlitter, ir, clip) {
|
||||||
fRunsToBuffer = realBlitter->requestRowsPreserved();
|
fRunsToBuffer = realBlitter->requestRowsPreserved();
|
||||||
fRunsBuffer = sk_malloc_throw(fRunsToBuffer * this->getRunsSz());
|
fRunsBuffer = realBlitter->allocBlitMemory(fRunsToBuffer * this->getRunsSz());
|
||||||
fCurrentRun = -1;
|
fCurrentRun = -1;
|
||||||
|
|
||||||
this->advanceRuns();
|
this->advanceRuns();
|
||||||
|
Loading…
Reference in New Issue
Block a user