| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrTextureProvider_DEFINED | 8 #ifndef GrTextureProvider_DEFINED |
| 9 #define GrTextureProvider_DEFINED | 9 #define GrTextureProvider_DEFINED |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 /////////////////////////////////////////////////////////////////////////// | 100 /////////////////////////////////////////////////////////////////////////// |
| 101 // Wrapped Backend Surfaces | 101 // Wrapped Backend Surfaces |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Wraps an existing texture with a GrTexture object. | 104 * Wraps an existing texture with a GrTexture object. |
| 105 * | 105 * |
| 106 * OpenGL: if the object is a texture Gr may change its GL texture params | 106 * OpenGL: if the object is a texture Gr may change its GL texture params |
| 107 * when it is drawn. | 107 * when it is drawn. |
| 108 * | 108 * |
| 109 * @param desc description of the object to create. | |
| 110 * | |
| 111 * @return GrTexture object or NULL on failure. | 109 * @return GrTexture object or NULL on failure. |
| 112 */ | 110 */ |
| 113 GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc); | 111 GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwners
hip); |
| 114 | 112 |
| 115 /** | 113 /** |
| 116 * Wraps an existing render target with a GrRenderTarget object. It is | 114 * Wraps an existing render target with a GrRenderTarget object. It is |
| 117 * similar to wrapBackendTexture but can be used to draw into surfaces | 115 * similar to wrapBackendTexture but can be used to draw into surfaces |
| 118 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that | 116 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that |
| 119 * the client will resolve to a texture). | 117 * the client will resolve to a texture). |
| 120 * | 118 * |
| 121 * @param desc description of the object to create. | |
| 122 * | |
| 123 * @return GrTexture object or NULL on failure. | 119 * @return GrTexture object or NULL on failure. |
| 124 */ | 120 */ |
| 125 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de
sc); | 121 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de
sc, |
| 122 GrWrapOwnership); |
| 126 | 123 |
| 127 protected: | 124 protected: |
| 128 GrTextureProvider(GrGpu* gpu, GrResourceCache* cache) : fCache(cache), fGpu(
gpu) {} | 125 GrTextureProvider(GrGpu* gpu, GrResourceCache* cache) : fCache(cache), fGpu(
gpu) {} |
| 129 | 126 |
| 130 /** | 127 /** |
| 131 * Assigns a unique key to a resource. If the key is associated with another
resource that | 128 * Assigns a unique key to a resource. If the key is associated with another
resource that |
| 132 * association is removed and replaced by this resource. | 129 * association is removed and replaced by this resource. |
| 133 */ | 130 */ |
| 134 void assignUniqueKeyToResource(const GrUniqueKey&, GrGpuResource*); | 131 void assignUniqueKeyToResource(const GrUniqueKey&, GrGpuResource*); |
| 135 | 132 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 164 bool isAbandoned() const { | 161 bool isAbandoned() const { |
| 165 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); | 162 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); |
| 166 return !SkToBool(fCache); | 163 return !SkToBool(fCache); |
| 167 } | 164 } |
| 168 | 165 |
| 169 GrResourceCache* fCache; | 166 GrResourceCache* fCache; |
| 170 GrGpu* fGpu; | 167 GrGpu* fGpu; |
| 171 }; | 168 }; |
| 172 | 169 |
| 173 #endif | 170 #endif |
| OLD | NEW |