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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 | 288 |
289 inline void writeOp(DrawOps op) { | 289 inline void writeOp(DrawOps op) { |
290 fWriter.write32(DrawOp_packOpFlagData(op, 0, 0)); | 290 fWriter.write32(DrawOp_packOpFlagData(op, 0, 0)); |
291 } | 291 } |
292 | 292 |
293 bool needOpBytes(size_t size = 0); | 293 bool needOpBytes(size_t size = 0); |
294 | 294 |
295 inline void doNotify() { | 295 inline void doNotify() { |
296 if (!fDone) { | 296 if (!fDone) { |
297 size_t bytes = fWriter.size() - fBytesNotified; | 297 size_t bytes = fWriter.bytesWritten() - fBytesNotified; |
298 if (bytes > 0) { | 298 if (bytes > 0) { |
299 fController->notifyWritten(bytes); | 299 fController->notifyWritten(bytes); |
300 fBytesNotified += bytes; | 300 fBytesNotified += bytes; |
301 } | 301 } |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 // Should be called after any calls to an SkFlatDictionary::findAndReplace | 305 // Should be called after any calls to an SkFlatDictionary::findAndReplace |
306 // if a new SkFlatData was added when in cross process mode | 306 // if a new SkFlatData was added when in cross process mode |
307 void flattenFactoryNames(); | 307 void flattenFactoryNames(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 SkSafeUnref(fFactorySet); | 460 SkSafeUnref(fFactorySet); |
461 SkSafeUnref(fBitmapHeap); | 461 SkSafeUnref(fBitmapHeap); |
462 } | 462 } |
463 | 463 |
464 bool SkGPipeCanvas::needOpBytes(size_t needed) { | 464 bool SkGPipeCanvas::needOpBytes(size_t needed) { |
465 if (fDone) { | 465 if (fDone) { |
466 return false; | 466 return false; |
467 } | 467 } |
468 | 468 |
469 needed += 4; // size of DrawOp atom | 469 needed += 4; // size of DrawOp atom |
470 if (fWriter.size() + needed > fBlockSize) { | 470 if (fWriter.bytesWritten() + needed > fBlockSize) { |
471 // Before we wipe out any data that has already been written, read it | 471 // Before we wipe out any data that has already been written, read it |
472 // out. | 472 // out. |
473 this->doNotify(); | 473 this->doNotify(); |
474 size_t blockSize = SkMax32(MIN_BLOCK_SIZE, needed); | 474 size_t blockSize = SkMax32(MIN_BLOCK_SIZE, needed); |
475 void* block = fController->requestBlock(blockSize, &fBlockSize); | 475 void* block = fController->requestBlock(blockSize, &fBlockSize); |
476 if (NULL == block) { | 476 if (NULL == block) { |
477 fDone = true; | 477 fDone = true; |
478 return false; | 478 return false; |
479 } | 479 } |
480 SkASSERT(SkIsAlign4(fBlockSize)); | 480 SkASSERT(SkIsAlign4(fBlockSize)); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 fCanvas->ref(); | 1210 fCanvas->ref(); |
1211 } | 1211 } |
1212 | 1212 |
1213 BitmapShuttle::~BitmapShuttle() { | 1213 BitmapShuttle::~BitmapShuttle() { |
1214 fCanvas->unref(); | 1214 fCanvas->unref(); |
1215 } | 1215 } |
1216 | 1216 |
1217 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { | 1217 bool BitmapShuttle::insert(const SkBitmap& bitmap, int32_t slot) { |
1218 return fCanvas->shuttleBitmap(bitmap, slot); | 1218 return fCanvas->shuttleBitmap(bitmap, slot); |
1219 } | 1219 } |
OLD | NEW |