aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-10 22:56:42 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-10 22:56:42 +0000
commitf2eb5ab7806a62e89b8cb572b1b33b70b83b13ab (patch)
tree2d2fc402c1260cdc01ed3c03f1444bc16cff97e1 /include/core
parentcc4dac3dac215dc0dd56f7b30d07cc304671b033 (diff)
fix bug where we wrote uninitialized data to the flatten stream for shaders.
Both shader and gradient_shader write matrices to the flatten stream. However, they were just calling write(&matrix, sizeof(SkMatrix)) and the matrix can contain lazily-computed function ptrs as part of its internal cache. Thus two matrices that are logically the same may write different bytes. This is a problem because picture relies on flattening objects and then using the flatten stream as a key into its cache. This matrix-write bug effectively kills the effectiveness of the cache for shaders. The fix is to write proper read/write functions for matrix (and region btw). These call through to the existing low-level flatten routines (which just write into a memory ptr). git-svn-id: http://skia.googlecode.com/svn/trunk@1290 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkFlattenable.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h
index 553eb6cbe0..03bcab86e2 100644
--- a/include/core/SkFlattenable.h
+++ b/include/core/SkFlattenable.h
@@ -70,6 +70,16 @@ protected:
SkFlattenable(SkFlattenableReadBuffer&) {}
};
+// helpers for matrix and region
+
+class SkMatrix;
+extern void SkReadMatrix(SkReader32*, SkMatrix*);
+extern void SkWriteMatrix(SkWriter32*, const SkMatrix&);
+
+class SkRegion;
+extern void SkReadRegion(SkReader32*, SkRegion*);
+extern void SkWriteRegion(SkWriter32*, const SkRegion&);
+
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////