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