| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 } | 860 } |
| 861 return y * bm.rowBytes() + x; | 861 return y * bm.rowBytes() + x; |
| 862 } | 862 } |
| 863 | 863 |
| 864 /** | 864 /** |
| 865 * Using the pixelRefOffset(), rowBytes(), and Config of bm, determine the (x,
y) coordinate of the | 865 * Using the pixelRefOffset(), rowBytes(), and Config of bm, determine the (x,
y) coordinate of the |
| 866 * upper left corner of bm relative to its SkPixelRef. | 866 * upper left corner of bm relative to its SkPixelRef. |
| 867 * x and y must be non-NULL. | 867 * x and y must be non-NULL. |
| 868 */ | 868 */ |
| 869 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r
owBytes, | 869 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r
owBytes, |
| 870 int32_t* x, int32_t* y); |
| 871 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r
owBytes, |
| 870 int32_t* x, int32_t* y) { | 872 int32_t* x, int32_t* y) { |
| 871 SkASSERT(x != NULL && y != NULL); | 873 SkASSERT(x != NULL && y != NULL); |
| 872 if (0 == offset) { | 874 if (0 == offset) { |
| 873 *x = *y = 0; | 875 *x = *y = 0; |
| 874 return true; | 876 return true; |
| 875 } | 877 } |
| 876 // Use integer division to find the correct y position. | 878 // Use integer division to find the correct y position. |
| 877 *y = SkToS32(offset / rowBytes); | 879 *y = SkToS32(offset / rowBytes); |
| 878 // The remainder will be the x position, after we reverse get_sub_offset. | 880 // The remainder will be the x position, after we reverse get_sub_offset. |
| 879 *x = SkToS32(offset % rowBytes); | 881 *x = SkToS32(offset % rowBytes); |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 if (NULL != uri) { | 1675 if (NULL != uri) { |
| 1674 str->appendf(" uri:\"%s\"", uri); | 1676 str->appendf(" uri:\"%s\"", uri); |
| 1675 } else { | 1677 } else { |
| 1676 str->appendf(" pixelref:%p", pr); | 1678 str->appendf(" pixelref:%p", pr); |
| 1677 } | 1679 } |
| 1678 } | 1680 } |
| 1679 | 1681 |
| 1680 str->append(")"); | 1682 str->append(")"); |
| 1681 } | 1683 } |
| 1682 #endif | 1684 #endif |
| OLD | NEW |