Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/gpu/GrTextureProxy.cpp

Issue 1937553002: Add Gr*Proxy classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix memory bugs Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrSurfaceProxy.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrTextureProxy.h"
9
10 #include "GrTextureProvider.h"
11 #include "GrGpuResourcePriv.h"
12
13 GrTextureProxy::GrTextureProxy(sk_sp<GrTexture> tex)
14 : INHERITED(tex->desc(), SkBackingFit::kExact, tex->resourcePriv().isBudgete d())
15 , fTexture(std::move(tex)) {
16 }
17
18 GrTexture* GrTextureProxy::instantiate(GrTextureProvider* texProvider) {
19 if (fTexture) {
20 return fTexture.get();
21 }
22
23 if (SkBackingFit::kApprox == fFit) {
24 fTexture.reset(texProvider->createApproxTexture(fDesc));
25 } else {
26 fTexture.reset(texProvider->createTexture(fDesc, fBudgeted));
27 }
28
29 return fTexture.get();
30 }
31
32 sk_sp<GrTextureProxy> GrTextureProxy::Make(const GrSurfaceDesc& desc,
33 SkBackingFit fit,
34 SkBudgeted budgeted,
35 const void* srcData,
36 size_t rowBytes) {
37 // TODO: handle 'srcData' (we could use the wrapped version if there is data )
38 SkASSERT(!srcData && !rowBytes);
39 return sk_sp<GrTextureProxy>(new GrTextureProxy(desc, fit, budgeted, srcData , rowBytes));
40 }
41
42 sk_sp<GrTextureProxy> GrTextureProxy::Make(sk_sp<GrTexture> tex) {
43 return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex)));
44 }
OLDNEW
« no previous file with comments | « src/gpu/GrSurfaceProxy.cpp ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698