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

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

Issue 117053002: remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkScan.h" 10 #include "SkScan.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 #endif 41 #endif
42 42
43 void SkScan::HairLineRgn(const SkPoint& pt0, const SkPoint& pt1, 43 void SkScan::HairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
44 const SkRegion* clip, SkBlitter* blitter) { 44 const SkRegion* clip, SkBlitter* blitter) {
45 SkBlitterClipper clipper; 45 SkBlitterClipper clipper;
46 SkRect r; 46 SkRect r;
47 SkIRect clipR, ptsR; 47 SkIRect clipR, ptsR;
48 SkPoint pts[2] = { pt0, pt1 }; 48 SkPoint pts[2] = { pt0, pt1 };
49 49
50 #ifdef SK_SCALAR_IS_FLOAT
51 // We have to pre-clip the line to fit in a SkFixed, so we just chop 50 // We have to pre-clip the line to fit in a SkFixed, so we just chop
52 // the line. TODO find a way to actually draw beyond that range. 51 // the line. TODO find a way to actually draw beyond that range.
53 { 52 {
54 SkRect fixedBounds; 53 SkRect fixedBounds;
55 const SkScalar max = SkIntToScalar(32767); 54 const SkScalar max = SkIntToScalar(32767);
56 fixedBounds.set(-max, -max, max, max); 55 fixedBounds.set(-max, -max, max, max);
57 if (!SkLineClipper::IntersectLine(pts, fixedBounds, pts)) { 56 if (!SkLineClipper::IntersectLine(pts, fixedBounds, pts)) {
58 return; 57 return;
59 } 58 }
60 } 59 }
61 #endif
62 60
63 if (clip) { 61 if (clip) {
64 // Perform a clip in scalar space, so we catch huge values which might 62 // Perform a clip in scalar space, so we catch huge values which might
65 // be missed after we convert to SkFDot6 (overflow) 63 // be missed after we convert to SkFDot6 (overflow)
66 r.set(clip->getBounds()); 64 r.set(clip->getBounds());
67 if (!SkLineClipper::IntersectLine(pts, r, pts)) { 65 if (!SkLineClipper::IntersectLine(pts, r, pts)) {
68 return; 66 return;
69 } 67 }
70 } 68 }
71 69
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 408
411 SkAAClipBlitterWrapper wrap; 409 SkAAClipBlitterWrapper wrap;
412 if (!clip.quickContains(ir)) { 410 if (!clip.quickContains(ir)) {
413 wrap.init(clip, blitter); 411 wrap.init(clip, blitter);
414 blitter = wrap.getBlitter(); 412 blitter = wrap.getBlitter();
415 clipRgn = &wrap.getRgn(); 413 clipRgn = &wrap.getRgn();
416 } 414 }
417 AntiHairLineRgn(p0, p1, clipRgn, blitter); 415 AntiHairLineRgn(p0, p1, clipRgn, blitter);
418 } 416 }
419 } 417 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698