Chromium Code Reviews| 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 #include "SkSurface.h" |
| 13 | 13 |
| 14 // 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 |
| 15 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, | 15 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, |
| 16 const SkIPoint& pixelRefOrigin, | 16 const SkIPoint& pixelRefOrigin, |
| 17 size_t rowBytes, | 17 size_t rowBytes, |
| 18 const SkSurfaceProps*); | 18 const SkSurfaceProps*); |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Examines the bitmap to decide if it can share the existing pixelRef, or | 21 * Examines the bitmap to decide if it can share the existing pixelRef, or |
| 22 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will | 22 * if it needs to make a deep-copy of the pixels. The bitmap's pixelref will |
| 23 * be shared if either the bitmap is marked as immutable, or canSharePixelRef | 23 * be shared if either the bitmap is marked as immutable, or canSharePixelRef |
| 24 * is true. | 24 * is true. |
| 25 * | 25 * |
| 26 * If the bitmap's colortype cannot be converted into a corresponding | 26 * If the bitmap's colortype cannot be converted into a corresponding |
| 27 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return | 27 * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return |
| 28 * NULL. | 28 * NULL. |
| 29 */ | 29 */ |
|
robertphillips
2015/07/06 20:43:47
Why Raster when it can be GPU backed ?
reed2
2015/07/07 01:18:03
This is part of the cascade of dissecting a generi
| |
| 30 extern SkImage* SkNewImageFromBitmap(const SkBitmap&, bool canSharePixelRef, con st SkSurfaceProps*); | 30 extern SkImage* SkNewImageFromRasterBitmap(const SkBitmap&, bool forceSharePixel Ref, |
| 31 const SkSurfaceProps*); | |
| 31 | 32 |
| 32 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) { | 33 static inline size_t SkImageMinRowBytes(const SkImageInfo& info) { |
| 33 size_t minRB = info.minRowBytes(); | 34 size_t minRB = info.minRowBytes(); |
| 34 if (kIndex_8_SkColorType != info.colorType()) { | 35 if (kIndex_8_SkColorType != info.colorType()) { |
| 35 minRB = SkAlign4(minRB); | 36 minRB = SkAlign4(minRB); |
| 36 } | 37 } |
| 37 return minRB; | 38 return minRB; |
| 38 } | 39 } |
| 39 | 40 |
| 40 // Given an image created from SkNewImageFromBitmap, return its pixelref. This | 41 // Given an image created from SkNewImageFromBitmap, return its pixelref. This |
| 41 // may be called to see if the surface and the image share the same pixelref, | 42 // may be called to see if the surface and the image share the same pixelref, |
| 42 // in which case the surface may need to perform a copy-on-write. | 43 // in which case the surface may need to perform a copy-on-write. |
| 43 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); | 44 extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage); |
| 44 | 45 |
| 45 // When a texture is shared by a surface and an image its budgeted status is tha t of the | 46 // When a texture is shared by a surface and an image its budgeted status is tha t of the |
| 46 // surface. This function is used when the surface makes a new texture for itsel f in order | 47 // surface. This function is used when the surface makes a new texture for itsel f in order |
| 47 // for the orphaned image to determine whether the original texture counts again st the | 48 // for the orphaned image to determine whether the original texture counts again st the |
| 48 // budget or not. | 49 // budget or not. |
| 49 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); | 50 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); |
| 50 | 51 |
| 51 // Update the texture wrapped by an image created with NewTexture. This | 52 // Update the texture wrapped by an image created with NewTexture. This |
| 52 // is called when a surface and image share the same GrTexture and the | 53 // is called when a surface and image share the same GrTexture and the |
| 53 // surface needs to perform a copy-on-write | 54 // surface needs to perform a copy-on-write |
| 54 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); | 55 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); |
| 55 | 56 |
| 57 GrTexture* GrDeepCopyTexture(GrTexture* src, bool isBudgeted); | |
| 58 | |
| 56 #endif | 59 #endif |
| OLD | NEW |