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 |
253 /** Use this to assign a new pixel address for an existing bitmap. This | 260 /** Use this to assign a new pixel address for an existing bitmap. This |
254 will automatically release any pixelref previously installed. Only call | 261 will automatically release any pixelref previously installed. Only call |
255 this if you are handling ownership/lifetime of the pixel memory. | 262 this if you are handling ownership/lifetime of the pixel memory. |
256 | 263 |
257 If the bitmap retains a reference to the colortable (assuming it is | 264 If the bitmap retains a reference to the colortable (assuming it is |
258 not null) it will take care of incrementing the reference count. | 265 not null) it will take care of incrementing the reference count. |
259 | 266 |
260 @param pixels Address for the pixels, managed by the caller. | 267 @param pixels Address for the pixels, managed by the caller. |
261 @param ctable ColorTable (or null) that matches the specified pixels | 268 @param ctable ColorTable (or null) that matches the specified pixels |
262 */ | 269 */ |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 805 |
799 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 806 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
800 SkASSERT(fPixels); | 807 SkASSERT(fPixels); |
801 SkASSERT(fConfig == kIndex8_Config); | 808 SkASSERT(fConfig == kIndex8_Config); |
802 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 809 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
803 SkASSERT(fColorTable); | 810 SkASSERT(fColorTable); |
804 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 811 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
805 } | 812 } |
806 | 813 |
807 #endif | 814 #endif |
OLD | NEW |