Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/core/SkLiteDL.cpp

Issue 2257023003: Plumb drawArc to SkDevice (Closed) Base URL: https://chromium.googlesource.com/skia.git@distance
Patch Set: Address comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkLiteDL.h ('k') | src/core/SkLiteRecorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkImageFilter.h" 10 #include "SkImageFilter.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 static void make_threadsafe(SkPath* path, SkMatrix* matrix) { 47 static void make_threadsafe(SkPath* path, SkMatrix* matrix) {
48 if (path) { path->updateBoundsCache(); } 48 if (path) { path->updateBoundsCache(); }
49 if (matrix) { (void)matrix->getType(); } 49 if (matrix) { (void)matrix->getType(); }
50 } 50 }
51 51
52 namespace { 52 namespace {
53 #define TYPES(M) \ 53 #define TYPES(M) \
54 M(Save) M(Restore) M(SaveLayer) \ 54 M(Save) M(Restore) M(SaveLayer) \
55 M(Concat) M(SetMatrix) M(TranslateZ) \ 55 M(Concat) M(SetMatrix) M(TranslateZ) \
56 M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \ 56 M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \
57 M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawOval) M(DrawRRect) M(DrawDRRect) \ 57 M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawOval) M(DrawArc) M(DrawRRect) \
58 M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) M(DrawShadowedPicture) \ 58 M(DrawDRRect) M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) \
59 M(DrawShadowedPicture) \
59 M(DrawImage) M(DrawImageNine) M(DrawImageRect) M(DrawImageLattice) \ 60 M(DrawImage) M(DrawImageNine) M(DrawImageRect) M(DrawImageLattice) \
60 M(DrawText) M(DrawPosText) M(DrawPosTextH) \ 61 M(DrawText) M(DrawPosText) M(DrawPosTextH) \
61 M(DrawTextOnPath) M(DrawTextRSXform) M(DrawTextBlob) \ 62 M(DrawTextOnPath) M(DrawTextRSXform) M(DrawTextBlob) \
62 M(DrawPatch) M(DrawPoints) M(DrawVertices) M(DrawAtlas) 63 M(DrawPatch) M(DrawPoints) M(DrawVertices) M(DrawAtlas)
63 64
64 #define M(T) T, 65 #define M(T) T,
65 enum class Type : uint8_t { TYPES(M) }; 66 enum class Type : uint8_t { TYPES(M) };
66 #undef M 67 #undef M
67 68
68 struct Op { 69 struct Op {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 SkPaint paint; 181 SkPaint paint;
181 void draw(SkCanvas* c, const SkMatrix&) { c->drawRect(rect, paint); } 182 void draw(SkCanvas* c, const SkMatrix&) { c->drawRect(rect, paint); }
182 }; 183 };
183 struct DrawOval final : Op { 184 struct DrawOval final : Op {
184 static const auto kType = Type::DrawOval; 185 static const auto kType = Type::DrawOval;
185 DrawOval(const SkRect& oval, const SkPaint& paint) : oval(oval), paint(p aint) {} 186 DrawOval(const SkRect& oval, const SkPaint& paint) : oval(oval), paint(p aint) {}
186 SkRect oval; 187 SkRect oval;
187 SkPaint paint; 188 SkPaint paint;
188 void draw(SkCanvas* c, const SkMatrix&) { c->drawOval(oval, paint); } 189 void draw(SkCanvas* c, const SkMatrix&) { c->drawOval(oval, paint); }
189 }; 190 };
191 struct DrawArc final : Op {
192 static const auto kType = Type::DrawArc;
193 DrawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bo ol useCenter,
194 const SkPaint& paint)
195 : oval(oval), startAngle(startAngle), sweepAngle(sweepAngle), useCen ter(useCenter)
196 , paint(paint) {}
197 SkRect oval;
198 SkScalar startAngle;
199 SkScalar sweepAngle;
200 bool useCenter;
201 SkPaint paint;
202 void draw(SkCanvas* c, const SkMatrix&) { c->drawArc(oval, startAngle, s weepAngle,
203 useCenter, paint); }
204 };
190 struct DrawRRect final : Op { 205 struct DrawRRect final : Op {
191 static const auto kType = Type::DrawRRect; 206 static const auto kType = Type::DrawRRect;
192 DrawRRect(const SkRRect& rrect, const SkPaint& paint) : rrect(rrect), pa int(paint) {} 207 DrawRRect(const SkRRect& rrect, const SkPaint& paint) : rrect(rrect), pa int(paint) {}
193 SkRRect rrect; 208 SkRRect rrect;
194 SkPaint paint; 209 SkPaint paint;
195 void draw(SkCanvas* c, const SkMatrix&) { c->drawRRect(rrect, paint); } 210 void draw(SkCanvas* c, const SkMatrix&) { c->drawRRect(rrect, paint); }
196 }; 211 };
197 struct DrawDRRect final : Op { 212 struct DrawDRRect final : Op {
198 static const auto kType = Type::DrawDRRect; 213 static const auto kType = Type::DrawDRRect;
199 DrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& pa int) 214 DrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& pa int)
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 576 }
562 void SkLiteDL::drawPath(const SkPath& path, const SkPaint& paint) { 577 void SkLiteDL::drawPath(const SkPath& path, const SkPaint& paint) {
563 this->push<DrawPath>(0, path, paint); 578 this->push<DrawPath>(0, path, paint);
564 } 579 }
565 void SkLiteDL::drawRect(const SkRect& rect, const SkPaint& paint) { 580 void SkLiteDL::drawRect(const SkRect& rect, const SkPaint& paint) {
566 this->push<DrawRect>(0, rect, paint); 581 this->push<DrawRect>(0, rect, paint);
567 } 582 }
568 void SkLiteDL::drawOval(const SkRect& oval, const SkPaint& paint) { 583 void SkLiteDL::drawOval(const SkRect& oval, const SkPaint& paint) {
569 this->push<DrawOval>(0, oval, paint); 584 this->push<DrawOval>(0, oval, paint);
570 } 585 }
586 void SkLiteDL::drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAn gle, bool useCenter,
587 const SkPaint& paint) {
588 this->push<DrawArc>(0, oval, startAngle, sweepAngle, useCenter, paint);
589 }
571 void SkLiteDL::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 590 void SkLiteDL::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
572 this->push<DrawRRect>(0, rrect, paint); 591 this->push<DrawRRect>(0, rrect, paint);
573 } 592 }
574 void SkLiteDL::drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPa int& paint) { 593 void SkLiteDL::drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPa int& paint) {
575 this->push<DrawDRRect>(0, outer, inner, paint); 594 this->push<DrawDRRect>(0, outer, inner, paint);
576 } 595 }
577 596
578 void SkLiteDL::drawAnnotation(const SkRect& rect, const char* key, SkData* value ) { 597 void SkLiteDL::drawAnnotation(const SkRect& rect, const char* key, SkData* value ) {
579 size_t bytes = strlen(key)+1; 598 size_t bytes = strlen(key)+1;
580 void* pod = this->push<DrawAnnotation>(bytes, rect, value); 599 void* pod = this->push<DrawAnnotation>(bytes, rect, value);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 763 }
745 764
746 void SkLiteDL::reset(SkRect bounds) { 765 void SkLiteDL::reset(SkRect bounds) {
747 SkASSERT(this->unique()); 766 SkASSERT(this->unique());
748 this->map(dtor_fns); 767 this->map(dtor_fns);
749 768
750 // Leave fBytes and fReserved alone. 769 // Leave fBytes and fReserved alone.
751 fUsed = 0; 770 fUsed = 0;
752 fBounds = bounds; 771 fBounds = bounds;
753 } 772 }
OLDNEW
« no previous file with comments | « src/core/SkLiteDL.h ('k') | src/core/SkLiteRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698