OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #ifndef SkBitmap_DEFINED | 10 #ifndef SkBitmap_DEFINED |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 /** Return the shift-per-pixel for the specified config. If the config is | 213 /** Return the shift-per-pixel for the specified config. If the config is |
214 not at least 1-byte per pixel, return 0, including for kNo_Config. | 214 not at least 1-byte per pixel, return 0, including for kNo_Config. |
215 */ | 215 */ |
216 static int ComputeShiftPerPixel(Config c) { | 216 static int ComputeShiftPerPixel(Config c) { |
217 return ComputeBytesPerPixel(c) >> 1; | 217 return ComputeBytesPerPixel(c) >> 1; |
218 } | 218 } |
219 | 219 |
220 static Sk64 ComputeSize64(Config, int width, int height); | 220 static Sk64 ComputeSize64(Config, int width, int height); |
221 static size_t ComputeSize(Config, int width, int height); | 221 static size_t ComputeSize(Config, int width, int height); |
| 222 static Sk64 ComputeSize64(const SkImageInfo& info); |
| 223 static size_t ComputeSize(const SkImageInfo& info); |
222 | 224 |
223 /** | 225 /** |
224 * This will brute-force return true if all of the pixels in the bitmap | 226 * This will brute-force return true if all of the pixels in the bitmap |
225 * are opaque. If it fails to read the pixels, or encounters an error, | 227 * are opaque. If it fails to read the pixels, or encounters an error, |
226 * it will return false. | 228 * it will return false. |
227 * | 229 * |
228 * Since this can be an expensive operation, the bitmap stores a flag for | 230 * Since this can be an expensive operation, the bitmap stores a flag for |
229 * this (isOpaque). Only call this if you need to compute this value from | 231 * this (isOpaque). Only call this if you need to compute this value from |
230 * "unknown" pixels. | 232 * "unknown" pixels. |
231 */ | 233 */ |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 | 807 |
806 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 808 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
807 SkASSERT(fPixels); | 809 SkASSERT(fPixels); |
808 SkASSERT(fConfig == kIndex8_Config); | 810 SkASSERT(fConfig == kIndex8_Config); |
809 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 811 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
810 SkASSERT(fColorTable); | 812 SkASSERT(fColorTable); |
811 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 813 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
812 } | 814 } |
813 | 815 |
814 #endif | 816 #endif |
OLD | NEW |