| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 453 } |
| 454 size_t initialOffset = this->addDraw(CLIP_REGION, &size); | 454 size_t initialOffset = this->addDraw(CLIP_REGION, &size); |
| 455 this->addRegion(region); | 455 this->addRegion(region); |
| 456 this->addInt(ClipParams_pack(op, false)); | 456 this->addInt(ClipParams_pack(op, false)); |
| 457 size_t offset = this->recordRestoreOffsetPlaceholder(op); | 457 size_t offset = this->recordRestoreOffsetPlaceholder(op); |
| 458 | 458 |
| 459 this->validate(initialOffset, size); | 459 this->validate(initialOffset, size); |
| 460 return offset; | 460 return offset; |
| 461 } | 461 } |
| 462 | 462 |
| 463 void SkPictureRecord::clear(SkColor color) { |
| 464 // op + color |
| 465 size_t size = 2 * kUInt32Size; |
| 466 size_t initialOffset = this->addDraw(DRAW_CLEAR, &size); |
| 467 this->addInt(color); |
| 468 this->validate(initialOffset, size); |
| 469 } |
| 470 |
| 463 void SkPictureRecord::drawPaint(const SkPaint& paint) { | 471 void SkPictureRecord::drawPaint(const SkPaint& paint) { |
| 464 // op + paint index | 472 // op + paint index |
| 465 size_t size = 2 * kUInt32Size; | 473 size_t size = 2 * kUInt32Size; |
| 466 size_t initialOffset = this->addDraw(DRAW_PAINT, &size); | 474 size_t initialOffset = this->addDraw(DRAW_PAINT, &size); |
| 467 SkASSERT(initialOffset+get_paint_offset(DRAW_PAINT, size) == fWriter.bytesWr
itten()); | 475 SkASSERT(initialOffset+get_paint_offset(DRAW_PAINT, size) == fWriter.bytesWr
itten()); |
| 468 this->addPaint(paint); | 476 this->addPaint(paint); |
| 469 this->validate(initialOffset, size); | 477 this->validate(initialOffset, size); |
| 470 } | 478 } |
| 471 | 479 |
| 472 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
[], | 480 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
[], |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1060 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
| 1053 int index = fTextBlobRefs.count(); | 1061 int index = fTextBlobRefs.count(); |
| 1054 *fTextBlobRefs.append() = blob; | 1062 *fTextBlobRefs.append() = blob; |
| 1055 blob->ref(); | 1063 blob->ref(); |
| 1056 // follow the convention of recording a 1-based index | 1064 // follow the convention of recording a 1-based index |
| 1057 this->addInt(index + 1); | 1065 this->addInt(index + 1); |
| 1058 } | 1066 } |
| 1059 | 1067 |
| 1060 /////////////////////////////////////////////////////////////////////////////// | 1068 /////////////////////////////////////////////////////////////////////////////// |
| 1061 | 1069 |
| OLD | NEW |