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

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: cleanup patch + check for fill vs. stroke Created 7 years 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 pathIsMutable = true; 897 pathIsMutable = true;
898 stroke.setFillStyle(); 898 stroke.setFillStyle();
899 } 899 }
900 } 900 }
901 901
902 // avoid possibly allocating a new path in transform if we can 902 // avoid possibly allocating a new path in transform if we can
903 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath; 903 SkPath* devPathPtr = pathIsMutable ? pathPtr : &tmpPath;
904 904
905 // transform the path into device space 905 // transform the path into device space
906 pathPtr->transform(fContext->getMatrix(), devPathPtr); 906 pathPtr->transform(fContext->getMatrix(), devPathPtr);
907 907
908 SkRect maskRect; 908 SkRect maskRect;
909 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), 909 if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(),
910 draw.fClip->getBounds(), 910 draw.fClip->getBounds(),
911 fContext->getMatrix(), 911 fContext->getMatrix(),
912 &maskRect)) { 912 &maskRect)) {
913 SkIRect finalIRect; 913 SkIRect finalIRect;
914 maskRect.roundOut(&finalIRect); 914 maskRect.roundOut(&finalIRect);
915 if (draw.fClip->quickReject(finalIRect)) { 915 if (draw.fClip->quickReject(finalIRect)) {
916 // clipped out 916 // clipped out
917 return; 917 return;
918 } 918 }
919 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) { 919 if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) {
920 // nothing to draw 920 // nothing to draw
921 return; 921 return;
922 } 922 }
923
924 bool doFill = paint.getStyle() == SkPaint::kFill_Style;
925
926 if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, d oFill, devPathPtr)) {
927 // the mask filter was able to draw itself directly, so there's nothing
928 // left to do.
929 return;
930 }
923 931
924 GrAutoScratchTexture mask; 932 GrAutoScratchTexture mask;
925 933
926 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke, 934 if (create_mask_GPU(fContext, maskRect, *devPathPtr, stroke,
927 grPaint.isAntiAlias(), &mask)) { 935 grPaint.isAntiAlias(), &mask)) {
928 GrTexture* filtered; 936 GrTexture* filtered;
929 937
930 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), maskRec t, &filtered, true)) { 938 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), maskRec t, &filtered, true)) {
931 // filterMaskGPU gives us ownership of a ref to the result 939 // filterMaskGPU gives us ownership of a ref to the result
932 SkAutoTUnref<GrTexture> atu(filtered); 940 SkAutoTUnref<GrTexture> atu(filtered);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 GrTexture* texture, 1908 GrTexture* texture,
1901 bool needClear) 1909 bool needClear)
1902 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1910 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1903 1911
1904 SkASSERT(texture && texture->asRenderTarget()); 1912 SkASSERT(texture && texture->asRenderTarget());
1905 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1913 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1906 // cache. We pass true for the third argument so that it will get unlocked. 1914 // cache. We pass true for the third argument so that it will get unlocked.
1907 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1915 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1908 fNeedClear = needClear; 1916 fNeedClear = needClear;
1909 } 1917 }
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