| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #include "GrTextureProxy.h" | 8 #include "GrTextureProxy.h" |
| 9 | 9 |
| 10 #include "GrTextureProvider.h" | 10 #include "GrTextureProvider.h" |
| 11 #include "GrGpuResourcePriv.h" | 11 #include "GrGpuResourcePriv.h" |
| 12 | 12 |
| 13 GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, S
kBudgeted budgeted, |
| 14 const void* /*srcData*/, size_t /*rowBytes*/) |
| 15 : INHERITED(srcDesc, fit, budgeted) { |
| 16 // TODO: Handle 'srcData' here |
| 17 } |
| 18 |
| 13 GrTextureProxy::GrTextureProxy(sk_sp<GrTexture> tex) | 19 GrTextureProxy::GrTextureProxy(sk_sp<GrTexture> tex) |
| 14 : INHERITED(tex->desc(), SkBackingFit::kExact, tex->resourcePriv().isBudgete
d()) | 20 : INHERITED(tex->desc(), SkBackingFit::kExact, |
| 21 tex->resourcePriv().isBudgeted(), tex->uniqueID()) |
| 15 , fTexture(std::move(tex)) { | 22 , fTexture(std::move(tex)) { |
| 16 } | 23 } |
| 17 | 24 |
| 18 GrTexture* GrTextureProxy::instantiate(GrTextureProvider* texProvider) { | 25 GrTexture* GrTextureProxy::instantiate(GrTextureProvider* texProvider) { |
| 19 if (fTexture) { | 26 if (fTexture) { |
| 20 return fTexture.get(); | 27 return fTexture.get(); |
| 21 } | 28 } |
| 22 | 29 |
| 23 if (SkBackingFit::kApprox == fFit) { | 30 if (SkBackingFit::kApprox == fFit) { |
| 24 fTexture.reset(texProvider->createApproxTexture(fDesc)); | 31 fTexture.reset(texProvider->createApproxTexture(fDesc)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 const void* srcData, | 42 const void* srcData, |
| 36 size_t rowBytes) { | 43 size_t rowBytes) { |
| 37 // TODO: handle 'srcData' (we could use the wrapped version if there is data
) | 44 // TODO: handle 'srcData' (we could use the wrapped version if there is data
) |
| 38 SkASSERT(!srcData && !rowBytes); | 45 SkASSERT(!srcData && !rowBytes); |
| 39 return sk_sp<GrTextureProxy>(new GrTextureProxy(desc, fit, budgeted, srcData
, rowBytes)); | 46 return sk_sp<GrTextureProxy>(new GrTextureProxy(desc, fit, budgeted, srcData
, rowBytes)); |
| 40 } | 47 } |
| 41 | 48 |
| 42 sk_sp<GrTextureProxy> GrTextureProxy::Make(sk_sp<GrTexture> tex) { | 49 sk_sp<GrTextureProxy> GrTextureProxy::Make(sk_sp<GrTexture> tex) { |
| 43 return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex))); | 50 return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex))); |
| 44 } | 51 } |
| OLD | NEW |