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

Unified Diff: src/gpu/GrPictureUtils.cpp

Issue 595543002: Update layer hoisting code to correctly render sub-picture layers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add cast Created 6 years, 3 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/gpu/GrPictureUtils.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPictureUtils.cpp
diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp
index 0cc1f1e0656e16ccac75e5a12253cc667053b5ed..a4f32e7e02f226e5e13f0c3d9f8ba6d87976dcd1 100644
--- a/src/gpu/GrPictureUtils.cpp
+++ b/src/gpu/GrPictureUtils.cpp
@@ -110,8 +110,6 @@ private:
this->updateStackForSaveLayer();
- GrAccelData::SaveLayerInfo dst;
-
// TODO: need to store an SkRect in GrAccelData::SaveLayerInfo?
SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(src.fOffset.fX),
SkIntToScalar(src.fOffset.fY),
@@ -120,25 +118,24 @@ private:
SkIRect newClip(fCurrentClipBounds);
newClip.intersect(this->adjustAndMap(srcRect, dp.paint));
+ GrAccelData::SaveLayerInfo& dst = fAccelData->addSaveLayerInfo();
+
dst.fValid = true;
- dst.fPictureID = dp.picture->uniqueID();
+ // If src.fPicture is NULL the layer is in dp.picture; otherwise
+ // 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.fOriginXform = *fCTM;
dst.fOriginXform.postConcat(src.fOriginXform);
-
- if (NULL == src.fPaint) {
- dst.fPaint = NULL;
- } else {
+ if (src.fPaint) {
dst.fPaint = SkNEW_ARGS(SkPaint, (*src.fPaint));
}
-
dst.fSaveLayerOpID = src.fSaveLayerOpID;
dst.fRestoreOpID = src.fRestoreOpID;
dst.fHasNestedLayers = src.fHasNestedLayers;
dst.fIsNested = fSaveLayersInStack > 0 || src.fIsNested;
-
- fAccelData->addSaveLayerInfo(dst);
}
}
@@ -182,26 +179,20 @@ private:
--fSaveLayersInStack;
- GrAccelData::SaveLayerInfo slInfo;
+ GrAccelData::SaveLayerInfo& slInfo = fAccelData->addSaveLayerInfo();
slInfo.fValid = true;
- slInfo.fPictureID = fPictureID;
+ 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.fOriginXform = *fCTM;
-
- if (NULL == si.fPaint) {
- slInfo.fPaint = NULL;
- } else {
+ if (si.fPaint) {
slInfo.fPaint = SkNEW_ARGS(SkPaint, (*si.fPaint));
}
-
slInfo.fSaveLayerOpID = si.fStartIndex;
slInfo.fRestoreOpID = fCurrentOp;
slInfo.fHasNestedLayers = si.fHasNestedSaveLayer;
slInfo.fIsNested = fSaveLayersInStack > 0;
-
- fAccelData->addSaveLayerInfo(slInfo);
}
// Returns true if rect was meaningfully adjusted for the effects of paint,
« no previous file with comments | « src/gpu/GrPictureUtils.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698