| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; | 915 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; |
| 916 | 916 |
| 917 // transform the path into device space | 917 // transform the path into device space |
| 918 pathPtr->transform(fContext->getMatrix(), devPathPtr); | 918 pathPtr->transform(fContext->getMatrix(), devPathPtr); |
| 919 | 919 |
| 920 SkRect maskRect; | 920 SkRect maskRect; |
| 921 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), | 921 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), |
| 922 draw.fClip->getBounds(), | 922 draw.fClip->getBounds(), |
| 923 fContext->getMatrix(), | 923 fContext->getMatrix(), |
| 924 &maskRect)) { | 924 &maskRect)) { |
| 925 // The context's matrix may change while creating the mask, so save
the CTM here to |
| 926 // pass to filterMaskGPU. |
| 927 const SkMatrix ctm = fContext->getMatrix(); |
| 928 |
| 925 SkIRect finalIRect; | 929 SkIRect finalIRect; |
| 926 maskRect.roundOut(&finalIRect); | 930 maskRect.roundOut(&finalIRect); |
| 927 if (draw.fClip->quickReject(finalIRect)) { | 931 if (draw.fClip->quickReject(finalIRect)) { |
| 928 // clipped out | 932 // clipped out |
| 929 return; | 933 return; |
| 930 } | 934 } |
| 931 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { | 935 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { |
| 932 // nothing to draw | 936 // nothing to draw |
| 933 return; | 937 return; |
| 934 } | 938 } |
| 935 | 939 |
| 936 GrAutoScratchTexture mask; | 940 GrAutoScratchTexture mask; |
| 937 | 941 |
| 938 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, | 942 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, |
| 939 grPaint.isAntiAlias(), &mask)) { | 943 grPaint.isAntiAlias(), &mask)) { |
| 940 GrTexture* filtered; | 944 GrTexture* filtered; |
| 941 | 945 |
| 942 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), | 946 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), |
| 943 fContext->getMatrix(),
maskRect, | 947 ctm, maskRect, &filtere
d, true)) { |
| 944 &filtered, true)) { | |
| 945 // filterMaskGPU gives us ownership of a ref to the result | 948 // filterMaskGPU gives us ownership of a ref to the result |
| 946 SkAutoTUnref<GrTexture> atu(filtered); | 949 SkAutoTUnref<GrTexture> atu(filtered); |
| 947 | 950 |
| 948 // If the scratch texture that we used as the filter src als
o holds the filter | 951 // If the scratch texture that we used as the filter src als
o holds the filter |
| 949 // result then we must detach so that this texture isn't rec
ycled for a later | 952 // result then we must detach so that this texture isn't rec
ycled for a later |
| 950 // draw. | 953 // draw. |
| 951 if (filtered == mask.texture()) { | 954 if (filtered == mask.texture()) { |
| 952 mask.detach(); | 955 mask.detach(); |
| 953 filtered->unref(); // detach transfers GrAutoScratchText
ure's ref to us. | 956 filtered->unref(); // detach transfers GrAutoScratchText
ure's ref to us. |
| 954 } | 957 } |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 GrTexture* texture, | 1959 GrTexture* texture, |
| 1957 bool needClear) | 1960 bool needClear) |
| 1958 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1961 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1959 | 1962 |
| 1960 SkASSERT(texture && texture->asRenderTarget()); | 1963 SkASSERT(texture && texture->asRenderTarget()); |
| 1961 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1964 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1962 // cache. We pass true for the third argument so that it will get unlocked. | 1965 // cache. We pass true for the third argument so that it will get unlocked. |
| 1963 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1966 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1964 fNeedClear = needClear; | 1967 fNeedClear = needClear; |
| 1965 } | 1968 } |
| OLD | NEW |