aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_Antihair.cpp
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:09:54 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:09:54 +0000
commitfbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (patch)
treed8b4815d15946c32ee9d254e932411e93be942bb /src/core/SkScan_Antihair.cpp
parent2abed834789bb64c7da740df4c47efc142b7311a (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part I of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6485054 git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkScan_Antihair.cpp')
-rw-r--r--src/core/SkScan_Antihair.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index ec23a2b525..92245d4f33 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -106,7 +106,7 @@ static SkFixed hline(int x, int stopx, SkFixed fy, SkFixed /*slope*/,
if (ma) {
call_hline_blitter(blitter, x, y - 1, count, ma);
}
-
+
return fy - SK_Fixed1/2;
}
@@ -145,7 +145,7 @@ static SkFixed horish(int x, int stopx, SkFixed fy, SkFixed dy,
}
fy += dy;
} while (++x < stopx);
-
+
return fy - SK_Fixed1/2;
}
@@ -165,7 +165,7 @@ static SkFixed vline(int y, int stopy, SkFixed fx, SkFixed /*slope*/,
if (ma) {
blitter->blitV(x - 1, y, stopy - y, ApplyGamma(gGammaTable, ma));
}
-
+
return fx - SK_Fixed1/2;
}
@@ -267,7 +267,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
int scaleStart, scaleStop;
int istart, istop;
- SkFixed fstart, slope;
+ SkFixed fstart, slope;
LineProc proc;
if (SkAbs32(x1 - x0) > SkAbs32(y1 - y0)) { // mostly horizontal
@@ -288,7 +288,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
fstart += (slope * (32 - (x0 & 63)) + 32) >> 6;
proc = horish;
}
-
+
SkASSERT(istop > istart);
if (istop - istart == 1) {
scaleStart = x1 - x0;
@@ -368,7 +368,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
scaleStart = 64 - (y0 & 63);
scaleStop = y1 & 63;
}
-
+
if (clip) {
if (istart >= clip->fBottom || istop <= clip->fTop) {
return;
@@ -414,7 +414,7 @@ static void do_anti_hairline(SkFDot6 x0, SkFDot6 y0, SkFDot6 x1, SkFDot6 y1,
rectClipper.init(blitter, *clip);
blitter = &rectClipper;
}
-
+
fstart = proc(istart, istart + 1, fstart, slope, blitter, scaleStart);
istart += 1;
int fullSpans = istop - istart - (scaleStop > 0);
@@ -471,7 +471,7 @@ void SkScan::AntiHairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
return;
}
}
-
+
SkFDot6 x0 = SkScalarToFDot6(pts[0].fX);
SkFDot6 y0 = SkScalarToFDot6(pts[0].fY);
SkFDot6 x1 = SkScalarToFDot6(pts[1].fX);
@@ -533,14 +533,14 @@ static inline FDot8 SkFixedToFDot8(SkFixed x) {
static void do_scanline(FDot8 L, int top, FDot8 R, U8CPU alpha,
SkBlitter* blitter) {
SkASSERT(L < R);
-
+
if ((L >> 8) == ((R - 1) >> 8)) { // 1x1 pixel
blitter->blitV(L >> 8, top, 1, SkAlphaMul(alpha, R - L));
return;
}
-
+
int left = L >> 8;
-
+
if (L & 0xFF) {
blitter->blitV(left, top, 1, SkAlphaMul(alpha, 256 - (L & 0xFF)));
left += 1;
@@ -567,12 +567,12 @@ static void antifilldot8(FDot8 L, FDot8 T, FDot8 R, FDot8 B, SkBlitter* blitter,
do_scanline(L, top, R, B - T - 1, blitter);
return;
}
-
+
if (T & 0xFF) {
do_scanline(L, top, R, 256 - (T & 0xFF), blitter);
top += 1;
}
-
+
int bot = B >> 8;
int height = bot - top;
if (height > 0) {
@@ -594,7 +594,7 @@ static void antifilldot8(FDot8 L, FDot8 T, FDot8 R, FDot8 B, SkBlitter* blitter,
}
}
}
-
+
if (B & 0xFF) {
do_scanline(L, bot, R, B & 0xFF, blitter);
}
@@ -632,10 +632,10 @@ void SkScan::AntiFillXRect(const SkXRect& xr, const SkRegion* clip,
} else {
SkRegion::Cliperator clipper(*clip, outerBounds);
const SkIRect& rr = clipper.rect();
-
+
while (!clipper.done()) {
SkXRect tmpR;
-
+
// this keeps our original edges fractional
XRect_set(&tmpR, rr);
if (tmpR.intersect(xr)) {
@@ -674,7 +674,7 @@ void SkScan::AntiFillXRect(const SkXRect& xr, const SkRasterClip& clip,
*/
static void antifillrect(const SkRect& r, SkBlitter* blitter) {
SkXRect xr;
-
+
XRect_set(&xr, r);
antifillrect(xr, blitter);
}
@@ -682,7 +682,7 @@ static void antifillrect(const SkRect& r, SkBlitter* blitter) {
/* We repeat the clipping logic of AntiFillXRect because the float rect might
overflow if we blindly converted it to an XRect. This sucks that we have to
repeat the clipping logic, but I don't see how to share the code/logic.
-
+
We clip r (as needed) into one or more (smaller) float rects, and then pass
those to our version of antifillrect, which converts it into an XRect and
then calls the blit.
@@ -698,7 +698,7 @@ void SkScan::AntiFillRect(const SkRect& origR, const SkRegion* clip,
SkIRect outerBounds;
newR.roundOut(&outerBounds);
-
+
if (clip->isRect()) {
antifillrect(newR, blitter);
} else {
@@ -765,24 +765,24 @@ static inline U8CPU InvAlphaMul(U8CPU a, U8CPU b) {
static void inner_scanline(FDot8 L, int top, FDot8 R, U8CPU alpha,
SkBlitter* blitter) {
SkASSERT(L < R);
-
+
if ((L >> 8) == ((R - 1) >> 8)) { // 1x1 pixel
blitter->blitV(L >> 8, top, 1, InvAlphaMul(alpha, R - L));
return;
}
-
+
int left = L >> 8;
if (L & 0xFF) {
blitter->blitV(left, top, 1, InvAlphaMul(alpha, L & 0xFF));
left += 1;
}
-
+
int rite = R >> 8;
int width = rite - left;
if (width > 0) {
call_hline_blitter(blitter, left, top, width, alpha);
}
-
+
if (R & 0xFF) {
blitter->blitV(rite, top, 1, InvAlphaMul(alpha, ~R & 0xFF));
}
@@ -801,12 +801,12 @@ static void innerstrokedot8(FDot8 L, FDot8 T, FDot8 R, FDot8 B,
}
return;
}
-
+
if (T & 0xFF) {
inner_scanline(L, top, R, T & 0xFF, blitter);
top += 1;
}
-
+
int bot = B >> 8;
int height = bot - top;
if (height > 0) {
@@ -817,7 +817,7 @@ static void innerstrokedot8(FDot8 L, FDot8 T, FDot8 R, FDot8 B,
blitter->blitV(R >> 8, top, height, ~R & 0xFF);
}
}
-
+
if (B & 0xFF) {
inner_scanline(L, bot, R, ~B & 0xFF, blitter);
}
@@ -850,7 +850,7 @@ void SkScan::AntiFrameRect(const SkRect& r, const SkPoint& strokeSize,
}
// now we can ignore clip for the rest of the function
}
-
+
// stroke the outer hull
antifilldot8(L, T, R, B, blitter, false);