Chromium Code Reviews| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 // its parameter type is const). | 699 // its parameter type is const). |
| 700 SkPath* pathPtr = const_cast<SkPath*>(&origSrcPath); | 700 SkPath* pathPtr = const_cast<SkPath*>(&origSrcPath); |
| 701 SkTLazy<SkPath> tmpPath; | 701 SkTLazy<SkPath> tmpPath; |
| 702 SkTLazy<SkPath> effectPath; | 702 SkTLazy<SkPath> effectPath; |
| 703 | 703 |
| 704 if (prePathMatrix) { | 704 if (prePathMatrix) { |
| 705 SkPath* result = pathPtr; | 705 SkPath* result = pathPtr; |
| 706 | 706 |
| 707 if (!pathIsMutable) { | 707 if (!pathIsMutable) { |
| 708 result = tmpPath.init(); | 708 result = tmpPath.init(); |
| 709 result->setIsVolatile(true); | |
| 709 pathIsMutable = true; | 710 pathIsMutable = true; |
| 710 } | 711 } |
| 711 // should I push prePathMatrix on our MV stack temporarily, instead | 712 // should I push prePathMatrix on our MV stack temporarily, instead |
| 712 // of applying it here? See SkDraw.cpp | 713 // of applying it here? See SkDraw.cpp |
|
bsalomon
2014/10/23 17:54:09
Seems like we should do this instead of making a n
jvanverth1
2014/10/23 20:06:18
Filed as Issue 3055.
| |
| 713 pathPtr->transform(*prePathMatrix, result); | 714 pathPtr->transform(*prePathMatrix, result); |
| 714 pathPtr = result; | 715 pathPtr = result; |
| 715 } | 716 } |
| 716 // at this point we're done with prePathMatrix | 717 // at this point we're done with prePathMatrix |
| 717 SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) | 718 SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;) |
| 718 | 719 |
| 719 GrStrokeInfo strokeInfo(paint); | 720 GrStrokeInfo strokeInfo(paint); |
| 720 SkPathEffect* pathEffect = paint.getPathEffect(); | 721 SkPathEffect* pathEffect = paint.getPathEffect(); |
| 721 const SkRect* cullRect = NULL; // TODO: what is our bounds? | 722 const SkRect* cullRect = NULL; // TODO: what is our bounds? |
| 722 SkStrokeRec* strokePtr = strokeInfo.getStrokeRecPtr(); | 723 SkStrokeRec* strokePtr = strokeInfo.getStrokeRecPtr(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 733 SkPath* strokedPath = pathIsMutable ? pathPtr : tmpPath.init(); | 734 SkPath* strokedPath = pathIsMutable ? pathPtr : tmpPath.init(); |
| 734 if (stroke.applyToPath(strokedPath, *pathPtr)) { | 735 if (stroke.applyToPath(strokedPath, *pathPtr)) { |
| 735 pathPtr = strokedPath; | 736 pathPtr = strokedPath; |
| 736 pathIsMutable = true; | 737 pathIsMutable = true; |
| 737 strokeInfo.setFillStyle(); | 738 strokeInfo.setFillStyle(); |
| 738 } | 739 } |
| 739 } | 740 } |
| 740 | 741 |
| 741 // avoid possibly allocating a new path in transform if we can | 742 // avoid possibly allocating a new path in transform if we can |
| 742 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); | 743 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); |
| 744 if (pathIsMutable) { | |
|
bsalomon
2014/10/23 17:54:09
Maybe we should avoid this early transformation to
jvanverth1
2014/10/23 20:06:18
Filed as Issue 3056
| |
| 745 devPathPtr->setIsVolatile(true); | |
| 746 } | |
| 743 | 747 |
| 744 // transform the path into device space | 748 // transform the path into device space |
| 745 pathPtr->transform(fContext->getMatrix(), devPathPtr); | 749 pathPtr->transform(fContext->getMatrix(), devPathPtr); |
| 746 | 750 |
| 747 SkRect maskRect; | 751 SkRect maskRect; |
| 748 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), | 752 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), |
| 749 draw.fClip->getBounds(), | 753 draw.fClip->getBounds(), |
| 750 fContext->getMatrix(), | 754 fContext->getMatrix(), |
| 751 &maskRect)) { | 755 &maskRect)) { |
| 752 // The context's matrix may change while creating the mask, so save the CTM here to | 756 // The context's matrix may change while creating the mask, so save the CTM here to |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1824 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled); | 1828 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled); |
| 1825 | 1829 |
| 1826 return true; | 1830 return true; |
| 1827 } | 1831 } |
| 1828 | 1832 |
| 1829 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1833 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1830 // We always return a transient cache, so it is freed after each | 1834 // We always return a transient cache, so it is freed after each |
| 1831 // filter traversal. | 1835 // filter traversal. |
| 1832 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1836 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1833 } | 1837 } |
| OLD | NEW |