aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPictureUtils.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-10-20 08:52:40 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-20 08:52:40 -0700
commit3aac6e0848010efe046bd86bcb341dad5a23e174 (patch)
treefa1245737e3610824e5a56c51afb015e56acd8cc /src/gpu/GrPictureUtils.cpp
parent4a36d9ab5efc6d0efd08a48bb46b5c64c15290d9 (diff)
Add clip to layer cache
This CL adds the clip region to the GPU layer hoisting image cache. It also switches back to the old caching behavior of using the entire CTM in the cache key rather then just the upper 2x2. This latter change is to focus more on hoisting rather then caching. It also includes 2 smaller fixes: a) layer's that have an image filter are no longer atlased (b.c. doing so complicates applying the image filter) b) the result of clipping the layer's bounds to the current clip is used as the hoisted layer's size. This reduces the amount of pixels drawn to match a normal (non-hoisted) draw pass. Review URL: https://codereview.chromium.org/640773004
Diffstat (limited to 'src/gpu/GrPictureUtils.cpp')
-rw-r--r--src/gpu/GrPictureUtils.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp
index da238cef9f..a215a0e7a6 100644
--- a/src/gpu/GrPictureUtils.cpp
+++ b/src/gpu/GrPictureUtils.cpp
@@ -108,15 +108,14 @@ private:
for (int i = 0; i < childData->numSaveLayers(); ++i) {
const GrAccelData::SaveLayerInfo& src = childData->saveLayerInfo(i);
- this->updateStackForSaveLayer();
-
- // TODO: need to store an SkRect in GrAccelData::SaveLayerInfo?
- SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(src.fOffset.fX),
- SkIntToScalar(src.fOffset.fY),
- SkIntToScalar(src.fSize.width()),
- SkIntToScalar(src.fSize.height()));
+ SkRect srcRect = SkRect::Make(src.fBounds);
SkIRect newClip(fCurrentClipBounds);
- newClip.intersect(this->adjustAndMap(srcRect, dp.paint));
+
+ if (!newClip.intersect(this->adjustAndMap(srcRect, dp.paint))) {
+ continue;
+ }
+
+ this->updateStackForSaveLayer();
GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo();
@@ -124,8 +123,7 @@ private:
// it belongs to a sub-picture.
dst.fPicture = src.fPicture ? src.fPicture : static_cast<const SkPicture*>(dp.picture);
dst.fPicture->ref();
- dst.fSize = SkISize::Make(newClip.width(), newClip.height());
- dst.fOffset = SkIPoint::Make(newClip.fLeft, newClip.fTop);
+ dst.fBounds = newClip;
dst.fOriginXform = src.fOriginXform;
dst.fOriginXform.postConcat(*fCTM);
if (src.fPaint) {
@@ -181,8 +179,7 @@ private:
GrAccelData::SaveLayerInfo& slInfo = fAccelData->addSaveLayerInfo();
SkASSERT(NULL == slInfo.fPicture); // This layer is in the top-most picture
- slInfo.fSize = SkISize::Make(si.fBounds.width(), si.fBounds.height());
- slInfo.fOffset = SkIPoint::Make(si.fBounds.fLeft, si.fBounds.fTop);
+ slInfo.fBounds = si.fBounds;
slInfo.fOriginXform = *fCTM;
if (si.fPaint) {
slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint));