| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Finds a texture that approximately matches the descriptor. Will be at lea
st as large in width | 64 * Finds a texture that approximately matches the descriptor. Will be at lea
st as large in width |
| 65 * and height as desc specifies. If desc specifies that the texture should b
e a render target | 65 * and height as desc specifies. If desc specifies that the texture should b
e a render target |
| 66 * then result will be a render target. Format and sample count will always
match the request. | 66 * then result will be a render target. Format and sample count will always
match the request. |
| 67 * The contents of the texture are undefined. The caller owns a ref on the r
eturned texture and | 67 * The contents of the texture are undefined. The caller owns a ref on the r
eturned texture and |
| 68 * must balance with a call to unref. | 68 * must balance with a call to unref. |
| 69 */ | 69 */ |
| 70 GrTexture* createApproxTexture(const GrSurfaceDesc&); | 70 GrTexture* createApproxTexture(const GrSurfaceDesc&); |
| 71 | 71 |
| 72 enum SizeConstraint { |
| 73 kExact_SizeConstraint, |
| 74 kApprox_SizeConstraint, |
| 75 }; |
| 76 |
| 77 GrTexture* createTexture(const GrSurfaceDesc& desc, SizeConstraint constrain
t) { |
| 78 switch (constraint) { |
| 79 case kExact_SizeConstraint: |
| 80 return this->createTexture(desc, true); |
| 81 case kApprox_SizeConstraint: |
| 82 return this->createApproxTexture(desc); |
| 83 } |
| 84 sk_throw(); |
| 85 } |
| 86 |
| 72 /** Legacy function that no longer should be used. */ | 87 /** Legacy function that no longer should be used. */ |
| 73 enum ScratchTexMatch { | 88 enum ScratchTexMatch { |
| 74 kExact_ScratchTexMatch, | 89 kExact_ScratchTexMatch, |
| 75 kApprox_ScratchTexMatch | 90 kApprox_ScratchTexMatch |
| 76 }; | 91 }; |
| 77 GrTexture* refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch matc
h) { | 92 GrTexture* refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch matc
h) { |
| 78 if (kApprox_ScratchTexMatch == match) { | 93 if (kApprox_ScratchTexMatch == match) { |
| 79 return this->createApproxTexture(desc); | 94 return this->createApproxTexture(desc); |
| 80 } else { | 95 } else { |
| 81 return this->createTexture(desc, true); | 96 return this->createTexture(desc, true); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); | 171 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); |
| 157 return !SkToBool(fCache); | 172 return !SkToBool(fCache); |
| 158 } | 173 } |
| 159 | 174 |
| 160 private: | 175 private: |
| 161 GrResourceCache* fCache; | 176 GrResourceCache* fCache; |
| 162 GrGpu* fGpu; | 177 GrGpu* fGpu; |
| 163 }; | 178 }; |
| 164 | 179 |
| 165 #endif | 180 #endif |
| OLD | NEW |