| 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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 pathIsMutable = true; | 926 pathIsMutable = true; |
| 927 stroke.setFillStyle(); | 927 stroke.setFillStyle(); |
| 928 } | 928 } |
| 929 } | 929 } |
| 930 | 930 |
| 931 // avoid possibly allocating a new path in transform if we can | 931 // avoid possibly allocating a new path in transform if we can |
| 932 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); | 932 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); |
| 933 | 933 |
| 934 // transform the path into device space | 934 // transform the path into device space |
| 935 pathPtr->transform(fContext->getMatrix(), devPathPtr); | 935 pathPtr->transform(fContext->getMatrix(), devPathPtr); |
| 936 | 936 |
| 937 SkRect maskRect; | 937 SkRect maskRect; |
| 938 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), | 938 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), |
| 939 draw.fClip->getBounds(), | 939 draw.fClip->getBounds(), |
| 940 fContext->getMatrix(), | 940 fContext->getMatrix(), |
| 941 &maskRect)) { | 941 &maskRect)) { |
| 942 // The context's matrix may change while creating the mask, so save
the CTM here to | 942 // The context's matrix may change while creating the mask, so save
the CTM here to |
| 943 // pass to filterMaskGPU. | 943 // pass to filterMaskGPU. |
| 944 const SkMatrix ctm = fContext->getMatrix(); | 944 const SkMatrix ctm = fContext->getMatrix(); |
| 945 | 945 |
| 946 SkIRect finalIRect; | 946 SkIRect finalIRect; |
| 947 maskRect.roundOut(&finalIRect); | 947 maskRect.roundOut(&finalIRect); |
| 948 if (draw.fClip->quickReject(finalIRect)) { | 948 if (draw.fClip->quickReject(finalIRect)) { |
| 949 // clipped out | 949 // clipped out |
| 950 return; | 950 return; |
| 951 } | 951 } |
| 952 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { | 952 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { |
| 953 // nothing to draw | 953 // nothing to draw |
| 954 return; | 954 return; |
| 955 } | 955 } |
| 956 |
| 957 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, |
| 958 SkStrokeRec(paint), *
devPathPtr)) { |
| 959 // the mask filter was able to draw itself directly, so there's
nothing |
| 960 // left to do. |
| 961 return; |
| 962 } |
| 956 | 963 |
| 957 GrAutoScratchTexture mask; | 964 GrAutoScratchTexture mask; |
| 958 | 965 |
| 959 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, | 966 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, |
| 960 grPaint.isAntiAlias(), &mask)) { | 967 grPaint.isAntiAlias(), &mask)) { |
| 961 GrTexture* filtered; | 968 GrTexture* filtered; |
| 962 | 969 |
| 963 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), | 970 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), |
| 964 ctm, maskRect, &filtere
d, true)) { | 971 ctm, maskRect, &filtere
d, true)) { |
| 965 // filterMaskGPU gives us ownership of a ref to the result | 972 // filterMaskGPU gives us ownership of a ref to the result |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 GrTexture* texture, | 1920 GrTexture* texture, |
| 1914 bool needClear) | 1921 bool needClear) |
| 1915 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1922 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1916 | 1923 |
| 1917 SkASSERT(texture && texture->asRenderTarget()); | 1924 SkASSERT(texture && texture->asRenderTarget()); |
| 1918 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1925 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1919 // cache. We pass true for the third argument so that it will get unlocked. | 1926 // cache. We pass true for the third argument so that it will get unlocked. |
| 1920 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1927 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1921 fNeedClear = needClear; | 1928 fNeedClear = needClear; |
| 1922 } | 1929 } |
| OLD | NEW |