| 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 |
| 11 #include "SkImage.h" | 11 #include "SkImage.h" |
| 12 #include "SkSurface.h" |
| 12 | 13 |
| 13 // Call this if you explicitly want to use/share this pixelRef in the image | 14 // Call this if you explicitly want to use/share this pixelRef in the image |
| 14 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, size_t r
owBytes, | 15 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, size_t r
owBytes, |
| 15 const SkSurfaceProps*); | 16 const SkSurfaceProps*); |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Examines the bitmap to decide if it can share the existing pixelRef, or | 19 * Examines the bitmap to decide if it can share the existing pixelRef, or |
| 19 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will | 20 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will |
| 20 * be shared if either the bitmap is marked as immutable, or canSharePixelRef | 21 * be shared if either the bitmap is marked as immutable, or canSharePixelRef |
| 21 * is true. | 22 * is true. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 // Given an image created from SkNewImageFromBitmap, return its pixelref. This | 34 // Given an image created from SkNewImageFromBitmap, return its pixelref. This |
| 34 // may be called to see if the surface and the image share the same pixelref, | 35 // may be called to see if the surface and the image share the same pixelref, |
| 35 // in which case the surface may need to perform a copy-on-write. | 36 // in which case the surface may need to perform a copy-on-write. |
| 36 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); | 37 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); |
| 37 | 38 |
| 38 // Given an image created with NewTexture, return its GrTexture. This | 39 // Given an image created with NewTexture, return its GrTexture. This |
| 39 // may be called to see if the surface and the image share the same GrTexture, | 40 // may be called to see if the surface and the image share the same GrTexture, |
| 40 // in which case the surface may need to perform a copy-on-write. | 41 // in which case the surface may need to perform a copy-on-write. |
| 41 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage); | 42 extern GrTexture* SkTextureImageGetTexture(SkImage* textureImage); |
| 42 | 43 |
| 44 // When a texture is shared by a surface and an image its budgeted status is tha
t of the |
| 45 // surface. This function is used when the surface makes a new texture for itsel
f in order |
| 46 // for the orphaned image to determine whether the original texture counts again
st the |
| 47 // budget or not. |
| 48 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); |
| 49 |
| 43 // Update the texture wrapped by an image created with NewTexture. This | 50 // Update the texture wrapped by an image created with NewTexture. This |
| 44 // is called when a surface and image share the same GrTexture and the | 51 // is called when a surface and image share the same GrTexture and the |
| 45 // surface needs to perform a copy-on-write | 52 // surface needs to perform a copy-on-write |
| 46 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); | 53 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); |
| 47 | 54 |
| 48 extern SkImage* SkNewImageFromBitmapTexture(const SkBitmap&, int sampleCountForN
ewSurfaces); | 55 extern SkImage* SkNewImageFromBitmapTexture(const SkBitmap&, int sampleCountForN
ewSurfaces, |
| 56 SkSurface::Budgeted); |
| 49 | 57 |
| 50 #endif | 58 #endif |
| OLD | NEW |