Chromium Code Reviews| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 222 |
| 223 /** Returns true if config's Value is in the Config enum. | |
| 224 */ | |
| 225 static bool IsValidConfig(Config config); | |
|
reed1
2013/09/03 20:25:21
can we put this in some helper file for validation
sugoi1
2013/09/04 18:01:10
Done.
| |
| 226 | |
| 223 /** | 227 /** |
| 224 * This will brute-force return true if all of the pixels in the bitmap | 228 * 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, | 229 * are opaque. If it fails to read the pixels, or encounters an error, |
| 226 * it will return false. | 230 * it will return false. |
| 227 * | 231 * |
| 228 * Since this can be an expensive operation, the bitmap stores a flag for | 232 * Since this can be an expensive operation, the bitmap stores a flag for |
| 229 * this (isOpaque, setIsOpaque). Only call this if you need to compute this | 233 * this (isOpaque, setIsOpaque). Only call this if you need to compute this |
| 230 * value from "unknown" pixels. | 234 * value from "unknown" pixels. |
| 231 */ | 235 */ |
| 232 static bool ComputeIsOpaque(const SkBitmap&); | 236 static bool ComputeIsOpaque(const SkBitmap&); |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 811 | 815 |
| 812 // returns the address of the byte that contains the x coordinate | 816 // returns the address of the byte that contains the x coordinate |
| 813 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 817 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
| 814 SkASSERT(fPixels); | 818 SkASSERT(fPixels); |
| 815 SkASSERT(fConfig == kA1_Config); | 819 SkASSERT(fConfig == kA1_Config); |
| 816 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 820 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 817 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 821 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
| 818 } | 822 } |
| 819 | 823 |
| 820 #endif | 824 #endif |
| OLD | NEW |