OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 | 2266 |
2267 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) | 2267 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) |
2268 | 2268 |
2269 while (iter.next()) { | 2269 while (iter.next()) { |
2270 iter.fDevice->drawOval(iter, oval, looper.paint()); | 2270 iter.fDevice->drawOval(iter, oval, looper.paint()); |
2271 } | 2271 } |
2272 | 2272 |
2273 LOOPER_END | 2273 LOOPER_END |
2274 } | 2274 } |
2275 | 2275 |
| 2276 void SkCanvas::onDrawArc(const SkRect& oval, SkScalar startAngle, |
| 2277 SkScalar sweepAngle, bool useCenter, |
| 2278 const SkPaint& paint) { |
| 2279 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawArc()"); |
| 2280 const SkRect* bounds = nullptr; |
| 2281 if (paint.canComputeFastBounds()) { |
| 2282 SkRect storage; |
| 2283 // Note we're using the entire oval as the bounds. |
| 2284 if (this->quickReject(paint.computeFastBounds(oval, &storage))) { |
| 2285 return; |
| 2286 } |
| 2287 bounds = &oval; |
| 2288 } |
| 2289 |
| 2290 LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, bounds) |
| 2291 |
| 2292 while (iter.next()) { |
| 2293 iter.fDevice->drawArc(iter, oval, startAngle, sweepAngle, useCenter, loo
per.paint()); |
| 2294 } |
| 2295 |
| 2296 LOOPER_END |
| 2297 } |
| 2298 |
2276 void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { | 2299 void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { |
2277 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()"); | 2300 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()"); |
2278 SkRect storage; | 2301 SkRect storage; |
2279 const SkRect* bounds = nullptr; | 2302 const SkRect* bounds = nullptr; |
2280 if (paint.canComputeFastBounds()) { | 2303 if (paint.canComputeFastBounds()) { |
2281 if (this->quickReject(paint.computeFastBounds(rrect.getBounds(), &storag
e))) { | 2304 if (this->quickReject(paint.computeFastBounds(rrect.getBounds(), &storag
e))) { |
2282 return; | 2305 return; |
2283 } | 2306 } |
2284 bounds = &rrect.getBounds(); | 2307 bounds = &rrect.getBounds(); |
2285 } | 2308 } |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3074 } | 3097 } |
3075 } | 3098 } |
3076 | 3099 |
3077 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, | 3100 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, |
3078 SkScalar sweepAngle, bool useCenter, | 3101 SkScalar sweepAngle, bool useCenter, |
3079 const SkPaint& paint) { | 3102 const SkPaint& paint) { |
3080 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawArc()"); | 3103 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawArc()"); |
3081 if (SkScalarAbs(sweepAngle) >= SkIntToScalar(360)) { | 3104 if (SkScalarAbs(sweepAngle) >= SkIntToScalar(360)) { |
3082 this->drawOval(oval, paint); | 3105 this->drawOval(oval, paint); |
3083 } else { | 3106 } else { |
3084 SkPath path; | 3107 this->onDrawArc(oval, startAngle, sweepAngle, useCenter, paint); |
3085 if (useCenter) { | |
3086 path.moveTo(oval.centerX(), oval.centerY()); | |
3087 } | |
3088 path.arcTo(oval, startAngle, sweepAngle, !useCenter); | |
3089 if (useCenter) { | |
3090 path.close(); | |
3091 } | |
3092 this->drawPath(path, paint); | |
3093 } | 3108 } |
3094 } | 3109 } |
3095 | 3110 |
3096 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, | 3111 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, |
3097 const SkPath& path, SkScalar hOffset, | 3112 const SkPath& path, SkScalar hOffset, |
3098 SkScalar vOffset, const SkPaint& paint) { | 3113 SkScalar vOffset, const SkPaint& paint) { |
3099 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextOnPathHV()"); | 3114 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextOnPathHV()"); |
3100 SkMatrix matrix; | 3115 SkMatrix matrix; |
3101 | 3116 |
3102 matrix.setTranslate(hOffset, vOffset); | 3117 matrix.setTranslate(hOffset, vOffset); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3387 | 3402 |
3388 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3403 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3389 fCanvas->restoreToCount(fSaveCount); | 3404 fCanvas->restoreToCount(fSaveCount); |
3390 } | 3405 } |
3391 | 3406 |
3392 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3407 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3393 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3408 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3394 return this->makeSurface(info, props).release(); | 3409 return this->makeSurface(info, props).release(); |
3395 } | 3410 } |
3396 #endif | 3411 #endif |
OLD | NEW |