OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 const SkPaint*) SK_OVERRIDE; | 247 const SkPaint*) SK_OVERRIDE; |
248 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 248 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
249 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; | 249 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; |
250 virtual void drawSprite(const SkBitmap&, int left, int top, | 250 virtual void drawSprite(const SkBitmap&, int left, int top, |
251 const SkPaint*) SK_OVERRIDE; | 251 const SkPaint*) SK_OVERRIDE; |
252 virtual void drawVertices(VertexMode, int vertexCount, | 252 virtual void drawVertices(VertexMode, int vertexCount, |
253 const SkPoint vertices[], const SkPoint texs[], | 253 const SkPoint vertices[], const SkPoint texs[], |
254 const SkColor colors[], SkXfermode*, | 254 const SkColor colors[], SkXfermode*, |
255 const uint16_t indices[], int indexCount, | 255 const uint16_t indices[], int indexCount, |
256 const SkPaint&) SK_OVERRIDE; | 256 const SkPaint&) SK_OVERRIDE; |
| 257 virtual void drawPatch(const SkPatch& patch, const SkPaint& paint) SK_OVERRI
DE; |
257 virtual void drawData(const void*, size_t) SK_OVERRIDE; | 258 virtual void drawData(const void*, size_t) SK_OVERRIDE; |
258 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 259 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
259 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 260 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
260 virtual void endCommentGroup() SK_OVERRIDE; | 261 virtual void endCommentGroup() SK_OVERRIDE; |
261 | 262 |
262 /** | 263 /** |
263 * Flatten an SkBitmap to send to the reader, where it will be referenced | 264 * Flatten an SkBitmap to send to the reader, where it will be referenced |
264 * according to slot. | 265 * according to slot. |
265 */ | 266 */ |
266 bool shuttleBitmap(const SkBitmap&, int32_t slot); | 267 bool shuttleBitmap(const SkBitmap&, int32_t slot); |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 SkAssertResult(xfer->asMode(&mode)); | 991 SkAssertResult(xfer->asMode(&mode)); |
991 fWriter.write32(mode); | 992 fWriter.write32(mode); |
992 } | 993 } |
993 if (flags & kDrawVertices_HasIndices_DrawOpFlag) { | 994 if (flags & kDrawVertices_HasIndices_DrawOpFlag) { |
994 fWriter.write32(indexCount); | 995 fWriter.write32(indexCount); |
995 fWriter.writePad(indices, indexCount * sizeof(uint16_t)); | 996 fWriter.writePad(indices, indexCount * sizeof(uint16_t)); |
996 } | 997 } |
997 } | 998 } |
998 } | 999 } |
999 | 1000 |
| 1001 void SkGPipeCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) { |
| 1002 NOTIFY_SETUP(this); |
| 1003 this->writePaint(paint); |
| 1004 if (this->needOpBytes(patch.writeToMemory(NULL))) { |
| 1005 this->writeOp(kDrawPatch_DrawOp); |
| 1006 fWriter.writePatch(patch); |
| 1007 } |
| 1008 } |
| 1009 |
1000 void SkGPipeCanvas::drawData(const void* ptr, size_t size) { | 1010 void SkGPipeCanvas::drawData(const void* ptr, size_t size) { |
1001 if (size && ptr) { | 1011 if (size && ptr) { |
1002 NOTIFY_SETUP(this); | 1012 NOTIFY_SETUP(this); |
1003 unsigned data = 0; | 1013 unsigned data = 0; |
1004 if (size < (1 << DRAWOPS_DATA_BITS)) { | 1014 if (size < (1 << DRAWOPS_DATA_BITS)) { |
1005 data = (unsigned)size; | 1015 data = (unsigned)size; |
1006 } | 1016 } |
1007 if (this->needOpBytes(4 + SkAlign4(size))) { | 1017 if (this->needOpBytes(4 + SkAlign4(size))) { |
1008 this->writeOp(kDrawData_DrawOp, 0, data); | 1018 this->writeOp(kDrawData_DrawOp, 0, data); |
1009 if (0 == data) { | 1019 if (0 == data) { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 return fCanvas->shuttleBitmap(bitmap, slot); | 1270 return fCanvas->shuttleBitmap(bitmap, slot); |
1261 } | 1271 } |
1262 | 1272 |
1263 void BitmapShuttle::removeCanvas() { | 1273 void BitmapShuttle::removeCanvas() { |
1264 if (NULL == fCanvas) { | 1274 if (NULL == fCanvas) { |
1265 return; | 1275 return; |
1266 } | 1276 } |
1267 fCanvas->unref(); | 1277 fCanvas->unref(); |
1268 fCanvas = NULL; | 1278 fCanvas = NULL; |
1269 } | 1279 } |
OLD | NEW |