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

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

Issue 2267273006: GPU implementation of drawRegion() (Closed) Base URL: https://skia.googlesource.com/skia.git@drawregion
Patch Set: SkToBool Created 4 years, 3 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/gpu/SkGpuDevice.h ('k') | src/gpu/batches/GrRegionBatch.h » ('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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(), 520 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
521 fClip, path, paint, 521 fClip, path, paint,
522 *draw.fMatrix, nullptr, 522 *draw.fMatrix, nullptr,
523 draw.fRC->getBounds(), true); 523 draw.fRC->getBounds(), true);
524 } 524 }
525 525
526 526
527 ///////////////////////////////////////////////////////////////////////////// 527 /////////////////////////////////////////////////////////////////////////////
528 528
529 void SkGpuDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const S kPaint& paint) {
530 if (paint.getMaskFilter()) {
531 SkPath path;
532 region.getBoundaryPath(&path);
533 return this->drawPath(draw, path, paint, nullptr, false);
534 }
535
536 GrPaint grPaint;
537 if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMat rix, &grPaint)) {
538 return;
539 }
540
541 fDrawContext->drawRegion(fClip, grPaint, *draw.fMatrix, region, GrStyle(pain t));
542 }
543
529 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint & paint) { 544 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint & paint) {
530 ASSERT_SINGLE_OWNER 545 ASSERT_SINGLE_OWNER
531 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext); 546 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext);
532 CHECK_SHOULD_DRAW(draw); 547 CHECK_SHOULD_DRAW(draw);
533 548
534 // Presumably the path effect warps this to something other than an oval 549 // Presumably the path effect warps this to something other than an oval
535 if (paint.getPathEffect()) { 550 if (paint.getPathEffect()) {
536 SkPath path; 551 SkPath path;
537 path.setIsVolatile(true); 552 path.setIsVolatile(true);
538 path.addOval(oval); 553 path.addOval(oval);
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 } 1822 }
1808 1823
1809 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { 1824 SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
1810 ASSERT_SINGLE_OWNER 1825 ASSERT_SINGLE_OWNER
1811 // We always return a transient cache, so it is freed after each 1826 // We always return a transient cache, so it is freed after each
1812 // filter traversal. 1827 // filter traversal.
1813 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); 1828 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize);
1814 } 1829 }
1815 1830
1816 #endif 1831 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/batches/GrRegionBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698