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

Side by Side Diff: src/core/SkDevice.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/SkCanvas.cpp ('k') | src/core/SkLiteDL.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 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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 break; 66 break;
67 case kNever_TileUsage: 67 case kNever_TileUsage:
68 if (!preserveLCDText) { 68 if (!preserveLCDText) {
69 geo = kUnknown_SkPixelGeometry; 69 geo = kUnknown_SkPixelGeometry;
70 } 70 }
71 break; 71 break;
72 } 72 }
73 return geo; 73 return geo;
74 } 74 }
75 75
76 void SkBaseDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar star tAngle,
77 SkScalar sweepAngle, bool useCenter, const SkPaint& p aint) {
78 SkASSERT(SkScalarAbs(sweepAngle) >= 0.f && SkScalarAbs(sweepAngle) < 360.f);
79 SkPath path;
80 if (useCenter) {
81 path.moveTo(oval.centerX(), oval.centerY());
82 }
83 path.arcTo(oval, startAngle, sweepAngle, !useCenter);
84 if (useCenter) {
85 path.close();
86 }
87 this->drawPath(draw, path, paint);
88 }
89
76 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 90 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
77 const SkRRect& inner, const SkPaint& paint) { 91 const SkRRect& inner, const SkPaint& paint) {
78 SkPath path; 92 SkPath path;
79 path.addRRect(outer); 93 path.addRRect(outer);
80 path.addRRect(inner); 94 path.addRRect(inner);
81 path.setFillType(SkPath::kEvenOdd_FillType); 95 path.setFillType(SkPath::kEvenOdd_FillType);
82 96
83 const SkMatrix* preMatrix = nullptr; 97 const SkMatrix* preMatrix = nullptr;
84 const bool pathIsMutable = true; 98 const bool pathIsMutable = true;
85 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); 99 this->drawPath(draw, path, paint, preMatrix, pathIsMutable);
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 549
536 // Also log filter quality independent scale factor. 550 // Also log filter quality independent scale factor.
537 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, 551 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor,
538 kLast_ScaleFactor + 1); 552 kLast_ScaleFactor + 1);
539 553
540 // Also log an overall histogram of filter quality. 554 // Also log an overall histogram of filter quality.
541 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1); 555 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1);
542 #endif 556 #endif
543 } 557 }
544 558
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkLiteDL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698