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 "SkImage_Base.h" | 9 #include "SkImage_Base.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 void SkPictureRecord::onDrawOval(const SkRect& oval, const SkPaint& paint) { | 422 void SkPictureRecord::onDrawOval(const SkRect& oval, const SkPaint& paint) { |
423 // op + paint index + rect | 423 // op + paint index + rect |
424 size_t size = 2 * kUInt32Size + sizeof(oval); | 424 size_t size = 2 * kUInt32Size + sizeof(oval); |
425 size_t initialOffset = this->addDraw(DRAW_OVAL, &size); | 425 size_t initialOffset = this->addDraw(DRAW_OVAL, &size); |
426 this->addPaint(paint); | 426 this->addPaint(paint); |
427 this->addRect(oval); | 427 this->addRect(oval); |
428 this->validate(initialOffset, size); | 428 this->validate(initialOffset, size); |
429 } | 429 } |
430 | 430 |
| 431 void SkPictureRecord::onDrawArc(const SkRect& oval, SkScalar startAngle, SkScala
r sweepAngle, |
| 432 bool useCenter, const SkPaint& paint) { |
| 433 // op + paint index + rect + start + sweep + bool (as int) |
| 434 size_t size = 2 * kUInt32Size + sizeof(oval) + sizeof(startAngle) + sizeof(s
weepAngle) + |
| 435 sizeof(int); |
| 436 size_t initialOffset = this->addDraw(DRAW_ARC, &size); |
| 437 this->addPaint(paint); |
| 438 this->addRect(oval); |
| 439 this->addScalar(startAngle); |
| 440 this->addScalar(sweepAngle); |
| 441 this->addInt(useCenter); |
| 442 this->validate(initialOffset, size); |
| 443 } |
| 444 |
431 void SkPictureRecord::onDrawRect(const SkRect& rect, const SkPaint& paint) { | 445 void SkPictureRecord::onDrawRect(const SkRect& rect, const SkPaint& paint) { |
432 // op + paint index + rect | 446 // op + paint index + rect |
433 size_t size = 2 * kUInt32Size + sizeof(rect); | 447 size_t size = 2 * kUInt32Size + sizeof(rect); |
434 size_t initialOffset = this->addDraw(DRAW_RECT, &size); | 448 size_t initialOffset = this->addDraw(DRAW_RECT, &size); |
435 this->addPaint(paint); | 449 this->addPaint(paint); |
436 this->addRect(rect); | 450 this->addRect(rect); |
437 this->validate(initialOffset, size); | 451 this->validate(initialOffset, size); |
438 } | 452 } |
439 | 453 |
440 void SkPictureRecord::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { | 454 void SkPictureRecord::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 | 972 |
959 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 973 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
960 int index = fTextBlobRefs.count(); | 974 int index = fTextBlobRefs.count(); |
961 *fTextBlobRefs.append() = blob; | 975 *fTextBlobRefs.append() = blob; |
962 blob->ref(); | 976 blob->ref(); |
963 // follow the convention of recording a 1-based index | 977 // follow the convention of recording a 1-based index |
964 this->addInt(index + 1); | 978 this->addInt(index + 1); |
965 } | 979 } |
966 | 980 |
967 /////////////////////////////////////////////////////////////////////////////// | 981 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |