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

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

Issue 2482193004: Tighten SkAAClip Bounds by Path Bounds (Closed)
Patch Set: Send in the true SkRegion 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 | src/core/SkScan_AAAPath.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 "SkAAClip.h" 8 #include "SkAAClip.h"
9 #include "SkAtomics.h" 9 #include "SkAtomics.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 1396
1397 SkIRect ibounds; 1397 SkIRect ibounds;
1398 path.getBounds().roundOut(&ibounds); 1398 path.getBounds().roundOut(&ibounds);
1399 1399
1400 SkRegion tmpClip; 1400 SkRegion tmpClip;
1401 if (nullptr == clip) { 1401 if (nullptr == clip) {
1402 tmpClip.setRect(ibounds); 1402 tmpClip.setRect(ibounds);
1403 clip = &tmpClip; 1403 clip = &tmpClip;
1404 } 1404 }
1405 1405
1406 SkRegion realClip(*clip);
reed1 2016/11/09 21:27:42 nit: real doesn't convey much. How about tightClip
1407
1406 if (path.isInverseFillType()) { 1408 if (path.isInverseFillType()) {
1407 ibounds = clip->getBounds(); 1409 ibounds = clip->getBounds();
1408 } else { 1410 } else {
1409 if (ibounds.isEmpty() || !ibounds.intersect(clip->getBounds())) { 1411 if (ibounds.isEmpty() || !ibounds.intersect(clip->getBounds())) {
1410 return this->setEmpty(); 1412 return this->setEmpty();
1411 } 1413 }
1414 realClip.op(ibounds, SkRegion::kIntersect_Op);
1412 } 1415 }
1413 1416
1414 Builder builder(ibounds); 1417 Builder builder(ibounds);
1415 BuilderBlitter blitter(&builder); 1418 BuilderBlitter blitter(&builder);
1416 1419
1417 if (doAA) { 1420 if (doAA) {
1418 if (gSkUseAnalyticAA.load()) { 1421 if (gSkUseAnalyticAA.load()) {
1419 SkScan::AAAFillPath(path, *clip, &blitter, true); 1422 SkScan::AAAFillPath(path, realClip, &blitter, true);
1420 } else { 1423 } else {
1421 SkScan::AntiFillPath(path, *clip, &blitter, true); 1424 SkScan::AntiFillPath(path, realClip, &blitter, true);
1422 } 1425 }
1423 } else { 1426 } else {
1424 SkScan::FillPath(path, *clip, &blitter); 1427 SkScan::FillPath(path, realClip, &blitter);
1425 } 1428 }
1426 1429
1427 blitter.finish(); 1430 blitter.finish();
1428 return builder.finish(this); 1431 return builder.finish(this);
1429 } 1432 }
1430 1433
1431 /////////////////////////////////////////////////////////////////////////////// 1434 ///////////////////////////////////////////////////////////////////////////////
1432 1435
1433 typedef void (*RowProc)(SkAAClip::Builder&, int bottom, 1436 typedef void (*RowProc)(SkAAClip::Builder&, int bottom,
1434 const uint8_t* rowA, const SkIRect& rectA, 1437 const uint8_t* rowA, const SkIRect& rectA,
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 rowMask.fBounds.fBottom = y + 1; 2235 rowMask.fBounds.fBottom = y + 1;
2233 fBlitter->blitMask(rowMask, rowMask.fBounds); 2236 fBlitter->blitMask(rowMask, rowMask.fBounds);
2234 src = (const void*)((const char*)src + srcRB); 2237 src = (const void*)((const char*)src + srcRB);
2235 } while (++y < localStopY); 2238 } while (++y < localStopY);
2236 } while (y < stopY); 2239 } while (y < stopY);
2237 } 2240 }
2238 2241
2239 const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { 2242 const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
2240 return nullptr; 2243 return nullptr;
2241 } 2244 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkScan_AAAPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698