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

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

Issue 267003002: add rounding-using-doubles methods on SkScalar and SkRect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix spelling in comment Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkScalar.h ('k') | tests/PathTest.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 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 7
8 #include "SkScanPriv.h" 8 #include "SkScanPriv.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkEdge.h" 10 #include "SkEdge.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 SkRegion finiteClip; 595 SkRegion finiteClip;
596 if (clip_to_limit(origClip, &finiteClip)) { 596 if (clip_to_limit(origClip, &finiteClip)) {
597 if (finiteClip.isEmpty()) { 597 if (finiteClip.isEmpty()) {
598 return; 598 return;
599 } 599 }
600 clipPtr = &finiteClip; 600 clipPtr = &finiteClip;
601 } 601 }
602 // don't reference "origClip" any more, just use clipPtr 602 // don't reference "origClip" any more, just use clipPtr
603 603
604 SkIRect ir; 604 SkIRect ir;
605 path.getBounds().round(&ir); 605 // We deliberately call dround() instead of round(), since we can't afford t o generate a
606 // bounds that is tighter than the corresponding SkEdges. The edge code basi cally converts
607 // the floats to fixed, and then "rounds". If we called round() instead of d round() here,
608 // we could generate the wrong ir for values like 0.4999997.
609 path.getBounds().dround(&ir);
606 if (ir.isEmpty()) { 610 if (ir.isEmpty()) {
607 if (path.isInverseFillType()) { 611 if (path.isInverseFillType()) {
608 blitter->blitRegion(*clipPtr); 612 blitter->blitRegion(*clipPtr);
609 } 613 }
610 return; 614 return;
611 } 615 }
612 616
613 SkScanClipper clipper(blitter, clipPtr, ir, path.isInverseFillType()); 617 SkScanClipper clipper(blitter, clipPtr, ir, path.isInverseFillType());
614 618
615 blitter = clipper.getBlitter(); 619 blitter = clipper.getBlitter();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 clipRgn = &wrap.getRgn(); 724 clipRgn = &wrap.getRgn();
721 blitter = wrap.getBlitter(); 725 blitter = wrap.getBlitter();
722 } 726 }
723 727
724 SkScanClipper clipper(blitter, clipRgn, ir); 728 SkScanClipper clipper(blitter, clipRgn, ir);
725 blitter = clipper.getBlitter(); 729 blitter = clipper.getBlitter();
726 if (NULL != blitter) { 730 if (NULL != blitter) {
727 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir); 731 sk_fill_triangle(pts, clipper.getClipRect(), blitter, ir);
728 } 732 }
729 } 733 }
OLDNEW
« no previous file with comments | « include/core/SkScalar.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698