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

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

Issue 2125663003: Add gm that tests shaded stroked rectangles. (Closed) Base URL: https://skia.googlesource.com/skia.git@fixgmwidth
Patch Set: fix windows double->scalar warning 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/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 0); 509 0);
510 } 510 }
511 511
512 /////////////////////////////////////////////////////////////////////////////// 512 ///////////////////////////////////////////////////////////////////////////////
513 513
514 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint & paint) { 514 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint & paint) {
515 ASSERT_SINGLE_OWNER 515 ASSERT_SINGLE_OWNER
516 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRect", fContext); 516 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRect", fContext);
517 CHECK_SHOULD_DRAW(draw); 517 CHECK_SHOULD_DRAW(draw);
518 518
519 bool doStroke = paint.getStyle() != SkPaint::kFill_Style;
520 SkScalar width = paint.getStrokeWidth();
521 519
522 /* 520 // A couple reasons we might need to call drawPath.
523 We have special code for hairline strokes, miter-strokes, bevel-stroke 521 if (paint.getMaskFilter() || paint.getPathEffect()) {
524 and fills. Anything else we just call our path code.
525 */
526 bool usePath = doStroke && width > 0 &&
527 (paint.getStrokeJoin() == SkPaint::kRound_Join ||
528 (paint.getStrokeJoin() == SkPaint::kBevel_Join && rect.isEmp ty()));
529
530 // a few other reasons we might need to call drawPath...
531 if (paint.getMaskFilter() || paint.getPathEffect() ||
532 paint.getStyle() == SkPaint::kStrokeAndFill_Style) { // we can't both st roke and fill rects
533 usePath = true;
534 }
535
536 if (usePath) {
537 SkPath path; 522 SkPath path;
538 path.setIsVolatile(true); 523 path.setIsVolatile(true);
539 path.addRect(rect); 524 path.addRect(rect);
540 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(), 525 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
541 fClip, path, paint, 526 fClip, path, paint,
542 *draw.fMatrix, nullptr, 527 *draw.fMatrix, nullptr,
543 draw.fRC->getBounds(), true); 528 draw.fRC->getBounds(), true);
544 return; 529 return;
545 } 530 }
546 531
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 } 1911 }
1927 1912
1928 SkImageFilterCache* SkGpuDevice::getImageFilterCache() { 1913 SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
1929 ASSERT_SINGLE_OWNER 1914 ASSERT_SINGLE_OWNER
1930 // We always return a transient cache, so it is freed after each 1915 // We always return a transient cache, so it is freed after each
1931 // filter traversal. 1916 // filter traversal.
1932 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize); 1917 return SkImageFilterCache::Create(kDefaultImageFilterCacheSize);
1933 } 1918 }
1934 1919
1935 #endif 1920 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698