OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkDevice.h" | 8 #include "SkDevice.h" |
9 #include "SkDeviceProperties.h" | 9 #include "SkDeviceProperties.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 #include "SkMetaData.h" | 12 #include "SkMetaData.h" |
13 #include "SkRasterClip.h" | 13 #include "SkRasterClip.h" |
14 #include "SkRect.h" | 14 #include "SkRect.h" |
| 15 #include "SkRRect.h" |
15 #include "SkShader.h" | 16 #include "SkShader.h" |
16 | 17 |
17 SK_DEFINE_INST_COUNT(SkDevice) | 18 SK_DEFINE_INST_COUNT(SkDevice) |
18 | 19 |
19 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
20 | 21 |
21 #define CHECK_FOR_NODRAW_ANNOTATION(paint) \ | 22 #define CHECK_FOR_NODRAW_ANNOTATION(paint) \ |
22 do { if (paint.isNoDrawAnnotation()) { return; } } while (0) | 23 do { if (paint.isNoDrawAnnotation()) { return; } } while (0) |
23 | 24 |
24 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& p
aint) { | 361 void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& p
aint) { |
361 CHECK_FOR_NODRAW_ANNOTATION(paint); | 362 CHECK_FOR_NODRAW_ANNOTATION(paint); |
362 | 363 |
363 SkPath path; | 364 SkPath path; |
364 path.addOval(oval); | 365 path.addOval(oval); |
365 // call the VIRTUAL version, so any subclasses who do handle drawPath aren't | 366 // call the VIRTUAL version, so any subclasses who do handle drawPath aren't |
366 // required to override drawOval. | 367 // required to override drawOval. |
367 this->drawPath(draw, path, paint, NULL, true); | 368 this->drawPath(draw, path, paint, NULL, true); |
368 } | 369 } |
369 | 370 |
| 371 void SkDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint
& paint) { |
| 372 CHECK_FOR_NODRAW_ANNOTATION(paint); |
| 373 |
| 374 SkPath path; |
| 375 path.addRRect(rrect); |
| 376 // call the VIRTUAL version, so any subclasses who do handle drawPath aren't |
| 377 // required to override drawRRect. |
| 378 this->drawPath(draw, path, paint, NULL, true); |
| 379 } |
| 380 |
370 void SkDevice::drawPath(const SkDraw& draw, const SkPath& path, | 381 void SkDevice::drawPath(const SkDraw& draw, const SkPath& path, |
371 const SkPaint& paint, const SkMatrix* prePathMatrix, | 382 const SkPaint& paint, const SkMatrix* prePathMatrix, |
372 bool pathIsMutable) { | 383 bool pathIsMutable) { |
373 CHECK_FOR_NODRAW_ANNOTATION(paint); | 384 CHECK_FOR_NODRAW_ANNOTATION(paint); |
374 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); | 385 draw.drawPath(path, paint, prePathMatrix, pathIsMutable); |
375 } | 386 } |
376 | 387 |
377 void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, | 388 void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, |
378 const SkIRect* srcRect, | 389 const SkIRect* srcRect, |
379 const SkMatrix& matrix, const SkPaint& paint) { | 390 const SkMatrix& matrix, const SkPaint& paint) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 paint.getStyle() != SkPaint::kFill_Style || | 548 paint.getStyle() != SkPaint::kFill_Style || |
538 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 549 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
539 // turn off lcd | 550 // turn off lcd |
540 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 551 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
541 flags->fHinting = paint.getHinting(); | 552 flags->fHinting = paint.getHinting(); |
542 return true; | 553 return true; |
543 } | 554 } |
544 // we're cool with the paint as is | 555 // we're cool with the paint as is |
545 return false; | 556 return false; |
546 } | 557 } |
OLD | NEW |