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

Side by Side Diff: src/effects/SkGpuBlurUtils.cpp

Issue 1421493003: tunnel down texture-size-constraint to imagefilters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix formating Created 5 years, 2 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/SkGpuBlurUtils.h ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkGpuBlurUtils.h" 8 #include "SkGpuBlurUtils.h"
9 9
10 #include "SkRect.h" 10 #include "SkRect.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 direction, radius, sigma, false, bounds); 139 direction, radius, sigma, false, bounds);
140 } 140 }
141 } 141 }
142 142
143 GrTexture* GaussianBlur(GrContext* context, 143 GrTexture* GaussianBlur(GrContext* context,
144 GrTexture* srcTexture, 144 GrTexture* srcTexture,
145 bool canClobberSrc, 145 bool canClobberSrc,
146 const SkRect& rect, 146 const SkRect& rect,
147 bool cropToRect, 147 bool cropToRect,
148 float sigmaX, 148 float sigmaX,
149 float sigmaY) { 149 float sigmaY,
150 GrTextureProvider::SizeConstraint constraint) {
150 SkASSERT(context); 151 SkASSERT(context);
151 152
152 SkIRect clearRect; 153 SkIRect clearRect;
153 int scaleFactorX, radiusX; 154 int scaleFactorX, radiusX;
154 int scaleFactorY, radiusY; 155 int scaleFactorY, radiusY;
155 int maxTextureSize = context->caps()->maxTextureSize(); 156 int maxTextureSize = context->caps()->maxTextureSize();
156 sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX); 157 sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX);
157 sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY); 158 sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY);
158 159
159 SkRect srcRect(rect); 160 SkRect srcRect(rect);
(...skipping 12 matching lines...) Expand all
172 GrSurfaceDesc desc; 173 GrSurfaceDesc desc;
173 desc.fFlags = kRenderTarget_GrSurfaceFlag; 174 desc.fFlags = kRenderTarget_GrSurfaceFlag;
174 desc.fWidth = SkScalarFloorToInt(srcRect.width()); 175 desc.fWidth = SkScalarFloorToInt(srcRect.width());
175 desc.fHeight = SkScalarFloorToInt(srcRect.height()); 176 desc.fHeight = SkScalarFloorToInt(srcRect.height());
176 desc.fConfig = srcTexture->config(); 177 desc.fConfig = srcTexture->config();
177 178
178 GrTexture* dstTexture; 179 GrTexture* dstTexture;
179 GrTexture* tempTexture; 180 GrTexture* tempTexture;
180 SkAutoTUnref<GrTexture> temp1, temp2; 181 SkAutoTUnref<GrTexture> temp1, temp2;
181 182
182 temp1.reset(context->textureProvider()->createApproxTexture(desc)); 183 temp1.reset(context->textureProvider()->createTexture(desc, constraint));
183 dstTexture = temp1.get(); 184 dstTexture = temp1.get();
184 if (canClobberSrc) { 185 if (canClobberSrc) {
185 tempTexture = srcTexture; 186 tempTexture = srcTexture;
186 } else { 187 } else {
187 temp2.reset(context->textureProvider()->createApproxTexture(desc)); 188 temp2.reset(context->textureProvider()->createTexture(desc, constraint)) ;
188 tempTexture = temp2.get(); 189 tempTexture = temp2.get();
189 } 190 }
190 191
191 if (nullptr == dstTexture || nullptr == tempTexture) { 192 if (nullptr == dstTexture || nullptr == tempTexture) {
192 return nullptr; 193 return nullptr;
193 } 194 }
194 195
195 SkAutoTUnref<GrDrawContext> srcDrawContext; 196 SkAutoTUnref<GrDrawContext> srcDrawContext;
196 197
197 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { 198 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 srcRect = dstRect; 358 srcRect = dstRect;
358 srcTexture = dstTexture; 359 srcTexture = dstTexture;
359 SkTSwap(dstTexture, tempTexture); 360 SkTSwap(dstTexture, tempTexture);
360 } 361 }
361 362
362 return SkRef(srcTexture); 363 return SkRef(srcTexture);
363 } 364 }
364 #endif 365 #endif
365 366
366 } 367 }
OLDNEW
« no previous file with comments | « src/effects/SkGpuBlurUtils.h ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698