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

Side by Side Diff: tools/viewer/sk_app/Window.cpp

Issue 1978573003: Add OpenGL context to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase to ToT 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 | « tools/viewer/sk_app/Window.h ('k') | tools/viewer/sk_app/WindowContext.h » ('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 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 "Window.h" 8 #include "Window.h"
9 9
10 #include "SkSurface.h" 10 #include "SkSurface.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 bool Window::onMouse(int x, int y, InputState state, uint32_t modifiers) { 57 bool Window::onMouse(int x, int y, InputState state, uint32_t modifiers) {
58 return fMouseFunc(x, y, state, modifiers, fMouseUserData); 58 return fMouseFunc(x, y, state, modifiers, fMouseUserData);
59 } 59 }
60 60
61 bool Window::onTouch(int owner, InputState state, float x, float y) { 61 bool Window::onTouch(int owner, InputState state, float x, float y) {
62 return fTouchFunc(owner, state, x, y, fTouchUserData); 62 return fTouchFunc(owner, state, x, y, fTouchUserData);
63 } 63 }
64 64
65 void Window::onPaint() { 65 void Window::onPaint() {
66 SkSurface* backbuffer = fWindowContext->getBackbufferSurface(); 66 sk_sp<SkSurface> backbuffer = fWindowContext->getBackbufferSurface();
67 if (backbuffer) { 67 if (backbuffer) {
68 // draw into the canvas of this surface 68 // draw into the canvas of this surface
69 SkCanvas* canvas = backbuffer->getCanvas(); 69 SkCanvas* canvas = backbuffer->getCanvas();
70 70
71 fPaintFunc(canvas, fPaintUserData); 71 fPaintFunc(canvas, fPaintUserData);
72 72
73 canvas->flush(); 73 canvas->flush();
74 74
75 fWindowContext->swapBuffers(); 75 fWindowContext->swapBuffers();
76 } else { 76 } else {
77 // try recreating testcontext 77 // try recreating testcontext
78 } 78 }
79
80 } 79 }
81 80
82 void Window::onResize(uint32_t w, uint32_t h) { 81 void Window::onResize(uint32_t w, uint32_t h) {
83 fWidth = w; 82 fWidth = w;
84 fHeight = h; 83 fHeight = h;
85 fWindowContext->resize(w, h); 84 fWindowContext->resize(w, h);
86 } 85 }
87 86
88 const DisplayParams& Window::getDisplayParams() { 87 const DisplayParams& Window::getDisplayParams() {
89 return fWindowContext->getDisplayParams(); 88 return fWindowContext->getDisplayParams();
90 } 89 }
91 90
92 void Window::setDisplayParams(const DisplayParams& params) { 91 void Window::setDisplayParams(const DisplayParams& params) {
93 fWindowContext->setDisplayParams(params); 92 fWindowContext->setDisplayParams(params);
94 } 93 }
95 94
96 } // namespace sk_app 95 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/Window.h ('k') | tools/viewer/sk_app/WindowContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698