Track nested picture xform state for layer hoisting
The accumulated matrix state of any enclosing SkPictures must be stored separate from the picture-local CTM. Any setMatrix calls inside a layer need to replace the picture-local CTM but concatenate with the enclosing SkPicture transform state (and the transform state needed to translate the layer to the correct location in the cached GrTexture).
Review URL: https://codereview.chromium.org/639863005
diff --git a/src/gpu/GrLayerHoister.h b/src/gpu/GrLayerHoister.h
index 7f49881..2b2eb09 100644
--- a/src/gpu/GrLayerHoister.h
+++ b/src/gpu/GrLayerHoister.h
@@ -21,7 +21,8 @@
const SkPicture* fPicture;
GrCachedLayer* fLayer;
SkIPoint fOffset;
- SkMatrix fCTM;
+ SkMatrix fPreMat;
+ SkMatrix fLocalMat;
};
// This class collects the layer hoisting functionality in one place.
@@ -50,13 +51,15 @@
SkTDArray<GrHoistedLayer>* recycled);
/** Draw the specified layers into either the atlas or free floating textures.
+ @param context Owner of the layer cache (and thus the layers)
@param atlased The layers to be drawn into the atlas
@param nonAtlased The layers to be drawn into their own textures
@param recycled Layers that don't need rendering but do need to go into the
replacements object
@param replacements The replacement structure to fill in with the rendered layer info
*/
- static void DrawLayers(const SkTDArray<GrHoistedLayer>& atlased,
+ static void DrawLayers(GrContext* context,
+ const SkTDArray<GrHoistedLayer>& atlased,
const SkTDArray<GrHoistedLayer>& nonAtlased,
const SkTDArray<GrHoistedLayer>& recycled,
GrReplacements* replacements);