| 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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 pathIsMutable = true; | 912 pathIsMutable = true; |
| 913 stroke.setFillStyle(); | 913 stroke.setFillStyle(); |
| 914 } | 914 } |
| 915 } | 915 } |
| 916 | 916 |
| 917 // avoid possibly allocating a new path in transform if we can | 917 // avoid possibly allocating a new path in transform if we can |
| 918 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); | 918 SkPath* devPathPtr = pathIsMutable ? pathPtr : tmpPath.init(); |
| 919 | 919 |
| 920 // transform the path into device space | 920 // transform the path into device space |
| 921 pathPtr->transform(fContext->getMatrix(), devPathPtr); | 921 pathPtr->transform(fContext->getMatrix(), devPathPtr); |
| 922 | 922 |
| 923 SkRect maskRect; | 923 SkRect maskRect; |
| 924 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), | 924 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), |
| 925 draw.fClip->getBounds(), | 925 draw.fClip->getBounds(), |
| 926 fContext->getMatrix(), | 926 fContext->getMatrix(), |
| 927 &maskRect)) { | 927 &maskRect)) { |
| 928 // The context's matrix may change while creating the mask, so save
the CTM here to | 928 // The context's matrix may change while creating the mask, so save
the CTM here to |
| 929 // pass to filterMaskGPU. | 929 // pass to filterMaskGPU. |
| 930 const SkMatrix ctm = fContext->getMatrix(); | 930 const SkMatrix ctm = fContext->getMatrix(); |
| 931 | 931 |
| 932 SkIRect finalIRect; | 932 SkIRect finalIRect; |
| 933 maskRect.roundOut(&finalIRect); | 933 maskRect.roundOut(&finalIRect); |
| 934 if (draw.fClip->quickReject(finalIRect)) { | 934 if (draw.fClip->quickReject(finalIRect)) { |
| 935 // clipped out | 935 // clipped out |
| 936 return; | 936 return; |
| 937 } | 937 } |
| 938 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { | 938 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { |
| 939 // nothing to draw | 939 // nothing to draw |
| 940 return; | 940 return; |
| 941 } | 941 } |
| 942 | |
| 943 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, | |
| 944 SkStrokeRec(paint), *
devPathPtr)) { | |
| 945 // the mask filter was able to draw itself directly, so there's
nothing | |
| 946 // left to do. | |
| 947 return; | |
| 948 } | |
| 949 | 942 |
| 950 GrAutoScratchTexture mask; | 943 GrAutoScratchTexture mask; |
| 951 | 944 |
| 952 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, | 945 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, |
| 953 grPaint.isAntiAlias(), &mask)) { | 946 grPaint.isAntiAlias(), &mask)) { |
| 954 GrTexture* filtered; | 947 GrTexture* filtered; |
| 955 | 948 |
| 956 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), | 949 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), |
| 957 ctm, maskRect, &filtere
d, true)) { | 950 ctm, maskRect, &filtere
d, true)) { |
| 958 // filterMaskGPU gives us ownership of a ref to the result | 951 // filterMaskGPU gives us ownership of a ref to the result |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 GrTexture* texture, | 1962 GrTexture* texture, |
| 1970 bool needClear) | 1963 bool needClear) |
| 1971 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1964 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1972 | 1965 |
| 1973 SkASSERT(texture && texture->asRenderTarget()); | 1966 SkASSERT(texture && texture->asRenderTarget()); |
| 1974 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1967 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1975 // cache. We pass true for the third argument so that it will get unlocked. | 1968 // cache. We pass true for the third argument so that it will get unlocked. |
| 1976 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1969 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1977 fNeedClear = needClear; | 1970 fNeedClear = needClear; |
| 1978 } | 1971 } |
| OLD | NEW |