Chromium Code Reviews| Index: ui/gfx/image/image_unittest_util.cc |
| diff --git a/ui/gfx/image/image_unittest_util.cc b/ui/gfx/image/image_unittest_util.cc |
| index 6291b23486868cc6c2a854f565e6b87dd781716f..a9110dbd1717f26fcd8506823a5320c3c7c83325 100644 |
| --- a/ui/gfx/image/image_unittest_util.cc |
| +++ b/ui/gfx/image/image_unittest_util.cc |
| @@ -139,15 +139,19 @@ PlatformImage CopyPlatformType(const gfx::Image& image) { |
| #if defined(OS_MACOSX) |
| // Defined in image_unittest_util_mac.mm. |
| #elif defined(TOOLKIT_GTK) |
| -SkColor GetPlatformImageColor(PlatformImage image) { |
| +SkColor GetPlatformImageColor(PlatformImage image, int x, int y) { |
| + int n_channels = gdk_pixbuf_get_n_channels(image); |
| + int rowstride = gdk_pixbuf_get_rowstride(image); |
| guchar* gdk_pixels = gdk_pixbuf_get_pixels(image); |
| - guchar alpha = gdk_pixbuf_get_has_alpha(image) ? gdk_pixels[3] : 255; |
| - return SkColorSetARGB(alpha, gdk_pixels[0], gdk_pixels[1], gdk_pixels[2]); |
| + |
| + guchar* pixel = gdk_pixels + (y * rowstride) + (x * n_channels); |
|
Elliot Glaysher
2012/09/19 17:47:11
This is probably correct everywhere. (At least you
|
| + guchar alpha = gdk_pixbuf_get_has_alpha(image) ? pixel[3] : 255; |
| + return SkColorSetARGB(alpha, pixel[0], pixel[1], pixel[2]); |
| } |
| #else |
| -SkColor GetPlatformImageColor(PlatformImage image) { |
| +SkColor GetPlatformImageColor(PlatformImage image, int x, int y) { |
| SkAutoLockPixels auto_lock(image); |
| - return image.getColor(10, 10); |
| + return image.getColor(x, y); |
| } |
| #endif |