| 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 for (size_t i = 0; i < size/4; i++) { | 1121 for (size_t i = 0; i < size/4; i++) { |
| 1122 // SkDebugf("[%d] %08X\n", i, storage[i]); | 1122 // SkDebugf("[%d] %08X\n", i, storage[i]); |
| 1123 } | 1123 } |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 // | 1126 // |
| 1127 // Do these after we've written kPaintOp_DrawOp | 1127 // Do these after we've written kPaintOp_DrawOp |
| 1128 | 1128 |
| 1129 if (base.getAnnotation() != paint.getAnnotation()) { | 1129 if (base.getAnnotation() != paint.getAnnotation()) { |
| 1130 if (NULL == paint.getAnnotation()) { | 1130 if (NULL == paint.getAnnotation()) { |
| 1131 this->writeOp(kSetAnnotation_DrawOp, 0, 0); | 1131 if (this->needOpBytes()) { |
| 1132 this->writeOp(kSetAnnotation_DrawOp, 0, 0); |
| 1133 } |
| 1132 } else { | 1134 } else { |
| 1133 SkOrderedWriteBuffer buffer(1024); | 1135 SkOrderedWriteBuffer buffer(1024); |
| 1134 paint.getAnnotation()->writeToBuffer(buffer); | 1136 paint.getAnnotation()->writeToBuffer(buffer); |
| 1135 size = buffer.bytesWritten(); | 1137 const size_t size = buffer.bytesWritten(); |
| 1136 | 1138 if (this->needOpBytes(size)) { |
| 1137 SkAutoMalloc storage(size); | 1139 this->writeOp(kSetAnnotation_DrawOp, 0, size); |
| 1138 buffer.writeToMemory(storage.get()); | 1140 buffer.writeToMemory(fWriter.reserve(size)); |
| 1139 | 1141 } |
| 1140 this->writeOp(kSetAnnotation_DrawOp, 0, 1); | |
| 1141 fWriter.write32(size); | |
| 1142 fWriter.write(storage.get(), size); | |
| 1143 } | 1142 } |
| 1144 } | 1143 } |
| 1145 } | 1144 } |
| 1146 | 1145 |
| 1147 /////////////////////////////////////////////////////////////////////////////// | 1146 /////////////////////////////////////////////////////////////////////////////// |
| 1148 | 1147 |
| 1149 #include "SkGPipe.h" | 1148 #include "SkGPipe.h" |
| 1150 | 1149 |
| 1151 SkGPipeController::~SkGPipeController() { | 1150 SkGPipeController::~SkGPipeController() { |
| 1152 SkSafeUnref(fCanvas); | 1151 SkSafeUnref(fCanvas); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 fCanvas->ref(); | 1209 fCanvas->ref(); |
| 1211 } | 1210 } |
| 1212 | 1211 |
| 1213 BitmapShuttle::~BitmapShuttle() { | 1212 BitmapShuttle::~BitmapShuttle() { |
| 1214 fCanvas->unref(); | 1213 fCanvas->unref(); |
| 1215 } | 1214 } |
| 1216 | 1215 |
| 1217 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { | 1216 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { |
| 1218 return fCanvas->shuttleBitmap(bitmap, slot); | 1217 return fCanvas->shuttleBitmap(bitmap, slot); |
| 1219 } | 1218 } |
| OLD | NEW |