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

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

Issue 1413673002: Remove DrawingMgr shims from GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix names in comments 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 | « include/gpu/GrDrawContext.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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 // Clear out a radius to the right of the srcRect to prevent the 269 // Clear out a radius to the right of the srcRect to prevent the
270 // X convolution from reading garbage. 270 // X convolution from reading garbage.
271 clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, 271 clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop,
272 radiusX, srcIRect.height()); 272 radiusX, srcIRect.height());
273 srcDrawContext->clear(&clearRect, 0x0, false); 273 srcDrawContext->clear(&clearRect, 0x0, false);
274 } 274 }
275 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); 275 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
276 276
277 SkAutoTUnref<GrDrawContext> dstDrawContext( 277 SkAutoTUnref<GrDrawContext> dstDrawContext(
278 context->drawContext(dstTexture->asR enderTarget())); 278 context->drawContext(dstTexture->as RenderTarget()));
279 if (!dstDrawContext) { 279 if (!dstDrawContext) {
280 return nullptr; 280 return nullptr;
281 } 281 }
282 convolve_gaussian(dstDrawContext, clip, srcRect, dstRect, 282 convolve_gaussian(dstDrawContext, clip, srcRect, dstRect,
283 srcTexture, Gr1DKernelEffect::kX_Direction, radius X, sigmaX, 283 srcTexture, Gr1DKernelEffect::kX_Direction, radius X, sigmaX,
284 cropToRect); 284 cropToRect);
285 285
286 srcDrawContext.swap(dstDrawContext); 286 srcDrawContext.swap(dstDrawContext);
287 srcTexture = dstTexture; 287 srcTexture = dstTexture;
288 srcRect = dstRect; 288 srcRect = dstRect;
(...skipping 13 matching lines...) Expand all
302 // Clear out a radius below the srcRect to prevent the Y 302 // Clear out a radius below the srcRect to prevent the Y
303 // convolution from reading garbage. 303 // convolution from reading garbage.
304 clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom, 304 clearRect = SkIRect::MakeXYWH(srcIRect.fLeft, srcIRect.fBottom,
305 srcIRect.width(), radiusY); 305 srcIRect.width(), radiusY);
306 srcDrawContext->clear(&clearRect, 0x0, false); 306 srcDrawContext->clear(&clearRect, 0x0, false);
307 } 307 }
308 308
309 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); 309 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
310 310
311 SkAutoTUnref<GrDrawContext> dstDrawContext( 311 SkAutoTUnref<GrDrawContext> dstDrawContext(
312 context->drawContext(dstTexture->as RenderTarget())); 312 context->drawContext(dstTexture-> asRenderTarget()));
313 if (!dstDrawContext) { 313 if (!dstDrawContext) {
314 return nullptr; 314 return nullptr;
315 } 315 }
316 convolve_gaussian(dstDrawContext, clip, srcRect, 316 convolve_gaussian(dstDrawContext, clip, srcRect,
317 dstRect, srcTexture, Gr1DKernelEffect::kY_Directio n, radiusY, sigmaY, 317 dstRect, srcTexture, Gr1DKernelEffect::kY_Directio n, radiusY, sigmaY,
318 cropToRect); 318 cropToRect);
319 319
320 srcDrawContext.swap(dstDrawContext); 320 srcDrawContext.swap(dstDrawContext);
321 srcTexture = dstTexture; 321 srcTexture = dstTexture;
322 srcRect = dstRect; 322 srcRect = dstRect;
(...skipping 17 matching lines...) Expand all
340 340
341 GrPaint paint; 341 GrPaint paint;
342 // FIXME: this should be mitchell, not bilinear. 342 // FIXME: this should be mitchell, not bilinear.
343 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile rp_FilterMode); 343 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile rp_FilterMode);
344 paint.addColorTextureProcessor(srcTexture, matrix, params); 344 paint.addColorTextureProcessor(srcTexture, matrix, params);
345 345
346 SkRect dstRect(srcRect); 346 SkRect dstRect(srcRect);
347 scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); 347 scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY);
348 348
349 SkAutoTUnref<GrDrawContext> dstDrawContext( 349 SkAutoTUnref<GrDrawContext> dstDrawContext(
350 context->drawContext(dstTexture->asR enderTarget())); 350 context->drawContext(dstTexture->asRenderTarget( )));
351 if (!dstDrawContext) { 351 if (!dstDrawContext) {
352 return nullptr; 352 return nullptr;
353 } 353 }
354 dstDrawContext->drawNonAARectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); 354 dstDrawContext->drawNonAARectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
355 355
356 srcDrawContext.swap(dstDrawContext); 356 srcDrawContext.swap(dstDrawContext);
357 srcRect = dstRect; 357 srcRect = dstRect;
358 srcTexture = dstTexture; 358 srcTexture = dstTexture;
359 SkTSwap(dstTexture, tempTexture); 359 SkTSwap(dstTexture, tempTexture);
360 } 360 }
361 361
362 return SkRef(srcTexture); 362 return SkRef(srcTexture);
363 } 363 }
364 #endif 364 #endif
365 365
366 } 366 }
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698