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

Unified Diff: src/core/SkScaledImageCache.cpp

Issue 24159009: Add SkDivMod with a special case for ARM. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: port get_upper_left_from_offset Created 7 years, 3 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
Index: src/core/SkScaledImageCache.cpp
diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp
index 75dac7859829aca5677e2803a251886f381b1ba2..2014974f0b8068ccd6b494d80c0174a540bedde0 100644
--- a/src/core/SkScaledImageCache.cpp
+++ b/src/core/SkScaledImageCache.cpp
@@ -48,10 +48,9 @@ struct Key {
return false;
}
- size_t offset = bm.pixelRefOffset();
- size_t rowBytes = bm.rowBytes();
- int x = (offset % rowBytes) >> 2;
- int y = offset / rowBytes;
+ size_t x, y;
+ SkDivMod(bm.pixelRefOffset(), bm.rowBytes(), &y, &x);
+ x >>= 2;
fGenID = pr->getGenerationID();
fBounds.set(x, y, x + bm.width(), y + bm.height());
« src/core/SkBitmap.cpp ('K') | « src/core/SkBitmap.cpp ('k') | tests/MathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698