Chromium Code Reviews| Index: src/core/SkBitmap.cpp |
| diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp |
| index fe4255d9b5e2ac41d267f62dfc178d48a12e3098..547f9acd3b7ca33afe41e8cd1e66d35cb93e7e47 100644 |
| --- a/src/core/SkBitmap.cpp |
| +++ b/src/core/SkBitmap.cpp |
| @@ -866,18 +866,18 @@ static size_t getSubOffset(const SkBitmap& bm, int x, int y) { |
| * upper left corner of bm relative to its SkPixelRef. |
| * x and y must be non-NULL. |
| */ |
| -static bool getUpperLeftFromOffset(const SkBitmap& bm, int32_t* x, int32_t* y) { |
| +bool getUpperLeftFromOffset(SkBitmap::Config config, size_t offset, size_t rowBytes, |
| + int32_t* x, int32_t* y) { |
| SkASSERT(x != NULL && y != NULL); |
| - const size_t offset = bm.pixelRefOffset(); |
| if (0 == offset) { |
| *x = *y = 0; |
| return true; |
| } |
| // Use integer division to find the correct y position. |
| - *y = SkToS32(offset / bm.rowBytes()); |
| + *y = SkToS32(offset / rowBytes); |
| // The remainder will be the x position, after we reverse getSubOffset. |
| - *x = SkToS32(offset % bm.rowBytes()); |
| - switch (bm.getConfig()) { |
| + *x = SkToS32(offset % rowBytes); |
| + switch (config) { |
| case SkBitmap::kA8_Config: |
| // Fall through. |
| case SkBitmap::kIndex8_Config: |
| @@ -904,6 +904,10 @@ static bool getUpperLeftFromOffset(const SkBitmap& bm, int32_t* x, int32_t* y) { |
| return true; |
| } |
| +static bool getUpperLeftFromOffset(const SkBitmap& bm, int32_t* x, int32_t* y) { |
|
djsollen
2013/05/21 14:10:44
according to our style guide static methods should
scroggo
2013/05/21 16:14:15
Done.
|
| + return getUpperLeftFromOffset(bm.config(), bm.pixelRefOffset(), bm.rowBytes(), x, y); |
| +} |
| + |
| bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { |
| SkDEBUGCODE(this->validate();) |