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

Side by Side Diff: tools/vulkan/Window.cpp

Issue 1848833005: First pass at VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments, plus add GM rendering Created 4 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
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 "Window.h"
9
10 #include "SkSurface.h"
11 #include "SkCanvas.h"
12 #include "VulkanTestContext.h"
13
14 static bool default_key_func(int key, bool down, void* userData) {
15 return false;
16 }
17
18 static bool default_mouse_func(int x, int y, bool down, void* userData) {
19 return false;
20 }
21
22 static void default_paint_func(SkCanvas*, void* userData) {}
23
24 Window::Window() : fKeyFunc(default_key_func)
25 , fMouseFunc(default_mouse_func)
26 , fPaintFunc(default_paint_func) {
27 }
28
29 void Window::detach() {
30 delete fTestContext;
31 fTestContext = nullptr;
32 }
33
34 void Window::onPaint() {
35 SkSurface* backbuffer = fTestContext->getBackbufferSurface();
36 if (backbuffer) {
37 // draw into the canvas of this surface
38 SkCanvas* canvas = backbuffer->getCanvas();
39
40 fPaintFunc(canvas, fPaintUserData);
41
42 canvas->flush();
43
44 fTestContext->swapBuffers();
45 }
46
47 }
48
49
50 void Window::onSize() {
51 fTestContext->resize();
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698