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

Unified Diff: src/pipe/SkGPipeRead.cpp

Issue 511783005: SkTextBlob GPipe serialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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
Index: src/pipe/SkGPipeRead.cpp
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index e48baf38122e92b0224720a108cd5486a0fd4781..7c85429a9bae9060eed3d8a09d2d93c2f51b2ae1 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -26,6 +26,7 @@
#include "SkRasterizer.h"
#include "SkRRect.h"
#include "SkShader.h"
+#include "SkTextBlob.h"
#include "SkTypeface.h"
#include "SkXfermode.h"
@@ -672,7 +673,18 @@ static void drawPicture_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
static void drawTextBlob_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
- UNIMPLEMENTED
+ SkScalar x = reader->readScalar();
+ SkScalar y = reader->readScalar();
+
+ size_t blobSize = reader->readU32();
+ const void* data = reader->skip(SkAlign4(blobSize));
+
+ SkReadBuffer blobBuffer(data, blobSize);
mtklein 2014/08/28 18:53:27 This seems like a small thing, but I bet we could
f(malita) 2014/08/28 19:02:45 Done.
+ SkAutoTUnref<const SkTextBlob> blob(SkTextBlob::CreateFromBuffer(blobBuffer));
+
mtklein 2014/08/28 18:53:27 Consider SkASSERT(blob.get()) ?
f(malita) 2014/08/28 19:02:45 Done.
+ if (state->shouldDraw()) {
+ canvas->drawTextBlob(blob, x, y, state->paint());
+ }
}
///////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698