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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 971803002: Update SkPicture cull rects with RTree information (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix extra line Created 5 years, 9 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 | « src/core/SkRTree.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordDraw.cpp
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 9b08426670fc4bfc2410fb1cb1aa1cba091e3916..ba15c1b5126b24bb2f9d796e1022d68547ac50ca 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -248,7 +248,11 @@ private:
Bounds clip = SkRect::Make(devBounds);
// We don't call adjustAndMap() because as its last step it would intersect the adjusted
// clip bounds with the previous clip, exactly what we can't do when the clip grows.
- fCurrentClipBounds = this->adjustForSaveLayerPaints(&clip) ? clip : fCullRect;
+ if (this->adjustForSaveLayerPaints(&clip)) {
+ fCurrentClipBounds = clip.intersect(fCullRect) ? clip : Bounds::MakeEmpty();
+ } else {
+ fCurrentClipBounds = fCullRect;
+ }
}
// Restore holds the devBounds for the clip after the {save,saveLayer}/restore block completes.
@@ -259,8 +263,11 @@ private:
// so they are not affected by the saveLayer's paint.
const int kSavesToIgnore = 1;
Bounds clip = SkRect::Make(op.devBounds);
- fCurrentClipBounds =
- this->adjustForSaveLayerPaints(&clip, kSavesToIgnore) ? clip : fCullRect;
+ if (this->adjustForSaveLayerPaints(&clip, kSavesToIgnore)) {
+ fCurrentClipBounds = clip.intersect(fCullRect) ? clip : Bounds::MakeEmpty();
+ } else {
+ fCurrentClipBounds = fCullRect;
+ }
}
// We also take advantage of SaveLayer bounds when present to further cut the clip down.
@@ -387,8 +394,12 @@ private:
Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; }
Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw.
- Bounds bounds(const DrawSprite& op) const { // Ignores the matrix.
- return Bounds::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.height());
+ Bounds bounds(const DrawSprite& op) const { // Ignores the matrix, but respects the clip.
+ SkRect rect = Bounds::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.height());
+ if (!rect.intersect(fCurrentClipBounds)) {
+ return Bounds::MakeEmpty();
+ }
+ return rect;
}
Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); }
« no previous file with comments | « src/core/SkRTree.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698