Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1164)

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 137433003: Convert SkWriter32 to use an SkTDArray for its internal storage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: of course 0's fine too... Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkWriter32.cpp ('k') | src/utils/SkCanvasStateUtils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkWriter32.cpp ('k') | src/utils/SkCanvasStateUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698