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

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: Second rework of 119343003 for 10.6 and excluding GMs pending rebaseline 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
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 GrTexture* texture, 1988 GrTexture* texture,
1982 bool needClear) 1989 bool needClear)
1983 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1990 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1984 1991
1985 SkASSERT(texture && texture->asRenderTarget()); 1992 SkASSERT(texture && texture->asRenderTarget());
1986 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1993 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1987 // cache. We pass true for the third argument so that it will get unlocked. 1994 // cache. We pass true for the third argument so that it will get unlocked.
1988 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1995 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1989 fNeedClear = needClear; 1996 fNeedClear = needClear;
1990 } 1997 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698