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 25 matching lines...) Expand all Loading... |
36 texture->resourcePriv().makeUnbudgeted(); | 36 texture->resourcePriv().makeUnbudgeted(); |
37 } | 37 } |
38 return texture; | 38 return texture; |
39 } | 39 } |
40 texture->unref(); | 40 texture->unref(); |
41 } | 41 } |
42 } | 42 } |
43 return fGpu->createTexture(desc, budgeted, srcData, rowBytes); | 43 return fGpu->createTexture(desc, budgeted, srcData, rowBytes); |
44 } | 44 } |
45 | 45 |
| 46 GrTexture* GrTextureProvider::createMipmappedTexture(const GrSurfaceDesc& desc,
bool budgeted, |
| 47 const SkMipMap& srcData) { |
| 48 if (this->isAbandoned()) { |
| 49 return NULL; |
| 50 } |
| 51 if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) && |
| 52 !fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 53 return NULL; |
| 54 } |
| 55 |
| 56 return fGpu->createMipmappedTexture(desc, budgeted, srcData); |
| 57 } |
| 58 |
46 GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, Scrat
chTexMatch match, | 59 GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, Scrat
chTexMatch match, |
47 bool calledDuringFlush) { | 60 bool calledDuringFlush) { |
48 if (this->isAbandoned()) { | 61 if (this->isAbandoned()) { |
49 return NULL; | 62 return NULL; |
50 } | 63 } |
51 // Currently we don't recycle compressed textures as scratch. | 64 // Currently we don't recycle compressed textures as scratch. |
52 if (GrPixelConfigIsCompressed(desc.fConfig)) { | 65 if (GrPixelConfigIsCompressed(desc.fConfig)) { |
53 return NULL; | 66 return NULL; |
54 } else { | 67 } else { |
55 uint32_t flags = 0; | 68 uint32_t flags = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 resource->resourcePriv().setUniqueKey(key); | 140 resource->resourcePriv().setUniqueKey(key); |
128 } | 141 } |
129 | 142 |
130 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons
t { | 143 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons
t { |
131 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); | 144 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); |
132 } | 145 } |
133 | 146 |
134 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe
y& key) { | 147 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe
y& key) { |
135 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); | 148 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); |
136 } | 149 } |
OLD | NEW |