| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 537 } |
| 538 | 538 |
| 539 GrStrokeInfo strokeInfo(paint); | 539 GrStrokeInfo strokeInfo(paint); |
| 540 if (paint.getMaskFilter()) { | 540 if (paint.getMaskFilter()) { |
| 541 // try to hit the fast path for drawing filtered round rects | 541 // try to hit the fast path for drawing filtered round rects |
| 542 | 542 |
| 543 SkRRect devRRect; | 543 SkRRect devRRect; |
| 544 if (rect.transform(*draw.fMatrix, &devRRect)) { | 544 if (rect.transform(*draw.fMatrix, &devRRect)) { |
| 545 if (devRRect.allCornersCircular()) { | 545 if (devRRect.allCornersCircular()) { |
| 546 SkRect maskRect; | 546 SkRect maskRect; |
| 547 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), | 547 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect, |
| 548 draw.fClip->getBound
s(), | 548 draw.fClip->getBound
s(), |
| 549 *draw.fMatrix, | 549 *draw.fMatrix, |
| 550 &maskRect)) { | 550 &maskRect)) { |
| 551 SkIRect finalIRect; | 551 SkIRect finalIRect; |
| 552 maskRect.roundOut(&finalIRect); | 552 maskRect.roundOut(&finalIRect); |
| 553 if (draw.fClip->quickReject(finalIRect)) { | 553 if (draw.fClip->quickReject(finalIRect)) { |
| 554 // clipped out | 554 // clipped out |
| 555 return; | 555 return; |
| 556 } | 556 } |
| 557 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext
->textureProvider(), | 557 if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext
->textureProvider(), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 const SkPaint& paint) { | 630 const SkPaint& paint) { |
| 631 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); | 631 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); |
| 632 CHECK_FOR_ANNOTATION(paint); | 632 CHECK_FOR_ANNOTATION(paint); |
| 633 CHECK_SHOULD_DRAW(draw); | 633 CHECK_SHOULD_DRAW(draw); |
| 634 | 634 |
| 635 GrStrokeInfo strokeInfo(paint); | 635 GrStrokeInfo strokeInfo(paint); |
| 636 | 636 |
| 637 bool usePath = false; | 637 bool usePath = false; |
| 638 // some basic reasons we might need to call drawPath... | 638 // some basic reasons we might need to call drawPath... |
| 639 if (paint.getMaskFilter()) { | 639 if (paint.getMaskFilter()) { |
| 640 usePath = true; | 640 // The RRect path can handle special case blurring |
| 641 SkRRect rr = SkRRect::MakeOval(oval); |
| 642 return this->drawRRect(draw, rr, paint); |
| 641 } else { | 643 } else { |
| 642 const SkPathEffect* pe = paint.getPathEffect(); | 644 const SkPathEffect* pe = paint.getPathEffect(); |
| 643 if (pe && !strokeInfo.isDashed()) { | 645 if (pe && !strokeInfo.isDashed()) { |
| 644 usePath = true; | 646 usePath = true; |
| 645 } | 647 } |
| 646 } | 648 } |
| 647 | 649 |
| 648 if (usePath) { | 650 if (usePath) { |
| 649 SkPath path; | 651 SkPath path; |
| 650 path.setIsVolatile(true); | 652 path.setIsVolatile(true); |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 #endif | 1974 #endif |
| 1973 } | 1975 } |
| 1974 | 1976 |
| 1975 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1977 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1976 // We always return a transient cache, so it is freed after each | 1978 // We always return a transient cache, so it is freed after each |
| 1977 // filter traversal. | 1979 // filter traversal. |
| 1978 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1980 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1979 } | 1981 } |
| 1980 | 1982 |
| 1981 #endif | 1983 #endif |
| OLD | NEW |