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

Unified Diff: src/pipe/SkGPipeRead.cpp

Issue 26606004: change SkAnnotation to not inherit from SkFlattenable (does not need dynamic factories) (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') | src/pipe/SkGPipeWrite.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 a5f714480ecc50a5799d6f05b51f58c64c5a63b0..6275469cd2f025b13b444c9d4830c8f8f5c47e3b 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -15,6 +15,7 @@
#include "SkReader32.h"
#include "SkStream.h"
+#include "SkAnnotation.h"
#include "SkColorFilter.h"
#include "SkDrawLooper.h"
#include "SkMaskFilter.h"
@@ -53,9 +54,6 @@ static void set_paintflat(SkPaint* paint, SkFlattenable* obj, unsigned paintFlat
case kXfermode_PaintFlat:
paint->setXfermode((SkXfermode*)obj);
break;
- case kAnnotation_PaintFlat:
- paint->setAnnotation((SkAnnotation*)obj);
- break;
default:
SkDEBUGFAIL("never gets here");
}
@@ -672,6 +670,22 @@ static void typeface_rp(SkCanvas*, SkReader32* reader, uint32_t,
p->setTypeface(static_cast<SkTypeface*>(reader->readPtr()));
}
+static void annotation_rp(SkCanvas*, SkReader32* reader, uint32_t op32,
+ SkGPipeState* state) {
+ SkPaint* p = state->editPaint();
+
+ if (SkToBool(PaintOp_unpackData(op32))) {
+ const size_t size = reader->readU32();
+ SkAutoMalloc storage(size);
+
+ reader->read(storage.get(), size);
+ SkOrderedReadBuffer buffer(storage.get(), size);
+ p->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref();
+ } else {
+ p->setAnnotation(NULL);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
static void def_Typeface_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState* state) {
@@ -755,6 +769,8 @@ static const ReadProc gReadTable[] = {
paintOp_rp,
typeface_rp,
+ annotation_rp,
+
def_Typeface_rp,
def_PaintFlat_rp,
def_Bitmap_rp,
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698