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

Side by Side Diff: media/tools/shader_bench/window_linux.cc

Issue 4873002: Benchmark tool for GPU-accelerated video rendering (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up Window/Painter interface a little Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/tools/shader_bench/window.h"
6
7 #include <gdk/gdkx.h>
8 #include <gtk/gtk.h>
9
10 #include "base/utf_string_conversions.h"
11
12 namespace {
13
14 gboolean OnDelete(GtkWidget* widget, GdkEventExpose* event) {
15 gtk_main_quit();
16 return FALSE;
17 }
18
19 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event, gpointer data) {
20 Painter* painter = reinterpret_cast<Painter*>(data);
21 if (painter) painter->OnPaint();
22 return FALSE;
23 }
24
25 } // namespace
26
27 namespace media {
28
29 gfx::NativeWindow Window::CreateNativeWindow(int width, int height) {
30 GtkWidget* hwnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
31
32 gtk_window_set_default_size(GTK_WINDOW(hwnd), width, height);
33 gtk_widget_set_double_buffered(hwnd, FALSE);
34 gtk_widget_set_app_paintable(hwnd, TRUE);
35
36 gtk_widget_show(hwnd);
37
38 gtk_signal_connect(GTK_OBJECT(GTK_WINDOW(hwnd)),
39 "delete_event",
40 reinterpret_cast<GtkSignalFunc>(::OnDelete),
41 NULL);
42
43 return GTK_WINDOW(hwnd);
44 }
45
46 void Window::SetPainter(Painter* painter) {
47 painter_ = painter;
48 gtk_signal_connect(GTK_OBJECT(GTK_WINDOW(window_handle_)),
49 "expose_event",
50 reinterpret_cast<GtkSignalFunc>(::OnExpose),
51 painter_);
52 }
53
54 gfx::PluginWindowHandle Window::PluginWindow() {
55 return GDK_WINDOW_XWINDOW(GTK_WIDGET(window_handle_)->window);
56 }
57
58 void Window::Paint() {
59 gint return_val;
60 GdkEvent event;
61 gtk_signal_emit_by_name(GTK_OBJECT(window_handle_), "expose_event", &event, &r eturn_val);
62 }
63
64 } // media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698