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

Unified Diff: src/core/SkBitmap.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/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index d3bbecd7066dfe4d826d5bd778e635c1e5215910..446926fde4b9827f82b689519aba3d4518093c50 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -911,9 +911,11 @@ bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r
return true;
}
// Use integer division to find the correct y position.
- *y = SkToS32(offset / rowBytes);
// The remainder will be the x position, after we reverse get_sub_offset.
- *x = SkToS32(offset % rowBytes);
+ size_t xSizeT, ySizeT;
reed1 2013/09/20 19:02:39 do we really need to have two local vars to call t
mtklein 2013/09/20 19:29:35 We could, but that'd force offset and rowBytes to
+ SkDivMod(offset, rowBytes, &ySizeT, &xSizeT);
+ *y = SkToS32(ySizeT);
+ *x = SkToS32(xSizeT);
switch (config) {
case SkBitmap::kA8_Config:
// Fall through.

Powered by Google App Engine
This is Rietveld 408576698