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

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

Issue 2163323002: Add desired width & height to drawContext (as opposed to using the width & height of the RT) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More Clean up Created 4 years, 5 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/core/SkSpecialSurface.cpp ('k') | src/gpu/GrContext.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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 srcTexture = nullptr; // we don't use this from here on out 348 srcTexture = nullptr; // we don't use this from here on out
349 349
350 if (scaleFactorX > 1 || scaleFactorY > 1) { 350 if (scaleFactorX > 1 || scaleFactorY > 1) {
351 // Clear one pixel to the right and below, to accommodate bilinear upsam pling. 351 // Clear one pixel to the right and below, to accommodate bilinear upsam pling.
352 clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom, srcRect.wi dth() + 1, 1); 352 clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom, srcRect.wi dth() + 1, 1);
353 srcDrawContext->clear(&clearRect, 0x0, false); 353 srcDrawContext->clear(&clearRect, 0x0, false);
354 clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop, 1, srcRect.h eight()); 354 clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop, 1, srcRect.h eight());
355 srcDrawContext->clear(&clearRect, 0x0, false); 355 srcDrawContext->clear(&clearRect, 0x0, false);
356 356
357 SkMatrix matrix; 357 SkMatrix matrix;
358 matrix.setIDiv(srcDrawContext->width(), srcDrawContext->height()); 358 matrix.setIDiv(srcDrawContext->accessRenderTarget()->width(),
359 srcDrawContext->accessRenderTarget()->height());
359 360
360 GrPaint paint; 361 GrPaint paint;
361 paint.setGammaCorrect(gammaCorrect); 362 paint.setGammaCorrect(gammaCorrect);
362 // FIXME: this should be mitchell, not bilinear. 363 // FIXME: this should be mitchell, not bilinear.
363 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile rp_FilterMode); 364 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile rp_FilterMode);
364 sk_sp<GrTexture> tex(srcDrawContext->asTexture()); 365 sk_sp<GrTexture> tex(srcDrawContext->asTexture());
365 paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params); 366 paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params);
366 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 367 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
367 368
368 SkIRect dstRect(srcRect); 369 SkIRect dstRect(srcRect);
369 scale_irect(&dstRect, scaleFactorX, scaleFactorY); 370 scale_irect(&dstRect, scaleFactorX, scaleFactorY);
370 371
371 dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(), 372 dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(),
372 SkRect::Make(dstRect), SkRect::Make(srcRe ct)); 373 SkRect::Make(dstRect), SkRect::Make(srcRe ct));
373 374
374 srcDrawContext = dstDrawContext; 375 srcDrawContext = dstDrawContext;
375 srcRect = dstRect; 376 srcRect = dstRect;
376 dstDrawContext.swap(tmpDrawContext); 377 dstDrawContext.swap(tmpDrawContext);
377 } 378 }
378 379
379 return srcDrawContext; 380 return srcDrawContext;
380 } 381 }
381 382
382 } 383 }
383 384
384 #endif 385 #endif
385 386
OLDNEW
« no previous file with comments | « src/core/SkSpecialSurface.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698