OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
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 SkImagePriv_DEFINED | 8 #ifndef SkImagePriv_DEFINED |
9 #define SkImagePriv_DEFINED | 9 #define SkImagePriv_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 * they exist on the pixelref. | 29 * they exist on the pixelref. |
30 * | 30 * |
31 * It is illegal to call this with a texture-backed bitmap. | 31 * It is illegal to call this with a texture-backed bitmap. |
32 * | 32 * |
33 * If the bitmap's colortype cannot be converted into a corresponding | 33 * If the bitmap's colortype cannot be converted into a corresponding |
34 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return | 34 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return |
35 * nullptr. | 35 * nullptr. |
36 */ | 36 */ |
37 enum ForceCopyMode { | 37 enum ForceCopyMode { |
38 kNo_ForceCopyMode, | 38 kNo_ForceCopyMode, |
39 kYes_ForceCopyMode, // must copy the pixels even if the bitmap is immutable | 39 kYes_ForceCopyMode, // must copy the pixels even if the bitmap is immuta
ble |
| 40 kNever_ForceCopyMode, // don't ever copy, even if the bitmap is mutable |
40 }; | 41 }; |
41 extern sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap&, | 42 extern sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap&, |
42 ForceCopyMode = kNo_ForceCopyM
ode); | 43 ForceCopyMode = kNo_ForceCopyM
ode); |
43 | 44 |
44 // Given an image created from SkNewImageFromBitmap, return its pixelref. This | 45 // Given an image created from SkNewImageFromBitmap, return its pixelref. This |
45 // may be called to see if the surface and the image share the same pixelref, | 46 // may be called to see if the surface and the image share the same pixelref, |
46 // in which case the surface may need to perform a copy-on-write. | 47 // in which case the surface may need to perform a copy-on-write. |
47 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); | 48 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); |
48 | 49 |
49 // When a texture is shared by a surface and an image its budgeted status is tha
t of the | 50 // When a texture is shared by a surface and an image its budgeted status is tha
t of the |
50 // surface. This function is used when the surface makes a new texture for itsel
f in order | 51 // surface. This function is used when the surface makes a new texture for itsel
f in order |
51 // for the orphaned image to determine whether the original texture counts again
st the | 52 // for the orphaned image to determine whether the original texture counts again
st the |
52 // budget or not. | 53 // budget or not. |
53 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); | 54 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); |
54 | 55 |
55 // Update the texture wrapped by an image created with NewTexture. This | 56 // Update the texture wrapped by an image created with NewTexture. This |
56 // is called when a surface and image share the same GrTexture and the | 57 // is called when a surface and image share the same GrTexture and the |
57 // surface needs to perform a copy-on-write | 58 // surface needs to perform a copy-on-write |
58 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); | 59 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); |
59 | 60 |
60 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted); | 61 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted); |
61 | 62 |
62 #endif | 63 #endif |
OLD | NEW |