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 "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 this->writeOp(kDef_Factory_DrawOp); | 336 this->writeOp(kDef_Factory_DrawOp); |
337 fWriter.writeString(name, len); | 337 fWriter.writeString(name, len); |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) { | 342 bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) { |
343 SkASSERT(shouldFlattenBitmaps(fFlags)); | 343 SkASSERT(shouldFlattenBitmaps(fFlags)); |
344 SkOrderedWriteBuffer buffer(1024); | 344 SkOrderedWriteBuffer buffer(1024); |
345 buffer.setNamedFactoryRecorder(fFactorySet); | 345 buffer.setNamedFactoryRecorder(fFactorySet); |
346 bm.flatten(buffer); | 346 buffer.writeBitmap(bm); |
347 this->flattenFactoryNames(); | 347 this->flattenFactoryNames(); |
348 uint32_t size = buffer.size(); | 348 uint32_t size = buffer.size(); |
349 if (this->needOpBytes(size)) { | 349 if (this->needOpBytes(size)) { |
350 this->writeOp(kDef_Bitmap_DrawOp, 0, slot); | 350 this->writeOp(kDef_Bitmap_DrawOp, 0, slot); |
351 void* dst = static_cast<void*>(fWriter.reserve(size)); | 351 void* dst = static_cast<void*>(fWriter.reserve(size)); |
352 buffer.writeToMemory(dst); | 352 buffer.writeToMemory(dst); |
353 return true; | 353 return true; |
354 } | 354 } |
355 return false; | 355 return false; |
356 } | 356 } |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 fCanvas->ref(); | 1171 fCanvas->ref(); |
1172 } | 1172 } |
1173 | 1173 |
1174 BitmapShuttle::~BitmapShuttle() { | 1174 BitmapShuttle::~BitmapShuttle() { |
1175 fCanvas->unref(); | 1175 fCanvas->unref(); |
1176 } | 1176 } |
1177 | 1177 |
1178 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { | 1178 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { |
1179 return fCanvas->shuttleBitmap(bitmap, slot); | 1179 return fCanvas->shuttleBitmap(bitmap, slot); |
1180 } | 1180 } |
OLD | NEW |