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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 size_t len = strlen(name); | 363 size_t len = strlen(name); |
364 if (this->needOpBytes(len)) { | 364 if (this->needOpBytes(len)) { |
365 this->writeOp(kDef_Factory_DrawOp); | 365 this->writeOp(kDef_Factory_DrawOp); |
366 fWriter.writeString(name, len); | 366 fWriter.writeString(name, len); |
367 } | 367 } |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) { | 371 bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) { |
372 SkASSERT(shouldFlattenBitmaps(fFlags)); | 372 SkASSERT(shouldFlattenBitmaps(fFlags)); |
373 SkOrderedWriteBuffer buffer(1024); | 373 SkOrderedWriteBuffer buffer; |
374 buffer.setNamedFactoryRecorder(fFactorySet); | 374 buffer.setNamedFactoryRecorder(fFactorySet); |
375 buffer.writeBitmap(bm); | 375 buffer.writeBitmap(bm); |
376 this->flattenFactoryNames(); | 376 this->flattenFactoryNames(); |
377 uint32_t size = buffer.size(); | 377 uint32_t size = buffer.size(); |
378 if (this->needOpBytes(size)) { | 378 if (this->needOpBytes(size)) { |
379 this->writeOp(kDef_Bitmap_DrawOp, 0, slot); | 379 this->writeOp(kDef_Bitmap_DrawOp, 0, slot); |
380 void* dst = static_cast<void*>(fWriter.reserve(size)); | 380 void* dst = static_cast<void*>(fWriter.reserve(size)); |
381 buffer.writeToMemory(dst); | 381 buffer.writeToMemory(dst); |
382 return true; | 382 return true; |
383 } | 383 } |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 | 1139 |
1140 // | 1140 // |
1141 // Do these after we've written kPaintOp_DrawOp | 1141 // Do these after we've written kPaintOp_DrawOp |
1142 | 1142 |
1143 if (base.getAnnotation() != paint.getAnnotation()) { | 1143 if (base.getAnnotation() != paint.getAnnotation()) { |
1144 if (NULL == paint.getAnnotation()) { | 1144 if (NULL == paint.getAnnotation()) { |
1145 if (this->needOpBytes()) { | 1145 if (this->needOpBytes()) { |
1146 this->writeOp(kSetAnnotation_DrawOp, 0, 0); | 1146 this->writeOp(kSetAnnotation_DrawOp, 0, 0); |
1147 } | 1147 } |
1148 } else { | 1148 } else { |
1149 SkOrderedWriteBuffer buffer(1024); | 1149 SkOrderedWriteBuffer buffer; |
1150 paint.getAnnotation()->writeToBuffer(buffer); | 1150 paint.getAnnotation()->writeToBuffer(buffer); |
1151 const size_t size = buffer.bytesWritten(); | 1151 const size_t size = buffer.bytesWritten(); |
1152 if (this->needOpBytes(size)) { | 1152 if (this->needOpBytes(size)) { |
1153 this->writeOp(kSetAnnotation_DrawOp, 0, size); | 1153 this->writeOp(kSetAnnotation_DrawOp, 0, size); |
1154 buffer.writeToMemory(fWriter.reserve(size)); | 1154 buffer.writeToMemory(fWriter.reserve(size)); |
1155 } | 1155 } |
1156 } | 1156 } |
1157 base.setAnnotation(paint.getAnnotation()); | 1157 base.setAnnotation(paint.getAnnotation()); |
1158 } | 1158 } |
1159 } | 1159 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 return fCanvas->shuttleBitmap(bitmap, slot); | 1233 return fCanvas->shuttleBitmap(bitmap, slot); |
1234 } | 1234 } |
1235 | 1235 |
1236 void BitmapShuttle::removeCanvas() { | 1236 void BitmapShuttle::removeCanvas() { |
1237 if (NULL == fCanvas) { | 1237 if (NULL == fCanvas) { |
1238 return; | 1238 return; |
1239 } | 1239 } |
1240 fCanvas->unref(); | 1240 fCanvas->unref(); |
1241 fCanvas = NULL; | 1241 fCanvas = NULL; |
1242 } | 1242 } |
OLD | NEW |