| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // surface. This function is used when the surface makes a new texture for itsel
f in order | 68 // surface. This function is used when the surface makes a new texture for itsel
f in order |
| 69 // for the orphaned image to determine whether the original texture counts again
st the | 69 // for the orphaned image to determine whether the original texture counts again
st the |
| 70 // budget or not. | 70 // budget or not. |
| 71 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); | 71 extern void SkTextureImageApplyBudgetedDecision(SkImage* textureImage); |
| 72 | 72 |
| 73 // Update the texture wrapped by an image created with NewTexture. This | 73 // Update the texture wrapped by an image created with NewTexture. This |
| 74 // is called when a surface and image share the same GrTexture and the | 74 // is called when a surface and image share the same GrTexture and the |
| 75 // surface needs to perform a copy-on-write | 75 // surface needs to perform a copy-on-write |
| 76 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); | 76 extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture); |
| 77 | 77 |
| 78 GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted); | |
| 79 | |
| 80 /** | 78 /** |
| 81 * Will attempt to upload and lock the contents of the image as a texture, so t
hat subsequent | 79 * Will attempt to upload and lock the contents of the image as a texture, so t
hat subsequent |
| 82 * draws to a gpu-target will come from that texture (and not by looking at the
original image | 80 * draws to a gpu-target will come from that texture (and not by looking at the
original image |
| 83 * src). In particular this is intended to use the texture even if the image's
original content | 81 * src). In particular this is intended to use the texture even if the image's
original content |
| 84 * changes subsequent to this call (i.e. the src is mutable!). | 82 * changes subsequent to this call (i.e. the src is mutable!). |
| 85 * | 83 * |
| 86 * This must be balanced by an equal number of calls to SkImage_unpinAsTexture(
) -- calls can be | 84 * This must be balanced by an equal number of calls to SkImage_unpinAsTexture(
) -- calls can be |
| 87 * nested. | 85 * nested. |
| 88 * | 86 * |
| 89 * Once in this "pinned" state, the image has all of the same thread restrictio
ns that exist | 87 * Once in this "pinned" state, the image has all of the same thread restrictio
ns that exist |
| 90 * for a natively created gpu image (e.g. SkImage::MakeFromTexture) | 88 * for a natively created gpu image (e.g. SkImage::MakeFromTexture) |
| 91 * - all drawing, pinning, unpinning must happen in the same thread as the GrCo
ntext. | 89 * - all drawing, pinning, unpinning must happen in the same thread as the GrCo
ntext. |
| 92 */ | 90 */ |
| 93 void SkImage_pinAsTexture(const SkImage*, GrContext*); | 91 void SkImage_pinAsTexture(const SkImage*, GrContext*); |
| 94 | 92 |
| 95 /** | 93 /** |
| 96 * The balancing call to SkImage_pinAsTexture. When a balanced number of calls
have been made, then | 94 * The balancing call to SkImage_pinAsTexture. When a balanced number of calls
have been made, then |
| 97 * the "pinned" texture is free to be purged, etc. This also means that a subse
quent "pin" call | 95 * the "pinned" texture is free to be purged, etc. This also means that a subse
quent "pin" call |
| 98 * will look at the original content again, and if its uniqueID/generationID ha
s changed, then | 96 * will look at the original content again, and if its uniqueID/generationID ha
s changed, then |
| 99 * a newer texture will be uploaded/pinned. | 97 * a newer texture will be uploaded/pinned. |
| 100 * | 98 * |
| 101 * The context passed to unpin must match the one passed to pin. | 99 * The context passed to unpin must match the one passed to pin. |
| 102 */ | 100 */ |
| 103 void SkImage_unpinAsTexture(const SkImage*, GrContext*); | 101 void SkImage_unpinAsTexture(const SkImage*, GrContext*); |
| 104 | 102 |
| 105 #endif | 103 #endif |
| OLD | NEW |