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 |
271 /** Copies the bitmap's pixels to the location pointed at by dst and returns | 281 /** Copies the bitmap's pixels to the location pointed at by dst and returns |
272 true if possible, returns false otherwise. | 282 true if possible, returns false otherwise. |
273 | 283 |
274 In the case when the dstRowBytes matches the bitmap's rowBytes, the copy | 284 In the case when the dstRowBytes matches the bitmap's rowBytes, the copy |
275 may be made faster by copying over the dst's per-row padding (for all | 285 may be made faster by copying over the dst's per-row padding (for all |
276 rows but the last). By setting preserveDstPad to true the caller can | 286 rows but the last). By setting preserveDstPad to true the caller can |
277 disable this optimization and ensure that pixels in the padding are not | 287 disable this optimization and ensure that pixels in the padding are not |
278 overwritten. | 288 overwritten. |
279 | 289 |
280 Always returns false for RLE formats. | 290 Always returns false for RLE formats. |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 | 838 |
829 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 839 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
830 SkASSERT(fPixels); | 840 SkASSERT(fPixels); |
831 SkASSERT(fConfig == kIndex8_Config); | 841 SkASSERT(fConfig == kIndex8_Config); |
832 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 842 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
833 SkASSERT(fColorTable); | 843 SkASSERT(fColorTable); |
834 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 844 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
835 } | 845 } |
836 | 846 |
837 #endif | 847 #endif |
OLD | NEW |