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

Unified Diff: src/pipe/SkGPipeRead.cpp

Issue 26702002: force readbuffer clients to use specialized readFoo for flattenables (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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/pipe/SkGPipePriv.h ('k') | tests/ColorFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeRead.cpp
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index ac0aaddeadbe1ac6be826a7d7744fc6f69c599ab..e76ec1240aa005990223f51857da6d45b6ab2350 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -18,6 +18,7 @@
#include "SkAnnotation.h"
#include "SkColorFilter.h"
#include "SkDrawLooper.h"
+#include "SkImageFilter.h"
#include "SkMaskFilter.h"
#include "SkOrderedReadBuffer.h"
#include "SkPathEffect.h"
@@ -27,6 +28,22 @@
#include "SkTypeface.h"
#include "SkXfermode.h"
+static SkEffectType paintflat_to_effecttype(PaintFlats pf) {
+ static const uint8_t gEffectTypesInPaintFlatsOrder[] = {
+ kColorFilter_SkEffectType,
+ kDrawLooper_SkEffectType,
+ kImageFilter_SkEffectType,
+ kMaskFilter_SkEffectType,
+ kPathEffect_SkEffectType,
+ kRasterizer_SkEffectType,
+ kShader_SkEffectType,
+ kXfermode_SkEffectType,
+ };
+
+ SkASSERT((size_t)pf < SK_ARRAY_COUNT(gEffectTypesInPaintFlatsOrder));
+ return (SkEffectType)gEffectTypesInPaintFlatsOrder[pf];
+}
+
static void set_paintflat(SkPaint* paint, SkFlattenable* obj, unsigned paintFlat) {
SkASSERT(paintFlat < kCount_PaintFlats);
switch (paintFlat) {
@@ -105,7 +122,7 @@ public:
void defFlattenable(PaintFlats pf, int index) {
index--;
- SkFlattenable* obj = fReader->readFlattenable();
+ SkFlattenable* obj = fReader->readFlattenable(paintflat_to_effecttype(pf));
if (fFlatArray.count() == index) {
*fFlatArray.append() = obj;
} else {
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | tests/ColorFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698