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

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

Issue 1149773005: Add direct getter for GrCaps to GrContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init caps in the right place Created 5 years, 6 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/SkAlphaThresholdFilter.cpp ('k') | src/gpu/GrAddPathRenderers_default.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"
11 11
12 #if SK_SUPPORT_GPU 12 #if SK_SUPPORT_GPU
13 #include "effects/GrConvolutionEffect.h" 13 #include "effects/GrConvolutionEffect.h"
14 #include "effects/GrMatrixConvolutionEffect.h" 14 #include "effects/GrMatrixConvolutionEffect.h"
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrCaps.h"
16 #include "GrDrawContext.h" 17 #include "GrDrawContext.h"
17 #endif 18 #endif
18 19
19 namespace SkGpuBlurUtils { 20 namespace SkGpuBlurUtils {
20 21
21 #if SK_SUPPORT_GPU 22 #if SK_SUPPORT_GPU
22 23
23 #define MAX_BLUR_SIGMA 4.0f 24 #define MAX_BLUR_SIGMA 4.0f
24 25
25 static void scale_rect(SkRect* rect, float xScale, float yScale) { 26 static void scale_rect(SkRect* rect, float xScale, float yScale) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 bool canClobberSrc, 148 bool canClobberSrc,
148 const SkRect& rect, 149 const SkRect& rect,
149 bool cropToRect, 150 bool cropToRect,
150 float sigmaX, 151 float sigmaX,
151 float sigmaY) { 152 float sigmaY) {
152 SkASSERT(context); 153 SkASSERT(context);
153 154
154 SkIRect clearRect; 155 SkIRect clearRect;
155 int scaleFactorX, radiusX; 156 int scaleFactorX, radiusX;
156 int scaleFactorY, radiusY; 157 int scaleFactorY, radiusY;
157 int maxTextureSize = context->getMaxTextureSize(); 158 int maxTextureSize = context->caps()->maxTextureSize();
158 sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX); 159 sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX);
159 sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY); 160 sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY);
160 161
161 SkRect srcRect(rect); 162 SkRect srcRect(rect);
162 scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY); 163 scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY);
163 srcRect.roundOut(&srcRect); 164 srcRect.roundOut(&srcRect);
164 scale_rect(&srcRect, static_cast<float>(scaleFactorX), 165 scale_rect(&srcRect, static_cast<float>(scaleFactorX),
165 static_cast<float>(scaleFactorY)); 166 static_cast<float>(scaleFactorY));
166 167
167 // setup new clip 168 // setup new clip
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 SkMatrix::I(), dstRect, srcRect); 308 SkMatrix::I(), dstRect, srcRect);
308 srcRect = dstRect; 309 srcRect = dstRect;
309 srcTexture = dstTexture; 310 srcTexture = dstTexture;
310 SkTSwap(dstTexture, tempTexture); 311 SkTSwap(dstTexture, tempTexture);
311 } 312 }
312 return SkRef(srcTexture); 313 return SkRef(srcTexture);
313 } 314 }
314 #endif 315 #endif
315 316
316 } 317 }
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/gpu/GrAddPathRenderers_default.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698