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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 306 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
307 if (isOpaque) { | 307 if (isOpaque) { |
308 info.fAlphaType = kOpaque_SkAlphaType; | 308 info.fAlphaType = kOpaque_SkAlphaType; |
309 } | 309 } |
310 return this->allocPixels(info); | 310 return this->allocPixels(info); |
311 } | 311 } |
312 | 312 |
313 /** | 313 /** |
314 * Install a pixelref that wraps the specified pixels and rowBytes, and | 314 * Install a pixelref that wraps the specified pixels and rowBytes, and |
315 * optional ReleaseProc and context. When the pixels are no longer | 315 * optional ReleaseProc and context. When the pixels are no longer |
316 * referenced, if ReleaseProc is not null, it will be called with the | 316 * referenced, if releaseProc is not null, it will be called with the |
317 * pixels and context as parameters. | 317 * pixels and context as parameters. |
318 * On failure, the bitmap will be set to empty and return false. | 318 * On failure, the bitmap will be set to empty and return false. |
319 */ | 319 */ |
320 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, | 320 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, SkColo
rTable*, |
321 void (*ReleaseProc)(void* addr, void* context), | 321 void (*releaseProc)(void* addr, void* context), void* con
text); |
322 void* context); | 322 |
| 323 #ifdef SK_SUPPORT_LEGACY_INSTALLPIXELSPARAMS |
| 324 bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, |
| 325 void (*releaseProc)(void* addr, void* context), |
| 326 void* context) { |
| 327 return this->installPixels(info, pixels, rowBytes, NULL, releaseProc, co
ntext); |
| 328 } |
| 329 #endif |
323 | 330 |
324 /** | 331 /** |
325 * Call installPixels with no ReleaseProc specified. This means that the | 332 * Call installPixels with no ReleaseProc specified. This means that the |
326 * caller must ensure that the specified pixels are valid for the lifetime | 333 * caller must ensure that the specified pixels are valid for the lifetime |
327 * of the created bitmap (and its pixelRef). | 334 * of the created bitmap (and its pixelRef). |
328 */ | 335 */ |
329 bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { | 336 bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { |
330 return this->installPixels(info, pixels, rowBytes, NULL, NULL); | 337 return this->installPixels(info, pixels, rowBytes, NULL, NULL, NULL); |
331 } | 338 } |
332 | 339 |
333 /** | 340 /** |
334 * Calls installPixels() with the value in the SkMask. The caller must | 341 * Calls installPixels() with the value in the SkMask. The caller must |
335 * ensure that the specified mask pixels are valid for the lifetime | 342 * ensure that the specified mask pixels are valid for the lifetime |
336 * of the created bitmap (and its pixelRef). | 343 * of the created bitmap (and its pixelRef). |
337 */ | 344 */ |
338 bool installMaskPixels(const SkMask&); | 345 bool installMaskPixels(const SkMask&); |
339 | 346 |
340 /** Use this to assign a new pixel address for an existing bitmap. This | 347 /** Use this to assign a new pixel address for an existing bitmap. This |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } | 906 } |
900 | 907 |
901 /////////////////////////////////////////////////////////////////////////////// | 908 /////////////////////////////////////////////////////////////////////////////// |
902 // | 909 // |
903 // Helpers until we can fully deprecate SkBitmap::Config | 910 // Helpers until we can fully deprecate SkBitmap::Config |
904 // | 911 // |
905 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); | 912 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); |
906 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); | 913 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); |
907 | 914 |
908 #endif | 915 #endif |
OLD | NEW |