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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 nullptr, | 449 nullptr, |
450 nullptr, | 450 nullptr, |
451 nullptr, | 451 nullptr, |
452 0); | 452 0); |
453 } | 453 } |
454 | 454 |
455 /////////////////////////////////////////////////////////////////////////////// | 455 /////////////////////////////////////////////////////////////////////////////// |
456 | 456 |
457 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
& paint) { | 457 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
& paint) { |
458 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext); | 458 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext); |
459 | |
460 CHECK_FOR_ANNOTATION(paint); | 459 CHECK_FOR_ANNOTATION(paint); |
461 CHECK_SHOULD_DRAW(draw); | 460 CHECK_SHOULD_DRAW(draw); |
462 | 461 |
463 bool doStroke = paint.getStyle() != SkPaint::kFill_Style; | 462 bool doStroke = paint.getStyle() != SkPaint::kFill_Style; |
464 SkScalar width = paint.getStrokeWidth(); | 463 SkScalar width = paint.getStrokeWidth(); |
465 | 464 |
466 /* | 465 /* |
467 We have special code for hairline strokes, miter-strokes, bevel-stroke | 466 We have special code for hairline strokes, miter-strokes, bevel-stroke |
468 and fills. Anything else we just call our path code. | 467 and fills. Anything else we just call our path code. |
469 */ | 468 */ |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 return; | 561 return; |
563 } | 562 } |
564 | 563 |
565 SkASSERT(!strokeInfo.isDashed()); | 564 SkASSERT(!strokeInfo.isDashed()); |
566 | 565 |
567 fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rect, strokeInfo); | 566 fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rect, strokeInfo); |
568 } | 567 } |
569 | 568 |
570 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 569 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
571 const SkRRect& inner, const SkPaint& paint) { | 570 const SkRRect& inner, const SkPaint& paint) { |
| 571 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawDRRect", fContext); |
| 572 CHECK_FOR_ANNOTATION(paint); |
| 573 CHECK_SHOULD_DRAW(draw); |
| 574 |
572 SkStrokeRec stroke(paint); | 575 SkStrokeRec stroke(paint); |
573 if (stroke.isFillStyle()) { | |
574 | 576 |
575 CHECK_FOR_ANNOTATION(paint); | 577 if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect()
) { |
576 CHECK_SHOULD_DRAW(draw); | |
577 | |
578 GrPaint grPaint; | 578 GrPaint grPaint; |
579 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint))
{ | 579 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, &grPaint))
{ |
580 return; | 580 return; |
581 } | 581 } |
582 | 582 |
583 if (nullptr == paint.getMaskFilter() && nullptr == paint.getPathEffect()
) { | 583 fDrawContext->drawDRRect(fClip, grPaint, *draw.fMatrix, outer, inner); |
584 fDrawContext->drawDRRect(fClip, grPaint, *draw.fMatrix, outer, inner
); | 584 return; |
585 return; | |
586 } | |
587 } | 585 } |
588 | 586 |
589 SkPath path; | 587 SkPath path; |
590 path.setIsVolatile(true); | 588 path.setIsVolatile(true); |
591 path.addRRect(outer); | 589 path.addRRect(outer); |
592 path.addRRect(inner); | 590 path.addRRect(inner); |
593 path.setFillType(SkPath::kEvenOdd_FillType); | 591 path.setFillType(SkPath::kEvenOdd_FillType); |
594 | 592 |
595 this->drawPath(draw, path, paint, nullptr, true); | 593 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, fRenderTarget, |
| 594 fClip, path, paint, |
| 595 *draw.fMatrix, nullptr, |
| 596 draw.fClip->getBounds(), true); |
596 } | 597 } |
597 | 598 |
598 | 599 |
599 ///////////////////////////////////////////////////////////////////////////// | 600 ///////////////////////////////////////////////////////////////////////////// |
600 | 601 |
601 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
& paint) { | 602 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
& paint) { |
602 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); | 603 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); |
603 CHECK_FOR_ANNOTATION(paint); | 604 CHECK_FOR_ANNOTATION(paint); |
604 CHECK_SHOULD_DRAW(draw); | 605 CHECK_SHOULD_DRAW(draw); |
605 | 606 |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1868 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1868 } | 1869 } |
1869 | 1870 |
1870 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1871 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1871 // We always return a transient cache, so it is freed after each | 1872 // We always return a transient cache, so it is freed after each |
1872 // filter traversal. | 1873 // filter traversal. |
1873 return SkGpuDevice::NewImageFilterCache(); | 1874 return SkGpuDevice::NewImageFilterCache(); |
1874 } | 1875 } |
1875 | 1876 |
1876 #endif | 1877 #endif |
OLD | NEW |