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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 DrawBitmapRectFlags flags) SK_OVERRIDE; | 246 DrawBitmapRectFlags flags) SK_OVERRIDE; |
247 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 247 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
248 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; | 248 const SkRect& dst, const SkPaint* paint = NULL)
SK_OVERRIDE; |
249 virtual void drawSprite(const SkBitmap&, int left, int top, | 249 virtual void drawSprite(const SkBitmap&, int left, int top, |
250 const SkPaint*) SK_OVERRIDE; | 250 const SkPaint*) SK_OVERRIDE; |
251 virtual void drawVertices(VertexMode, int vertexCount, | 251 virtual void drawVertices(VertexMode, int vertexCount, |
252 const SkPoint vertices[], const SkPoint texs[], | 252 const SkPoint vertices[], const SkPoint texs[], |
253 const SkColor colors[], SkXfermode*, | 253 const SkColor colors[], SkXfermode*, |
254 const uint16_t indices[], int indexCount, | 254 const uint16_t indices[], int indexCount, |
255 const SkPaint&) SK_OVERRIDE; | 255 const SkPaint&) SK_OVERRIDE; |
256 virtual void drawData(const void*, size_t) SK_OVERRIDE; | |
257 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 256 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
258 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 257 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
259 virtual void endCommentGroup() SK_OVERRIDE; | 258 virtual void endCommentGroup() SK_OVERRIDE; |
260 | 259 |
261 /** | 260 /** |
262 * Flatten an SkBitmap to send to the reader, where it will be referenced | 261 * Flatten an SkBitmap to send to the reader, where it will be referenced |
263 * according to slot. | 262 * according to slot. |
264 */ | 263 */ |
265 bool shuttleBitmap(const SkBitmap&, int32_t slot); | 264 bool shuttleBitmap(const SkBitmap&, int32_t slot); |
266 | 265 |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 } | 1078 } |
1080 | 1079 |
1081 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { | 1080 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) { |
1082 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; | 1081 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; |
1083 SkAssertResult(xmode->asMode(&mode)); | 1082 SkAssertResult(xmode->asMode(&mode)); |
1084 fWriter.write32(mode); | 1083 fWriter.write32(mode); |
1085 } | 1084 } |
1086 } | 1085 } |
1087 } | 1086 } |
1088 | 1087 |
1089 void SkGPipeCanvas::drawData(const void* ptr, size_t size) { | |
1090 if (size && ptr) { | |
1091 NOTIFY_SETUP(this); | |
1092 unsigned data = 0; | |
1093 if (size < (1 << DRAWOPS_DATA_BITS)) { | |
1094 data = (unsigned)size; | |
1095 } | |
1096 if (this->needOpBytes(4 + SkAlign4(size))) { | |
1097 this->writeOp(kDrawData_DrawOp, 0, data); | |
1098 if (0 == data) { | |
1099 fWriter.write32(SkToU32(size)); | |
1100 } | |
1101 fWriter.writePad(ptr, size); | |
1102 } | |
1103 } | |
1104 } | |
1105 | |
1106 void SkGPipeCanvas::beginCommentGroup(const char* description) { | 1088 void SkGPipeCanvas::beginCommentGroup(const char* description) { |
1107 // ignore for now | 1089 // ignore for now |
1108 } | 1090 } |
1109 | 1091 |
1110 void SkGPipeCanvas::addComment(const char* kywd, const char* value) { | 1092 void SkGPipeCanvas::addComment(const char* kywd, const char* value) { |
1111 // ignore for now | 1093 // ignore for now |
1112 } | 1094 } |
1113 | 1095 |
1114 void SkGPipeCanvas::endCommentGroup() { | 1096 void SkGPipeCanvas::endCommentGroup() { |
1115 // ignore for now | 1097 // ignore for now |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 return fCanvas->shuttleBitmap(bitmap, slot); | 1331 return fCanvas->shuttleBitmap(bitmap, slot); |
1350 } | 1332 } |
1351 | 1333 |
1352 void BitmapShuttle::removeCanvas() { | 1334 void BitmapShuttle::removeCanvas() { |
1353 if (NULL == fCanvas) { | 1335 if (NULL == fCanvas) { |
1354 return; | 1336 return; |
1355 } | 1337 } |
1356 fCanvas->unref(); | 1338 fCanvas->unref(); |
1357 fCanvas = NULL; | 1339 fCanvas = NULL; |
1358 } | 1340 } |
OLD | NEW |