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 22 matching lines...) Expand all Loading... |
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 immutable |
40 }; | 40 }; |
41 extern SkImage* SkNewImageFromRasterBitmap(const SkBitmap&, ForceCopyMode = kNo_
ForceCopyMode); | 41 extern SkImage* SkNewImageFromRasterBitmap(const SkBitmap&, ForceCopyMode = kNo_
ForceCopyMode); |
42 | 42 |
43 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) { | |
44 size_t minRB = info.minRowBytes(); | |
45 if (kIndex_8_SkColorType != info.colorType()) { | |
46 minRB = SkAlign4(minRB); | |
47 } | |
48 return minRB; | |
49 } | |
50 | |
51 // Given an image created from SkNewImageFromBitmap, return its pixelref. This | 43 // Given an image created from SkNewImageFromBitmap, return its pixelref. This |
52 // may be called to see if the surface and the image share the same pixelref, | 44 // may be called to see if the surface and the image share the same pixelref, |
53 // in which case the surface may need to perform a copy-on-write. | 45 // in which case the surface may need to perform a copy-on-write. |
54 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); | 46 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); |
55 | 47 |
56 // When a texture is shared by a surface and an image its budgeted status is tha
t of the | 48 // When a texture is shared by a surface and an image its budgeted status is tha
t of the |
57 // surface. This function is used when the surface makes a new texture for itsel
f in order | 49 // surface. This function is used when the surface makes a new texture for itsel
f in order |
58 // for the orphaned image to determine whether the original texture counts again
st the | 50 // for the orphaned image to determine whether the original texture counts again
st the |
59 // budget or not. | 51 // budget or not. |
60 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); | 52 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); |
61 | 53 |
62 // Update the texture wrapped by an image created with NewTexture. This | 54 // Update the texture wrapped by an image created with NewTexture. This |
63 // is called when a surface and image share the same GrTexture and the | 55 // is called when a surface and image share the same GrTexture and the |
64 // surface needs to perform a copy-on-write | 56 // surface needs to perform a copy-on-write |
65 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); | 57 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); |
66 | 58 |
67 GrTexture* GrDeepCopyTexture(GrTexture* src, bool isBudgeted); | 59 GrTexture* GrDeepCopyTexture(GrTexture* src, bool isBudgeted); |
68 | 60 |
69 #endif | 61 #endif |
OLD | NEW |