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

Unified Diff: src/core/SkBitmapProcState.h

Issue 1650403002: Remove SkBitmapProcStateAutoMapper's overflow check (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState.h
diff --git a/src/core/SkBitmapProcState.h b/src/core/SkBitmapProcState.h
index 5e680befd258a2ab85ce8f07597e444696973f93..0ae8cf285670bc8a5b187f57012f0d0ccbf0cadc 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
« no previous file with comments | « no previous file | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698