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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 */ | 243 */ |
244 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); | 244 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); |
245 | 245 |
246 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { | 246 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { |
247 return this->setConfig(config, width, height, rowBytes, | 247 return this->setConfig(config, width, height, rowBytes, |
248 kPremul_SkAlphaType); | 248 kPremul_SkAlphaType); |
249 } | 249 } |
250 | 250 |
251 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); | 251 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); |
252 | 252 |
253 /** | |
254 * If the bitmap's config can be represented as SkImageInfo, return true, | |
255 * and if info is not-null, set it to the bitmap's info. If it cannot be | |
256 * represented as SkImageInfo, return false and ignore the info parameter. | |
257 */ | |
258 bool asImageInfo(SkImageInfo* info) const; | |
259 | |
260 /** Use this to assign a new pixel address for an existing bitmap. This | 253 /** Use this to assign a new pixel address for an existing bitmap. This |
261 will automatically release any pixelref previously installed. Only call | 254 will automatically release any pixelref previously installed. Only call |
262 this if you are handling ownership/lifetime of the pixel memory. | 255 this if you are handling ownership/lifetime of the pixel memory. |
263 | 256 |
264 If the bitmap retains a reference to the colortable (assuming it is | 257 If the bitmap retains a reference to the colortable (assuming it is |
265 not null) it will take care of incrementing the reference count. | 258 not null) it will take care of incrementing the reference count. |
266 | 259 |
267 @param pixels Address for the pixels, managed by the caller. | 260 @param pixels Address for the pixels, managed by the caller. |
268 @param ctable ColorTable (or null) that matches the specified pixels | 261 @param ctable ColorTable (or null) that matches the specified pixels |
269 */ | 262 */ |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 | 798 |
806 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 799 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
807 SkASSERT(fPixels); | 800 SkASSERT(fPixels); |
808 SkASSERT(fConfig == kIndex8_Config); | 801 SkASSERT(fConfig == kIndex8_Config); |
809 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 802 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
810 SkASSERT(fColorTable); | 803 SkASSERT(fColorTable); |
811 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 804 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
812 } | 805 } |
813 | 806 |
814 #endif | 807 #endif |
OLD | NEW |