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

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

Issue 2439973004: Fall back from analytic to sampling earlier (Closed)
Patch Set: Created 4 years, 1 month 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 2016 The Android Open Source Project 2 * Copyright 2016 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 7
8 #include "SkAntiRun.h" 8 #include "SkAntiRun.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkEdge.h" 10 #include "SkEdge.h"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 #ifdef SK_DEBUG 1123 #ifdef SK_DEBUG
1124 SkDebugf("frac_y_cnt = %d, total_y_cnt = %d\n", frac_y_cnt, total_y_cnt); 1124 SkDebugf("frac_y_cnt = %d, total_y_cnt = %d\n", frac_y_cnt, total_y_cnt);
1125 #endif 1125 #endif
1126 } 1126 }
1127 1127
1128 void SkScan::aaa_fill_path(const SkPath& path, const SkIRect* clipRect, Additive Blitter* blitter, 1128 void SkScan::aaa_fill_path(const SkPath& path, const SkIRect* clipRect, Additive Blitter* blitter,
1129 int start_y, int stop_y, const SkRegion& clipRgn, bool isUsin gMask, 1129 int start_y, int stop_y, const SkRegion& clipRgn, bool isUsin gMask,
1130 bool forceRLE) { // forceRLE implies that SkAAClip is calling us 1130 bool forceRLE) { // forceRLE implies that SkAAClip is calling us
1131 SkASSERT(blitter); 1131 SkASSERT(blitter);
1132 1132
1133 if (path.isInverseFillType() || !path.isConvex()) { 1133 // we only implemented the convex shapes yet
1134 // fall back to supersampling AA 1134 SkASSERT(!path.isInverseFillType() && path.isConvex());
1135 SkScan::AntiFillPath(path, clipRgn, blitter->getRealBlitter(true), force RLE);
1136 return;
1137 }
1138 1135
1139 SkEdgeBuilder builder; 1136 SkEdgeBuilder builder;
1140 1137
1141 // If we're convex, then we need both edges, even the right edge is past the clip 1138 // If we're convex, then we need both edges, even the right edge is past the clip
1142 const bool canCullToTheRight = !path.isConvex(); 1139 const bool canCullToTheRight = !path.isConvex();
1143 1140
1144 SkASSERT(gSkUseAnalyticAA.load()); 1141 SkASSERT(gSkUseAnalyticAA.load());
1145 int count = builder.build(path, clipRect, 0, canCullToTheRight, true); 1142 int count = builder.build(path, clipRect, 0, canCullToTheRight, true);
1146 SkASSERT(count >= 0); 1143 SkASSERT(count >= 0);
1147 1144
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 } 1207 }
1211 } 1208 }
1212 1209
1213 /////////////////////////////////////////////////////////////////////////////// 1210 ///////////////////////////////////////////////////////////////////////////////
1214 1211
1215 void SkScan::AAAFillPath(const SkPath& path, const SkRegion& origClip, SkBlitter * blitter, 1212 void SkScan::AAAFillPath(const SkPath& path, const SkRegion& origClip, SkBlitter * blitter,
1216 bool forceRLE) { 1213 bool forceRLE) {
1217 if (origClip.isEmpty()) { 1214 if (origClip.isEmpty()) {
1218 return; 1215 return;
1219 } 1216 }
1217 if (path.isInverseFillType() || !path.isConvex()) {
1218 // Fall back as we only implemented the algorithm for convex shapes yet.
1219 SkScan::AntiFillPath(path, origClip, blitter, forceRLE);
1220 return;
1221 }
1220 1222
1221 const bool isInverse = path.isInverseFillType(); 1223 const bool isInverse = path.isInverseFillType();
1222 SkIRect ir; 1224 SkIRect ir;
1223 path.getBounds().roundOut(&ir); 1225 path.getBounds().roundOut(&ir);
1224 if (ir.isEmpty()) { 1226 if (ir.isEmpty()) {
1225 if (isInverse) { 1227 if (isInverse) {
1226 blitter->blitRegion(origClip); 1228 blitter->blitRegion(origClip);
1227 } 1229 }
1228 return; 1230 return;
1229 } 1231 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 AAAFillPath(path, clip.bwRgn(), blitter); 1308 AAAFillPath(path, clip.bwRgn(), blitter);
1307 } else { 1309 } else {
1308 SkRegion tmp; 1310 SkRegion tmp;
1309 SkAAClipBlitter aaBlitter; 1311 SkAAClipBlitter aaBlitter;
1310 1312
1311 tmp.setRect(clip.getBounds()); 1313 tmp.setRect(clip.getBounds());
1312 aaBlitter.init(blitter, &clip.aaRgn()); 1314 aaBlitter.init(blitter, &clip.aaRgn());
1313 AAAFillPath(path, tmp, &aaBlitter); 1315 AAAFillPath(path, tmp, &aaBlitter);
1314 } 1316 }
1315 } 1317 }
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