| Index: src/pipe/SkGPipeWrite.cpp
|
| diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
|
| index d796e8a99bbbd408eaa1b486f9f25a2cf2b4cf47..327ef7d3dbe0157d7f281220954178c9c2e73391 100644
|
| --- a/src/pipe/SkGPipeWrite.cpp
|
| +++ b/src/pipe/SkGPipeWrite.cpp
|
| @@ -254,7 +254,9 @@ public:
|
| const SkColor colors[], SkXfermode*,
|
| const uint16_t indices[], int indexCount,
|
| const SkPaint&) SK_OVERRIDE;
|
| - virtual void drawPatch(const SkPatch& patch, const SkPaint& paint) SK_OVERRIDE;
|
| + virtual void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
| + const SkPoint texCoords[4], SkXfermode* xmode,
|
| + const SkPaint& paint) SK_OVERRIDE;
|
| virtual void drawData(const void*, size_t) SK_OVERRIDE;
|
| virtual void beginCommentGroup(const char* description) SK_OVERRIDE;
|
| virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
|
| @@ -1003,12 +1005,52 @@ void SkGPipeCanvas::drawVertices(VertexMode vmode, int vertexCount,
|
| }
|
| }
|
|
|
| -void SkGPipeCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) {
|
| +void SkGPipeCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
| + const SkPoint texCoords[4], SkXfermode* xmode,
|
| + const SkPaint& paint) {
|
| + if (NULL == cubics) {
|
| + return;
|
| + }
|
| +
|
| NOTIFY_SETUP(this);
|
| +
|
| + size_t size = SkPatch::kNumCtrlPts * sizeof(SkPoint);
|
| + unsigned flags = 0;
|
| + if (NULL != colors) {
|
| + flags |= kDrawVertices_HasColors_DrawOpFlag;
|
| + size += SkPatch::kNumCorners * sizeof(SkColor);
|
| + }
|
| + if (NULL != texCoords) {
|
| + flags |= kDrawVertices_HasTexs_DrawOpFlag;
|
| + size += SkPatch::kNumCorners * sizeof(SkPoint);
|
| + }
|
| + if (NULL != xmode) {
|
| + SkXfermode::Mode mode;
|
| + if (xmode->asMode(&mode) && SkXfermode::kModulate_Mode != mode) {
|
| + flags |= kDrawVertices_HasXfermode_DrawOpFlag;
|
| + size += sizeof(int32_t);
|
| + }
|
| + }
|
| +
|
| this->writePaint(paint);
|
| - if (this->needOpBytes(patch.writeToMemory(NULL))) {
|
| - this->writeOp(kDrawPatch_DrawOp);
|
| - fWriter.writePatch(patch);
|
| + if (this->needOpBytes(size)) {
|
| + this->writeOp(kDrawPatch_DrawOp, flags, 0);
|
| +
|
| + fWriter.write(cubics, SkPatch::kNumCtrlPts * sizeof(SkPoint));
|
| +
|
| + if (NULL != colors) {
|
| + fWriter.write(colors, SkPatch::kNumCorners * sizeof(SkColor));
|
| + }
|
| +
|
| + if (NULL != texCoords) {
|
| + fWriter.write(texCoords, SkPatch::kNumCorners * sizeof(SkPoint));
|
| + }
|
| +
|
| + if (flags & kDrawVertices_HasXfermode_DrawOpFlag) {
|
| + SkXfermode::Mode mode = SkXfermode::kModulate_Mode;
|
| + SkAssertResult(xmode->asMode(&mode));
|
| + fWriter.write32(mode);
|
| + }
|
| }
|
| }
|
|
|
|
|