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

Unified Diff: src/core/SkBitmapProcState.cpp

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 | « src/core/SkBitmapProcState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState.cpp
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index c4b29392f15c3d7dd166190b96eb5e32f9968b3e..d9d47a270f5fa0f4b50876552b645a8a65300845 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -586,29 +586,28 @@ static void DoNothing_shaderproc(const void*, int x, int y,
}
bool SkBitmapProcState::setupForTranslate() {
-#ifdef SK_SUPPORT_LEGACY_SAMPLER_BIAS
SkPoint pt;
- fInvProc(fInvMatrix, SK_ScalarHalf, SK_ScalarHalf, &pt);
- const SkScalar too_big = SkIntToScalar(1 << 30);
- if (SkScalarAbs(pt.fX) > too_big || SkScalarAbs(pt.fY) > too_big) {
- return false;
- }
-
- fFilterOneX = SkScalarFloorToInt(pt.fX);
- fFilterOneY = SkScalarFloorToInt(pt.fY);
+#ifdef SK_SUPPORT_LEGACY_SAMPLER_BIAS
+ fInvProc(fInvMatrix, SK_ScalarHalf, SK_ScalarHalf, &pt);
#else
- SkBitmapProcStateAutoMapper mapper(*this, 0, 0);
+ const SkBitmapProcStateAutoMapper mapper(*this, 0, 0, &pt);
+#endif
/*
* 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.
*/
- if (mapper.isOverflow()) {
+ const SkScalar too_big = SkIntToScalar(1 << 30);
+ if (SkScalarAbs(pt.fX) > too_big || SkScalarAbs(pt.fY) > too_big) {
return false;
}
+#ifdef SK_SUPPORT_LEGACY_SAMPLER_BIAS
+ fFilterOneX = SkScalarFloorToInt(pt.fX);
+ fFilterOneY = SkScalarFloorToInt(pt.fY);
+#else
// Since we know we're not filtered, we re-purpose these fields allow
// us to go from device -> src coordinates w/ just an integer add,
// rather than running through the inverse-matrix
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698