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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 2214163003: Minor clean up related to blur mask filters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment Created 4 years, 4 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/SkBlurMaskFilter.cpp ('k') | src/gpu/SkGpuDevice_drawTexture.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 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 "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMat rix, &grPaint)) { 400 if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMat rix, &grPaint)) {
401 return; 401 return;
402 } 402 }
403 403
404 GrStyle style(paint); 404 GrStyle style(paint);
405 fDrawContext->drawRect(fClip, grPaint, *draw.fMatrix, rect, &style); 405 fDrawContext->drawRect(fClip, grPaint, *draw.fMatrix, rect, &style);
406 } 406 }
407 407
408 /////////////////////////////////////////////////////////////////////////////// 408 ///////////////////////////////////////////////////////////////////////////////
409 409
410 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, 410 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
411 const SkPaint& paint) { 411 const SkPaint& paint) {
412 ASSERT_SINGLE_OWNER 412 ASSERT_SINGLE_OWNER
413 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext); 413 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext);
414 CHECK_SHOULD_DRAW(draw); 414 CHECK_SHOULD_DRAW(draw);
415 415
416 GrPaint grPaint; 416 GrPaint grPaint;
417 if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMat rix, &grPaint)) { 417 if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMat rix, &grPaint)) {
418 return; 418 return;
419 } 419 }
420 420
421 GrStyle style(paint); 421 GrStyle style(paint);
422 if (paint.getMaskFilter()) { 422 if (paint.getMaskFilter()) {
423 // try to hit the fast path for drawing filtered round rects 423 // try to hit the fast path for drawing filtered round rects
424 424
425 SkRRect devRRect; 425 SkRRect devRRect;
426 if (rect.transform(*draw.fMatrix, &devRRect)) { 426 if (rrect.transform(*draw.fMatrix, &devRRect)) {
427 if (devRRect.allCornersCircular()) { 427 if (devRRect.allCornersCircular()) {
428 SkRect maskRect; 428 SkRect maskRect;
429 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect, 429 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect,
430 draw.fRC->getBounds( ), 430 draw.fRC->getBounds( ),
431 *draw.fMatrix, 431 *draw.fMatrix,
432 &maskRect)) { 432 &maskRect)) {
433 SkIRect finalIRect; 433 SkIRect finalIRect;
434 maskRect.roundOut(&finalIRect); 434 maskRect.roundOut(&finalIRect);
435 if (draw.fRC->quickReject(finalIRect)) { 435 if (draw.fRC->quickReject(finalIRect)) {
436 // clipped out 436 // clipped out
(...skipping 13 matching lines...) Expand all
450 } 450 }
451 } 451 }
452 } 452 }
453 453
454 if (paint.getMaskFilter() || style.pathEffect()) { 454 if (paint.getMaskFilter() || style.pathEffect()) {
455 // The only mask filter the native rrect drawing code could've handle wa s taken 455 // The only mask filter the native rrect drawing code could've handle wa s taken
456 // care of above. 456 // care of above.
457 // A path effect will presumably transform this rrect into something els e. 457 // A path effect will presumably transform this rrect into something els e.
458 SkPath path; 458 SkPath path;
459 path.setIsVolatile(true); 459 path.setIsVolatile(true);
460 path.addRRect(rect); 460 path.addRRect(rrect);
461 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(), 461 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
462 fClip, path, paint, 462 fClip, path, paint,
463 *draw.fMatrix, nullptr, 463 *draw.fMatrix, nullptr,
464 draw.fRC->getBounds(), true); 464 draw.fRC->getBounds(), true);
465 return; 465 return;
466 } 466 }
467 467
468 SkASSERT(!style.pathEffect()); 468 SkASSERT(!style.pathEffect());
469 469
470 fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rect, style); 470 fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rrect, style);
471 } 471 }
472 472
473 473
474 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 474 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
475 const SkRRect& inner, const SkPaint& paint) { 475 const SkRRect& inner, const SkPaint& paint) {
476 ASSERT_SINGLE_OWNER 476 ASSERT_SINGLE_OWNER
477 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDRRect", fContext); 477 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDRRect", fContext);
478 CHECK_SHOULD_DRAW(draw); 478 CHECK_SHOULD_DRAW(draw);
479 479
480 if (outer.isEmpty()) { 480 if (outer.isEmpty()) {
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 } 1753 }
1754 1754
1755 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { 1755 SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
1756 ASSERT_SINGLE_OWNER 1756 ASSERT_SINGLE_OWNER
1757 // We always return a transient cache, so it is freed after each 1757 // We always return a transient cache, so it is freed after each
1758 // filter traversal. 1758 // filter traversal.
1759 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); 1759 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize);
1760 } 1760 }
1761 1761
1762 #endif 1762 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/gpu/SkGpuDevice_drawTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698