| 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 pathIsMutable = true; | 897 pathIsMutable = true; |
| 898 stroke.setFillStyle(); | 898 stroke.setFillStyle(); |
| 899 } | 899 } |
| 900 } | 900 } |
| 901 | 901 |
| 902 // avoid possibly allocating a new path in transform if we can | 902 // avoid possibly allocating a new path in transform if we can |
| 903 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; | 903 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; |
| 904 | 904 |
| 905 // transform the path into device space | 905 // transform the path into device space |
| 906 pathPtr->transform(fContext->getMatrix(), devPathPtr); | 906 pathPtr->transform(fContext->getMatrix(), devPathPtr); |
| 907 | 907 |
| 908 SkRect maskRect; | 908 SkRect maskRect; |
| 909 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), | 909 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), |
| 910 draw.fClip->getBounds(), | 910 draw.fClip->getBounds(), |
| 911 fContext->getMatrix(), | 911 fContext->getMatrix(), |
| 912 &maskRect)) { | 912 &maskRect)) { |
| 913 SkIRect finalIRect; | 913 SkIRect finalIRect; |
| 914 maskRect.roundOut(&finalIRect); | 914 maskRect.roundOut(&finalIRect); |
| 915 if (draw.fClip->quickReject(finalIRect)) { | 915 if (draw.fClip->quickReject(finalIRect)) { |
| 916 // clipped out | 916 // clipped out |
| 917 return; | 917 return; |
| 918 } | 918 } |
| 919 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { | 919 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { |
| 920 // nothing to draw | 920 // nothing to draw |
| 921 return; | 921 return; |
| 922 } | 922 } |
| 923 |
| 924 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, |
| 925 SkStrokeRec(paint), d
evPathPtr)) { |
| 926 // the mask filter was able to draw itself directly, so there's
nothing |
| 927 // left to do. |
| 928 return; |
| 929 } |
| 923 | 930 |
| 924 GrAutoScratchTexture mask; | 931 GrAutoScratchTexture mask; |
| 925 | 932 |
| 926 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, | 933 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, |
| 927 grPaint.isAntiAlias(), &mask)) { | 934 grPaint.isAntiAlias(), &mask)) { |
| 928 GrTexture* filtered; | 935 GrTexture* filtered; |
| 929 | 936 |
| 930 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), maskRec
t, &filtered, true)) { | 937 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), maskRec
t, &filtered, true)) { |
| 931 // filterMaskGPU gives us ownership of a ref to the result | 938 // filterMaskGPU gives us ownership of a ref to the result |
| 932 SkAutoTUnref<GrTexture> atu(filtered); | 939 SkAutoTUnref<GrTexture> atu(filtered); |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 GrTexture* texture, | 1907 GrTexture* texture, |
| 1901 bool needClear) | 1908 bool needClear) |
| 1902 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1909 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1903 | 1910 |
| 1904 SkASSERT(texture && texture->asRenderTarget()); | 1911 SkASSERT(texture && texture->asRenderTarget()); |
| 1905 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1912 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1906 // cache. We pass true for the third argument so that it will get unlocked. | 1913 // cache. We pass true for the third argument so that it will get unlocked. |
| 1907 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1914 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1908 fNeedClear = needClear; | 1915 fNeedClear = needClear; |
| 1909 } | 1916 } |
| OLD | NEW |