diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-26 19:22:54 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-26 19:22:54 +0000 |
commit | 2c86fbb0b14a1f674bf56ea5ad6a086cc004a76e (patch) | |
tree | 39c7755bf8736c85ae8c3d35d8e4c273140932b1 /src/core | |
parent | 52753b93518d2ad3322c2807799eacb869e9f9d9 (diff) |
Add SkDivMod with a special case for ARM.
BUG=skia:1663
R=djsollen@google.com, tomhudson@google.com, reed@google.com
Author: mtklein@google.com
Review URL: https://chromiumcodereview.appspot.com/24159009
git-svn-id: http://skia.googlecode.com/svn/trunk@11482 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBitmap.cpp | 3 | ||||
-rw-r--r-- | src/core/SkScaledImageCache.cpp | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index d3bbecd706..128726cb63 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -911,9 +911,8 @@ 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); + SkTDivMod(offset, rowBytes, y, x); switch (config) { case SkBitmap::kA8_Config: // Fall through. diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp index 75dac78598..11a0ee448f 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; + SkTDivMod(bm.pixelRefOffset(), bm.rowBytes(), &y, &x); + x >>= 2; fGenID = pr->getGenerationID(); fBounds.set(x, y, x + bm.width(), y + bm.height()); |