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

Side by Side Diff: src/core/SkDraw.cpp

Issue 2155213002: check for culled-out paths inside SkDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add slop (see skbug.com/5542) 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 | « no previous file | no next file » | 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #define __STDC_LIMIT_MACROS 7 #define __STDC_LIMIT_MACROS
8 8
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 if (scale > 0) { 1010 if (scale > 0) {
1011 return scale; 1011 return scale;
1012 } 1012 }
1013 } 1013 }
1014 } 1014 }
1015 return 1; 1015 return 1;
1016 } 1016 }
1017 1017
1018 void SkDraw::drawDevPath(const SkPath& devPath, const SkPaint& paint, bool drawC overage, 1018 void SkDraw::drawDevPath(const SkPath& devPath, const SkPaint& paint, bool drawC overage,
1019 SkBlitter* customBlitter, bool doFill) const { 1019 SkBlitter* customBlitter, bool doFill) const {
1020 // Do a conservative quick-reject test, since a looper or other modifier may have moved us
1021 // out of range.
1022 if (!devPath.isInverseFillType()) {
1023 // If we're a H or V line, our bounds will be empty. So we bloat here ju st so we don't
1024 // appear empty to the intersects call. This also gives us slop in case we're antialiasing
1025 SkRect pathBounds = devPath.getBounds().makeOutset(1, 1);
1026
1027 if (paint.getMaskFilter()) {
1028 paint.getMaskFilter()->computeFastBounds(pathBounds, &pathBounds);
1029
1030 // Need to outset the path to work-around a bug in blurmaskfilter. W hen that is fixed
1031 // we can remove this hack. See skbug.com/5542
1032 pathBounds.outset(7, 7);
1033 }
1034
1035 // Now compare against the clip's bounds
1036 if (!SkRect::Make(fRC->getBounds()).intersects(pathBounds)) {
1037 return;
1038 }
1039 }
1040
1020 SkBlitter* blitter = nullptr; 1041 SkBlitter* blitter = nullptr;
1021 SkAutoBlitterChoose blitterStorage; 1042 SkAutoBlitterChoose blitterStorage;
1022 if (nullptr == customBlitter) { 1043 if (nullptr == customBlitter) {
1023 blitterStorage.choose(fDst, *fMatrix, paint, drawCoverage); 1044 blitterStorage.choose(fDst, *fMatrix, paint, drawCoverage);
1024 blitter = blitterStorage.get(); 1045 blitter = blitterStorage.get();
1025 } else { 1046 } else {
1026 blitter = customBlitter; 1047 blitter = customBlitter;
1027 } 1048 }
1028 1049
1029 if (paint.getMaskFilter()) { 1050 if (paint.getMaskFilter()) {
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 mask->fImage = SkMask::AllocImage(size); 2105 mask->fImage = SkMask::AllocImage(size);
2085 memset(mask->fImage, 0, mask->computeImageSize()); 2106 memset(mask->fImage, 0, mask->computeImageSize());
2086 } 2107 }
2087 2108
2088 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2109 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2089 draw_into_mask(*mask, devPath, style); 2110 draw_into_mask(*mask, devPath, style);
2090 } 2111 }
2091 2112
2092 return true; 2113 return true;
2093 } 2114 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698