OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkBitmap_DEFINED | 8 #ifndef SkBitmap_DEFINED |
9 #define SkBitmap_DEFINED | 9 #define SkBitmap_DEFINED |
10 | 10 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 this if you are handling ownership/lifetime of the pixel memory. | 261 this if you are handling ownership/lifetime of the pixel memory. |
262 | 262 |
263 If the bitmap retains a reference to the colortable (assuming it is | 263 If the bitmap retains a reference to the colortable (assuming it is |
264 not null) it will take care of incrementing the reference count. | 264 not null) it will take care of incrementing the reference count. |
265 | 265 |
266 @param pixels Address for the pixels, managed by the caller. | 266 @param pixels Address for the pixels, managed by the caller. |
267 @param ctable ColorTable (or null) that matches the specified pixels | 267 @param ctable ColorTable (or null) that matches the specified pixels |
268 */ | 268 */ |
269 void setPixels(void* p, SkColorTable* ctable = NULL); | 269 void setPixels(void* p, SkColorTable* ctable = NULL); |
270 | 270 |
271 /** | |
272 * Install the specified pixelref into the bitmap, with an optional rect | |
273 * for referencing a subset of the pixels in the pixelref. This sets the | |
274 * config/width/height/alphatype of the bitmap to match the pixelref. | |
275 * | |
276 * The subset rect, if not null, is intersected with the bounds of the | |
277 * pixelref (taken from its SkImageInfo). | |
278 */ | |
279 SkPixelRef* installPixelRef(SkPixelRef*, const SkIRect* subset = NULL); | |
280 | |
281 /** Copies the bitmap's pixels to the location pointed at by dst and returns | 271 /** Copies the bitmap's pixels to the location pointed at by dst and returns |
282 true if possible, returns false otherwise. | 272 true if possible, returns false otherwise. |
283 | 273 |
284 In the case when the dstRowBytes matches the bitmap's rowBytes, the copy | 274 In the case when the dstRowBytes matches the bitmap's rowBytes, the copy |
285 may be made faster by copying over the dst's per-row padding (for all | 275 may be made faster by copying over the dst's per-row padding (for all |
286 rows but the last). By setting preserveDstPad to true the caller can | 276 rows but the last). By setting preserveDstPad to true the caller can |
287 disable this optimization and ensure that pixels in the padding are not | 277 disable this optimization and ensure that pixels in the padding are not |
288 overwritten. | 278 overwritten. |
289 | 279 |
290 Always returns false for RLE formats. | 280 Always returns false for RLE formats. |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 | 828 |
839 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 829 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
840 SkASSERT(fPixels); | 830 SkASSERT(fPixels); |
841 SkASSERT(fConfig == kIndex8_Config); | 831 SkASSERT(fConfig == kIndex8_Config); |
842 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 832 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
843 SkASSERT(fColorTable); | 833 SkASSERT(fColorTable); |
844 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 834 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
845 } | 835 } |
846 | 836 |
847 #endif | 837 #endif |
OLD | NEW |