Index: src/pipe/SkGPipeRead.cpp |
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp |
index 4bd4fa6a5c84385a4d403400145c27a0a29400c5..8cb0e34d0a5d9c844ffa638b4ef081906d76a52d 100644 |
--- a/src/pipe/SkGPipeRead.cpp |
+++ b/src/pipe/SkGPipeRead.cpp |
@@ -194,8 +194,8 @@ public: |
*fTypefaces.append() = SkTypeface::Deserialize(&stream); |
} |
- void setTypeface(SkPaint* paint, unsigned id) { |
- paint->setTypeface(id ? fTypefaces[id - 1] : NULL); |
+ SkTypeface* getTypeface(unsigned id) const { |
+ return id ? fTypefaces[id - 1] : NULL; |
} |
private: |
@@ -676,11 +676,22 @@ static void drawTextBlob_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
SkScalar x = reader->readScalar(); |
SkScalar y = reader->readScalar(); |
+ int typefaceCount = reader->readU32(); |
+ SkAutoSTMalloc<16, SkTypeface*> typefaceArray(typefaceCount); |
+ if (state->getFlags() & SkGPipeWriter::kCrossProcess_Flag) { |
+ for (int i = 0; i < typefaceCount; ++i) { |
+ typefaceArray[i] = state->getTypeface(reader->readU32()); |
+ } |
+ } else { |
+ reader->read(typefaceArray.get(), typefaceCount * sizeof(SkTypeface*)); |
+ } |
+ |
size_t blobSize = reader->readU32(); |
const void* data = reader->skip(SkAlign4(blobSize)); |
if (state->shouldDraw()) { |
SkReadBuffer blobBuffer(data, blobSize); |
+ blobBuffer.setTypefaceArray(typefaceArray.get(), typefaceCount); |
SkAutoTUnref<const SkTextBlob> blob(SkTextBlob::CreateFromBuffer(blobBuffer)); |
SkASSERT(blob.get()); |
@@ -731,7 +742,8 @@ static void paintOp_rp(SkCanvas*, SkReader32* reader, uint32_t op32, |
case kTypeface_PaintOp: |
SkASSERT(SkToBool(state->getFlags() & |
SkGPipeWriter::kCrossProcess_Flag)); |
- state->setTypeface(p, data); break; |
+ p->setTypeface(state->getTypeface(data)); |
+ break; |
default: SkDEBUGFAIL("bad paintop"); return; |
} |
SkASSERT(reader->offset() <= stop); |