aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapProcState.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-01-30 18:56:34 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-30 18:56:34 -0800
commit8a8eb5242b11ac0b9851b350fbdab0a797ab4a9f (patch)
tree62707c9f74fab25204c109419752fac0439cc436 /src/core/SkBitmapProcState.h
parent395eabeb0e72334c45324874c6e009b54634df21 (diff)
Remove SkBitmapProcStateAutoMapper's overflow check
(follow-up to https://codereview.chromium.org/1642273002) Add an optional SkPoint outparam, and relocate the overflow check to the only client which needs it. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1650403002 Review URL: https://codereview.chromium.org/1650403002
Diffstat (limited to 'src/core/SkBitmapProcState.h')
-rw-r--r--src/core/SkBitmapProcState.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 5e680befd2..0ae8cf2856 100644
--- a/src/core/SkBitmapProcState.h
+++ b/src/core/SkBitmapProcState.h
@@ -192,7 +192,8 @@ void ClampX_ClampY_nofilter_affine(const SkBitmapProcState& s,
// TODO: filtered version which applies a fFilterOne{X,Y}/2 bias instead of epsilon?
class SkBitmapProcStateAutoMapper {
public:
- SkBitmapProcStateAutoMapper(const SkBitmapProcState& s, int x, int y) {
+ SkBitmapProcStateAutoMapper(const SkBitmapProcState& s, int x, int y,
+ SkPoint* scalarPoint = nullptr) {
SkPoint pt;
s.fInvProc(s.fInvMatrix,
SkIntToScalar(x) + SK_ScalarHalf,
@@ -207,26 +208,17 @@ public:
fX = SkScalarToFractionalInt(pt.x()) - SkFixedToFractionalInt(biasX);
fY = SkScalarToFractionalInt(pt.y()) - SkFixedToFractionalInt(biasY);
- /*
- * (see SkBitmapProcState::setupForTranslate, which is the only user of this flag)
- *
- * if the translate is larger than our ints, we can get random results, or
- * worse, we might get 0x80000000, which wreaks havoc on us, since we can't
- * negate it.
- */
- const SkScalar too_big = SkIntToScalar(1 << 30);
- fOverflow = SkScalarAbs(pt.x() - SkFixedToScalar(biasX)) > too_big
- || SkScalarAbs(pt.y() - SkFixedToScalar(biasY)) > too_big;
+ if (scalarPoint) {
+ scalarPoint->set(pt.x() - SkFixedToScalar(biasX),
+ pt.y() - SkFixedToScalar(biasY));
+ }
}
SkFractionalInt x() const { return fX; }
SkFractionalInt y() const { return fY; }
- bool isOverflow() const { return fOverflow; }
-
private:
SkFractionalInt fX, fY;
- bool fOverflow;
};
#endif