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

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 1221853003: Add SkSurface factory for wrapping an FBO in SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comment Created 5 years, 5 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/image/SkSurface.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "SkSurface_Gpu.h" 8 #include "SkSurface_Gpu.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S kImageInfo& info, 110 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S kImageInfo& info,
111 int sampleCount, const SkSurfaceProps* pro ps) { 111 int sampleCount, const SkSurfaceProps* pro ps) {
112 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props, 112 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props,
113 SkGpuDevice::kClear_Ini tContents)); 113 SkGpuDevice::kClear_Ini tContents));
114 if (!device) { 114 if (!device) {
115 return NULL; 115 return NULL;
116 } 116 }
117 return SkNEW_ARGS(SkSurface_Gpu, (device)); 117 return SkNEW_ARGS(SkSurface_Gpu, (device));
118 } 118 }
119 119
120 SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur eDesc desc, 120 SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendT extureDesc& desc,
121 const SkSurfaceProps* props) { 121 const SkSurfaceProps* props) {
122 if (NULL == context) { 122 if (NULL == context) {
123 return NULL; 123 return NULL;
124 } 124 }
125 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { 125 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
126 return NULL; 126 return NULL;
127 } 127 }
128 SkAutoTUnref<GrSurface> surface(context->textureProvider()->wrapBackendTextu re(desc, 128 SkAutoTUnref<GrSurface> surface(context->textureProvider()->wrapBackendTextu re(desc,
129 kBorrow_GrWrapOwnership)); 129 kBorrow_GrWrapOwnership));
130 if (!surface) { 130 if (!surface) {
131 return NULL; 131 return NULL;
132 } 132 }
133 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props, 133 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props,
134 SkGpuDevice::kUninit_In itContents)); 134 SkGpuDevice::kUninit_In itContents));
135 if (!device) { 135 if (!device) {
136 return NULL; 136 return NULL;
137 } 137 }
138 return SkNEW_ARGS(SkSurface_Gpu, (device)); 138 return SkNEW_ARGS(SkSurface_Gpu, (device));
139 } 139 }
140 140
141 SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext* context,
142 const GrBackendRenderTargetDesc & desc,
143 const SkSurfaceProps* props) {
144 if (NULL == context) {
145 return NULL;
146 }
147 SkAutoTUnref<GrRenderTarget> rt(context->textureProvider()->wrapBackendRende rTarget(desc));
148 if (!rt) {
149 return NULL;
150 }
151 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props,
152 SkGpuDevice::kUninit_In itContents));
153 if (!device) {
154 return NULL;
155 }
156 return SkNEW_ARGS(SkSurface_Gpu, (device));
157 }
158
141 #endif 159 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698