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

Unified Diff: src/gpu/GrLayerCache.h

Issue 803183003: Fix layer hoisting image filter corner cases (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test Created 6 years 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 | « src/core/SkRecordDraw.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerCache.h
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index 0ea23b3fc7294425c690da96c2707cf572c4c068..cdbd0806ccb4e0694a8054d98bad4b7b3c931b78 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -144,13 +144,16 @@ public:
// GrCachedLayer proper
GrCachedLayer(uint32_t pictureID, unsigned start, unsigned stop,
- const SkIRect& bounds, const SkMatrix& ctm,
+ const SkIRect& srcIR, const SkIRect& dstIR,
+ const SkMatrix& ctm,
const unsigned* key, int keySize,
const SkPaint* paint)
: fKey(pictureID, ctm, key, keySize, true)
, fStart(start)
, fStop(stop)
- , fBounds(bounds)
+ , fSrcIR(srcIR)
+ , fDstIR(dstIR)
+ , fOffset(SkIPoint::Make(0, 0))
, fPaint(paint ? SkNEW_ARGS(SkPaint, (*paint)) : NULL)
, fFilter(NULL)
, fTexture(NULL)
@@ -161,8 +164,10 @@ public:
SkASSERT(SK_InvalidGenID != pictureID);
if (fPaint) {
- fFilter = SkSafeRef(fPaint->getImageFilter());
- fPaint->setImageFilter(NULL);
+ if (fPaint->getImageFilter() && fPaint->getImageFilter()->canFilterImageGPU()) {
+ fFilter = SkSafeRef(fPaint->getImageFilter());
+ fPaint->setImageFilter(NULL);
+ }
}
}
@@ -179,7 +184,8 @@ public:
unsigned start() const { return fStart; }
// TODO: make bound debug only
- const SkIRect& bound() const { return fBounds; }
+ const SkIRect& srcIR() const { return fSrcIR; }
+ const SkIRect& dstIR() const { return fDstIR; }
unsigned stop() const { return fStop; }
void setTexture(GrTexture* texture, const SkIRect& rect) {
SkRefCnt_SafeAssign(fTexture, texture);
@@ -190,6 +196,9 @@ public:
const SkImageFilter* filter() const { return fFilter; }
const SkIRect& rect() const { return fRect; }
+ void setOffset(const SkIPoint& offset) { fOffset = offset; }
+ const SkIPoint& offset() const { return fOffset; }
+
void setPlot(GrPlot* plot) {
SkASSERT(NULL == plot || NULL == fPlot);
fPlot = plot;
@@ -212,7 +221,13 @@ private:
// The final "restore" operation index of the cached layer
const unsigned fStop;
- const SkIRect fBounds;
+ // The layer's src rect (i.e., the portion of the source scene required
+ // for filtering).
+ const SkIRect fSrcIR;
+ // The layer's dest rect (i.e., where it will land in device space)
+ const SkIRect fDstIR;
+ // Offset sometimes required by image filters
+ SkIPoint fOffset;
// The paint used when dropping the layer down into the owning canvas.
// Can be NULL. This class makes a copy for itself.
@@ -276,7 +291,8 @@ public:
const unsigned* key, int keySize);
GrCachedLayer* findLayerOrCreate(uint32_t pictureID,
int start, int stop,
- const SkIRect& bounds,
+ const SkIRect& srcIR,
+ const SkIRect& dstIR,
const SkMatrix& initialMat,
const unsigned* key, int keySize,
const SkPaint* paint);
@@ -360,7 +376,8 @@ private:
void initAtlas();
GrCachedLayer* createLayer(uint32_t pictureID, int start, int stop,
- const SkIRect& bounds, const SkMatrix& initialMat,
+ const SkIRect& srcIR, const SkIRect& dstIR,
+ const SkMatrix& initialMat,
const unsigned* key, int keySize,
const SkPaint* paint);
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698