Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 119343003: Fast blurred rectangles on GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more windows build fixes Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
942 949
943 GrAutoScratchTexture mask; 950 GrAutoScratchTexture mask;
944 951
945 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, 952 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke,
946 grPaint.isAntiAlias(), &mask)) { 953 grPaint.isAntiAlias(), &mask)) {
947 GrTexture* filtered; 954 GrTexture* filtered;
948 955
949 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), 956 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(),
950 ctm, maskRect, &filtere d, true)) { 957 ctm, maskRect, &filtere d, true)) {
951 // filterMaskGPU gives us ownership of a ref to the result 958 // filterMaskGPU gives us ownership of a ref to the result
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 GrTexture* texture, 1969 GrTexture* texture,
1963 bool needClear) 1970 bool needClear)
1964 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1971 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1965 1972
1966 SkASSERT(texture && texture->asRenderTarget()); 1973 SkASSERT(texture && texture->asRenderTarget());
1967 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1974 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1968 // cache. We pass true for the third argument so that it will get unlocked. 1975 // cache. We pass true for the third argument so that it will get unlocked.
1969 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1976 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1970 fNeedClear = needClear; 1977 fNeedClear = needClear;
1971 } 1978 }
OLDNEW
« src/effects/SkBlurMaskFilter.cpp ('K') | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698