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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
11 #include "SkDrawFilter.h" | 11 #include "SkDrawFilter.h" |
12 #include "SkImage_Base.h" | 12 #include "SkImage_Base.h" |
13 #include "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
14 #include "SkImageFilterCache.h" | 14 #include "SkImageFilterCache.h" |
15 #include "SkImagePriv.h" | 15 #include "SkImagePriv.h" |
16 #include "SkLatticeIter.h" | 16 #include "SkLatticeIter.h" |
17 #include "SkMetaData.h" | 17 #include "SkMetaData.h" |
18 #include "SkPatchUtils.h" | 18 #include "SkPatchUtils.h" |
| 19 #include "SkPathPriv.h" |
19 #include "SkPathMeasure.h" | 20 #include "SkPathMeasure.h" |
20 #include "SkRasterClip.h" | 21 #include "SkRasterClip.h" |
21 #include "SkRSXform.h" | 22 #include "SkRSXform.h" |
22 #include "SkShader.h" | 23 #include "SkShader.h" |
23 #include "SkSpecialImage.h" | 24 #include "SkSpecialImage.h" |
24 #include "SkTextBlobRunIterator.h" | 25 #include "SkTextBlobRunIterator.h" |
25 #include "SkTextToPathIter.h" | 26 #include "SkTextToPathIter.h" |
26 | 27 |
27 SkBaseDevice::SkBaseDevice(const SkImageInfo& info, const SkSurfaceProps& surfac
eProps) | 28 SkBaseDevice::SkBaseDevice(const SkImageInfo& info, const SkSurfaceProps& surfac
eProps) |
28 : fInfo(info) | 29 : fInfo(info) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (!preserveLCDText) { | 68 if (!preserveLCDText) { |
68 geo = kUnknown_SkPixelGeometry; | 69 geo = kUnknown_SkPixelGeometry; |
69 } | 70 } |
70 break; | 71 break; |
71 } | 72 } |
72 return geo; | 73 return geo; |
73 } | 74 } |
74 | 75 |
75 void SkBaseDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar star
tAngle, | 76 void SkBaseDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar star
tAngle, |
76 SkScalar sweepAngle, bool useCenter, const SkPaint& p
aint) { | 77 SkScalar sweepAngle, bool useCenter, const SkPaint& p
aint) { |
77 SkASSERT(SkScalarAbs(sweepAngle) >= 0.f && SkScalarAbs(sweepAngle) < 360.f); | |
78 SkPath path; | 78 SkPath path; |
79 if (useCenter) { | 79 bool isFillNoPathEffect = SkPaint::kFill_Style == paint.getStyle() && !paint
.getPathEffect(); |
80 path.moveTo(oval.centerX(), oval.centerY()); | 80 SkPathPriv::CreateDrawArcPath(&path, oval, startAngle, sweepAngle, useCenter
, |
81 } | 81 isFillNoPathEffect); |
82 path.arcTo(oval, startAngle, sweepAngle, !useCenter); | |
83 if (useCenter) { | |
84 path.close(); | |
85 } | |
86 path.setIsVolatile(true); | |
87 this->drawPath(draw, path, paint); | 82 this->drawPath(draw, path, paint); |
88 } | 83 } |
89 | 84 |
90 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 85 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
91 const SkRRect& inner, const SkPaint& paint) { | 86 const SkRRect& inner, const SkPaint& paint) { |
92 SkPath path; | 87 SkPath path; |
93 path.addRRect(outer); | 88 path.addRRect(outer); |
94 path.addRRect(inner); | 89 path.addRRect(inner); |
95 path.setFillType(SkPath::kEvenOdd_FillType); | 90 path.setFillType(SkPath::kEvenOdd_FillType); |
96 path.setIsVolatile(true); | 91 path.setIsVolatile(true); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 545 |
551 // Also log filter quality independent scale factor. | 546 // Also log filter quality independent scale factor. |
552 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, | 547 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, |
553 kLast_ScaleFactor + 1); | 548 kLast_ScaleFactor + 1); |
554 | 549 |
555 // Also log an overall histogram of filter quality. | 550 // Also log an overall histogram of filter quality. |
556 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali
ty + 1); | 551 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali
ty + 1); |
557 #endif | 552 #endif |
558 } | 553 } |
559 | 554 |
OLD | NEW |