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

Side by Side Diff: example/SkiaSDLExample.cpp

Issue 2198433003: Remove some ancillary users of SkSurface::MakeRenderTargetDirect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « debugger/QT/SkGLWidget.cpp ('k') | experimental/SkV8Example/SkV8Example.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 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 8
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "SDL.h" 10 #include "SDL.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 GrBackendRenderTargetDesc desc; 199 GrBackendRenderTargetDesc desc;
200 desc.fWidth = dm.w; 200 desc.fWidth = dm.w;
201 desc.fHeight = dm.h; 201 desc.fHeight = dm.h;
202 desc.fConfig = kSkia8888_GrPixelConfig; 202 desc.fConfig = kSkia8888_GrPixelConfig;
203 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; 203 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
204 desc.fSampleCnt = kMsaaSampleCount; 204 desc.fSampleCnt = kMsaaSampleCount;
205 desc.fStencilBits = kStencilBits; 205 desc.fStencilBits = kStencilBits;
206 GrGLint buffer; 206 GrGLint buffer;
207 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); 207 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
208 desc.fRenderTargetHandle = buffer; 208 desc.fRenderTargetHandle = buffer;
209 SkAutoTUnref<GrRenderTarget>
210 renderTarget(grContext->textureProvider()->wrapBackendRenderTarget(d esc));
211 209
212 // setup SkSurface 210 // setup SkSurface
213 // To use distance field text, use commented out SkSurfaceProps instead 211 // To use distance field text, use commented out SkSurfaceProps instead
214 // SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, 212 // SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
215 // SkSurfaceProps::kLegacyFontHost_InitType); 213 // SkSurfaceProps::kLegacyFontHost_InitType);
216 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); 214 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
217 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(renderTarge t, &props)); 215
216 sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(grContext, d esc, &props));
218 217
219 SkCanvas* canvas = surface->getCanvas(); 218 SkCanvas* canvas = surface->getCanvas();
220 219
221 ApplicationState state; 220 ApplicationState state;
222 221
223 const char* helpMessage = "Click and drag to create rects. Press esc to qui t."; 222 const char* helpMessage = "Click and drag to create rects. Press esc to qui t.";
224 223
225 SkPaint paint; 224 SkPaint paint;
226 225
227 // create a surface for CPU rasterization 226 // create a surface for CPU rasterization
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 SDL_GL_DeleteContext(glContext); 263 SDL_GL_DeleteContext(glContext);
265 } 264 }
266 265
267 //Destroy window 266 //Destroy window
268 SDL_DestroyWindow(window); 267 SDL_DestroyWindow(window);
269 268
270 //Quit SDL subsystems 269 //Quit SDL subsystems
271 SDL_Quit(); 270 SDL_Quit();
272 return 0; 271 return 0;
273 } 272 }
OLDNEW
« no previous file with comments | « debugger/QT/SkGLWidget.cpp ('k') | experimental/SkV8Example/SkV8Example.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698