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 "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 stroke,
devRRect)) { | 649 stroke,
devRRect)) { |
650 return; | 650 return; |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 } | 657 } |
658 | 658 |
659 bool usePath = !rect.isSimple(); | |
660 // another two reasons we might need to call drawPath... | |
661 if (paint.getMaskFilter() || paint.getPathEffect()) { | 659 if (paint.getMaskFilter() || paint.getPathEffect()) { |
662 usePath = true; | |
663 } | |
664 // until we can rotate rrects... | |
665 if (!usePath && !fContext->getMatrix().rectStaysRect()) { | |
666 usePath = true; | |
667 } | |
668 | |
669 if (usePath) { | |
670 SkPath path; | 660 SkPath path; |
671 path.addRRect(rect); | 661 path.addRRect(rect); |
672 this->drawPath(draw, path, paint, NULL, true); | 662 this->drawPath(draw, path, paint, NULL, true); |
673 return; | 663 return; |
674 } | 664 } |
675 | 665 |
676 fContext->drawRRect(grPaint, rect, stroke); | 666 fContext->drawRRect(grPaint, rect, stroke); |
677 } | 667 } |
678 | 668 |
| 669 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
| 670 const SkRRect& inner, const SkPaint& paint) { |
| 671 SkStrokeRec stroke(paint); |
| 672 if (stroke.isFillStyle()) { |
| 673 |
| 674 CHECK_FOR_ANNOTATION(paint); |
| 675 CHECK_SHOULD_DRAW(draw, false); |
| 676 |
| 677 GrPaint grPaint; |
| 678 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
| 679 return; |
| 680 } |
| 681 |
| 682 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { |
| 683 fContext->drawDRRect(grPaint, outer, inner); |
| 684 return; |
| 685 } |
| 686 } |
| 687 |
| 688 SkPath path; |
| 689 path.addRRect(outer); |
| 690 path.addRRect(inner); |
| 691 path.setFillType(SkPath::kEvenOdd_FillType); |
| 692 |
| 693 this->drawPath(draw, path, paint, NULL, true); |
| 694 } |
| 695 |
| 696 |
679 ///////////////////////////////////////////////////////////////////////////// | 697 ///////////////////////////////////////////////////////////////////////////// |
680 | 698 |
681 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, | 699 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, |
682 const SkPaint& paint) { | 700 const SkPaint& paint) { |
683 CHECK_FOR_ANNOTATION(paint); | 701 CHECK_FOR_ANNOTATION(paint); |
684 CHECK_SHOULD_DRAW(draw, false); | 702 CHECK_SHOULD_DRAW(draw, false); |
685 | 703 |
686 bool usePath = false; | 704 bool usePath = false; |
687 // some basic reasons we might need to call drawPath... | 705 // some basic reasons we might need to call drawPath... |
688 if (paint.getMaskFilter() || paint.getPathEffect()) { | 706 if (paint.getMaskFilter() || paint.getPathEffect()) { |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 const GrAtlasedLayer* layer = fContext->getLayerCache()->findLayerOr
Create(picture, i); | 1991 const GrAtlasedLayer* layer = fContext->getLayerCache()->findLayerOr
Create(picture, i); |
1974 | 1992 |
1975 SkDebugf("%d (%d), ", i, layer->layerID()); | 1993 SkDebugf("%d (%d), ", i, layer->layerID()); |
1976 } | 1994 } |
1977 } | 1995 } |
1978 SkDebugf("\n"); | 1996 SkDebugf("\n"); |
1979 #endif | 1997 #endif |
1980 | 1998 |
1981 return false; | 1999 return false; |
1982 } | 2000 } |
OLD | NEW |