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 | |
471 void SkPictureRecord::drawPaint(const SkPaint& paint) { | 463 void SkPictureRecord::drawPaint(const SkPaint& paint) { |
472 // op + paint index | 464 // op + paint index |
473 size_t size = 2 * kUInt32Size; | 465 size_t size = 2 * kUInt32Size; |
474 size_t initialOffset = this->addDraw(DRAW_PAINT, &size); | 466 size_t initialOffset = this->addDraw(DRAW_PAINT, &size); |
475 SkASSERT(initialOffset+get_paint_offset(DRAW_PAINT, size) == fWriter.bytesWr
itten()); | 467 SkASSERT(initialOffset+get_paint_offset(DRAW_PAINT, size) == fWriter.bytesWr
itten()); |
476 this->addPaint(paint); | 468 this->addPaint(paint); |
477 this->validate(initialOffset, size); | 469 this->validate(initialOffset, size); |
478 } | 470 } |
479 | 471 |
480 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
[], | 472 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts
[], |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1052 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
1061 int index = fTextBlobRefs.count(); | 1053 int index = fTextBlobRefs.count(); |
1062 *fTextBlobRefs.append() = blob; | 1054 *fTextBlobRefs.append() = blob; |
1063 blob->ref(); | 1055 blob->ref(); |
1064 // follow the convention of recording a 1-based index | 1056 // follow the convention of recording a 1-based index |
1065 this->addInt(index + 1); | 1057 this->addInt(index + 1); |
1066 } | 1058 } |
1067 | 1059 |
1068 /////////////////////////////////////////////////////////////////////////////// | 1060 /////////////////////////////////////////////////////////////////////////////// |
1069 | 1061 |
OLD | NEW |