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

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

Issue 1071603002: Add helper for creating a SkSurface from a client created texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment style Created 5 years, 8 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S kImageInfo& info, 92 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S kImageInfo& info,
93 int sampleCount, const SkSurfaceProps* pro ps) { 93 int sampleCount, const SkSurfaceProps* pro ps) {
94 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props, 94 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props,
95 SkGpuDevice::kNeedClear _Flag)); 95 SkGpuDevice::kNeedClear _Flag));
96 if (!device) { 96 if (!device) {
97 return NULL; 97 return NULL;
98 } 98 }
99 return SkNEW_ARGS(SkSurface_Gpu, (device)); 99 return SkNEW_ARGS(SkSurface_Gpu, (device));
100 } 100 }
101 101
102 SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur eDesc desc,
103 const SkSurfaceProps* props) {
104 if (NULL == context) {
105 return NULL;
106 }
107 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
108 return NULL;
109 }
110 SkAutoTUnref<GrSurface> surface(context->wrapBackendTexture(desc));
111 if (!surface) {
112 return NULL;
113 }
114 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props,
115 SkGpuDevice::kNeedClear _Flag));
116 if (!device) {
117 return NULL;
118 }
119 return SkNEW_ARGS(SkSurface_Gpu, (device));
120 }
121
102 #endif 122 #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