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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(), | 520 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(), |
521 fClip, path, paint, | 521 fClip, path, paint, |
522 *draw.fMatrix, nullptr, | 522 *draw.fMatrix, nullptr, |
523 draw.fRC->getBounds(), true); | 523 draw.fRC->getBounds(), true); |
524 } | 524 } |
525 | 525 |
526 | 526 |
527 ///////////////////////////////////////////////////////////////////////////// | 527 ///////////////////////////////////////////////////////////////////////////// |
528 | 528 |
| 529 void SkGpuDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const S
kPaint& paint) { |
| 530 if (paint.getMaskFilter()) { |
| 531 SkPath path; |
| 532 region.getBoundaryPath(&path); |
| 533 return this->drawPath(draw, path, paint, nullptr, false); |
| 534 } |
| 535 |
| 536 GrPaint grPaint; |
| 537 if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMat
rix, &grPaint)) { |
| 538 return; |
| 539 } |
| 540 |
| 541 fDrawContext->drawRegion(fClip, grPaint, *draw.fMatrix, region, GrStyle(pain
t)); |
| 542 } |
| 543 |
529 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
& paint) { | 544 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
& paint) { |
530 ASSERT_SINGLE_OWNER | 545 ASSERT_SINGLE_OWNER |
531 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext); | 546 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext); |
532 CHECK_SHOULD_DRAW(draw); | 547 CHECK_SHOULD_DRAW(draw); |
533 | 548 |
534 // Presumably the path effect warps this to something other than an oval | 549 // Presumably the path effect warps this to something other than an oval |
535 if (paint.getPathEffect()) { | 550 if (paint.getPathEffect()) { |
536 SkPath path; | 551 SkPath path; |
537 path.setIsVolatile(true); | 552 path.setIsVolatile(true); |
538 path.addOval(oval); | 553 path.addOval(oval); |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 } | 1822 } |
1808 | 1823 |
1809 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { | 1824 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { |
1810 ASSERT_SINGLE_OWNER | 1825 ASSERT_SINGLE_OWNER |
1811 // We always return a transient cache, so it is freed after each | 1826 // We always return a transient cache, so it is freed after each |
1812 // filter traversal. | 1827 // filter traversal. |
1813 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); | 1828 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); |
1814 } | 1829 } |
1815 | 1830 |
1816 #endif | 1831 #endif |
OLD | NEW |