aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-08-07 08:48:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-07 08:48:12 -0700
commit3848427d884b72114854c8eef9662691f23fae7b (patch)
tree8f42991febfccb93d11e4a452cb5524ab74ad0e4 /src/core
parentca1f07eb5f976a39845721b434b780c5a705f3d9 (diff)
The compiler can generate smulbb perfectly well nowadays.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkMathPriv.h4
-rw-r--r--src/core/SkScan_Antihair.cpp22
2 files changed, 13 insertions, 13 deletions
diff --git a/src/core/SkMathPriv.h b/src/core/SkMathPriv.h
index 345815354c..b9184a0726 100644
--- a/src/core/SkMathPriv.h
+++ b/src/core/SkMathPriv.h
@@ -57,7 +57,7 @@ static inline unsigned SkClampUMax(unsigned value, unsigned max) {
static inline U8CPU SkMulDiv255Trunc(U8CPU a, U8CPU b) {
SkASSERT((uint8_t)a == a);
SkASSERT((uint8_t)b == b);
- unsigned prod = SkMulS16(a, b) + 1;
+ unsigned prod = a*b + 1;
return (prod + (prod >> 8)) >> 8;
}
@@ -67,7 +67,7 @@ static inline U8CPU SkMulDiv255Trunc(U8CPU a, U8CPU b) {
static inline U8CPU SkMulDiv255Ceiling(U8CPU a, U8CPU b) {
SkASSERT((uint8_t)a == a);
SkASSERT((uint8_t)b == b);
- unsigned prod = SkMulS16(a, b) + 255;
+ unsigned prod = a*b + 255;
return (prod + (prod >> 8)) >> 8;
}
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index 546ced0072..2bcb4c64c1 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -34,7 +34,7 @@
static inline int SmallDot6Scale(int value, int dot6) {
SkASSERT((int16_t)value == value);
SkASSERT((unsigned)dot6 <= 64);
- return SkMulS16(value, dot6) >> 6;
+ return (value * dot6) >> 6;
}
//#define TEST_GAMMA
@@ -155,19 +155,19 @@ class Horish_SkAntiHairBlitter : public SkAntiHairBlitter {
public:
SkFixed drawCap(int x, SkFixed fy, SkFixed dy, int mod64) override {
fy += SK_Fixed1/2;
-
+
int lower_y = fy >> 16;
uint8_t a = (uint8_t)(fy >> 8);
unsigned a0 = SmallDot6Scale(255 - a, mod64);
unsigned a1 = SmallDot6Scale(a, mod64);
this->getBlitter()->blitAntiV2(x, lower_y - 1, a0, a1);
-
+
return fy + dy - SK_Fixed1/2;
}
-
+
SkFixed drawLine(int x, int stopx, SkFixed fy, SkFixed dy) override {
SkASSERT(x < stopx);
-
+
fy += SK_Fixed1/2;
SkBlitter* blitter = this->getBlitter();
do {
@@ -176,7 +176,7 @@ public:
blitter->blitAntiV2(x, lower_y - 1, 255 - a, a);
fy += dy;
} while (++x < stopx);
-
+
return fy - SK_Fixed1/2;
}
};
@@ -226,15 +226,15 @@ class Vertish_SkAntiHairBlitter : public SkAntiHairBlitter {
public:
SkFixed drawCap(int y, SkFixed fx, SkFixed dx, int mod64) override {
fx += SK_Fixed1/2;
-
+
int x = fx >> 16;
uint8_t a = (uint8_t)(fx >> 8);
this->getBlitter()->blitAntiH2(x - 1, y,
SmallDot6Scale(255 - a, mod64), SmallDot6Scale(a, mod64));
-
+
return fx + dx - SK_Fixed1/2;
}
-
+
SkFixed drawLine(int y, int stopy, SkFixed fx, SkFixed dx) override {
SkASSERT(y < stopy);
fx += SK_Fixed1/2;
@@ -244,7 +244,7 @@ public:
this->getBlitter()->blitAntiH2(x - 1, y, 255 - a, a);
fx += dx;
} while (++y < stopy);
-
+
return fx - SK_Fixed1/2;
}
};
@@ -540,7 +540,7 @@ void SkScan::AntiHairLineRgn(const SkPoint array[], int arrayCount, const SkRegi
clipBounds.set(clip->getBounds());
/* We perform integral clipping later on, but we do a scalar clip first
to ensure that our coordinates are expressible in fixed/integers.
-
+
antialiased hairlines can draw up to 1/2 of a pixel outside of
their bounds, so we need to outset the clip before calling the
clipper. To make the numerics safer, we outset by a whole pixel,