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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/tools/shader_bench/window_linux.cc
diff --git a/media/tools/shader_bench/window_linux.cc b/media/tools/shader_bench/window_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..973e01b333f69c8a5fc87a58f4d554df50077cc1
--- /dev/null
+++ b/media/tools/shader_bench/window_linux.cc
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/tools/shader_bench/window.h"
+
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+
+#include "base/utf_string_conversions.h"
+
+namespace {
+
+gboolean OnDelete(GtkWidget* widget, GdkEventExpose* event) {
+ gtk_main_quit();
+ return FALSE;
+}
+
+gboolean OnExpose(GtkWidget* widget, GdkEventExpose* event, gpointer data) {
+ Painter* painter = reinterpret_cast<Painter*>(data);
+ if (painter) painter->OnPaint();
+ return FALSE;
+}
+
+} // namespace
+
+namespace media {
+
+gfx::NativeWindow Window::CreateNativeWindow(int width, int height) {
+ GtkWidget* hwnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+ gtk_window_set_default_size(GTK_WINDOW(hwnd), width, height);
+ gtk_widget_set_double_buffered(hwnd, FALSE);
+ gtk_widget_set_app_paintable(hwnd, TRUE);
+
+ gtk_widget_show(hwnd);
+
+ gtk_signal_connect(GTK_OBJECT(GTK_WINDOW(hwnd)),
+ "delete_event",
+ reinterpret_cast<GtkSignalFunc>(::OnDelete),
+ NULL);
+
+ return GTK_WINDOW(hwnd);
+}
+
+void Window::SetPainter(Painter* painter) {
+ painter_ = painter;
+ gtk_signal_connect(GTK_OBJECT(GTK_WINDOW(window_handle_)),
+ "expose_event",
+ reinterpret_cast<GtkSignalFunc>(::OnExpose),
+ painter_);
+}
+
+gfx::PluginWindowHandle Window::PluginWindow() {
+ return GDK_WINDOW_XWINDOW(GTK_WIDGET(window_handle_)->window);
+}
+
+void Window::Paint() {
+ gint return_val;
+ GdkEvent event;
+ gtk_signal_emit_by_name(GTK_OBJECT(window_handle_), "expose_event", &event, &return_val);
+}
+
+} // media

Powered by Google App Engine
This is Rietveld 408576698