| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrTextureProvider.h" | 9 #include "GrTextureProvider.h" |
| 10 #include "GrTexturePriv.h" | 10 #include "GrTexturePriv.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 if (!(kNoCreate_ScratchTextureFlag & flags)) { | 103 if (!(kNoCreate_ScratchTextureFlag & flags)) { |
| 104 return fGpu->createTexture(*desc, true, NULL, 0); | 104 return fGpu->createTexture(*desc, true, NULL, 0); |
| 105 } | 105 } |
| 106 | 106 |
| 107 return NULL; | 107 return NULL; |
| 108 } | 108 } |
| 109 | 109 |
| 110 GrTexture* GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& des
c) { | 110 GrTexture* GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& des
c, |
| 111 GrWrapOwnership ownership) { |
| 111 if (this->isAbandoned()) { | 112 if (this->isAbandoned()) { |
| 112 return NULL; | 113 return NULL; |
| 113 } | 114 } |
| 114 return fGpu->wrapBackendTexture(desc); | 115 return fGpu->wrapBackendTexture(desc, ownership); |
| 115 } | 116 } |
| 116 | 117 |
| 117 GrRenderTarget* GrTextureProvider::wrapBackendRenderTarget(const GrBackendRender
TargetDesc& desc) { | 118 GrRenderTarget* GrTextureProvider::wrapBackendRenderTarget(const GrBackendRender
TargetDesc& desc) { |
| 118 return this->isAbandoned() ? NULL : fGpu->wrapBackendRenderTarget(desc); | 119 return this->isAbandoned() ? NULL : fGpu->wrapBackendRenderTarget(desc, |
| 120 kBorrow_Gr
WrapOwnership); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void GrTextureProvider::assignUniqueKeyToResource(const GrUniqueKey& key, GrGpuR
esource* resource) { | 123 void GrTextureProvider::assignUniqueKeyToResource(const GrUniqueKey& key, GrGpuR
esource* resource) { |
| 122 if (this->isAbandoned() || !resource) { | 124 if (this->isAbandoned() || !resource) { |
| 123 return; | 125 return; |
| 124 } | 126 } |
| 125 resource->resourcePriv().setUniqueKey(key); | 127 resource->resourcePriv().setUniqueKey(key); |
| 126 } | 128 } |
| 127 | 129 |
| 128 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons
t { | 130 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons
t { |
| 129 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); | 131 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); |
| 130 } | 132 } |
| 131 | 133 |
| 132 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe
y& key) { | 134 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe
y& key) { |
| 133 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); | 135 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); |
| 134 } | 136 } |
| OLD | NEW |