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

Unified Diff: gpu/demos/framework/window.h

Issue 554053: Added infrastructure to run gpu demos under Pepper3D. Created a Demo class th... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/demos/framework/plugin.rc ('k') | gpu/demos/framework/window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/demos/framework/window.h
===================================================================
--- gpu/demos/framework/window.h (revision 0)
+++ gpu/demos/framework/window.h (working copy)
@@ -2,67 +2,38 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Base class for gles2 applications using command buffer.
+#ifndef GPU_DEMOS_FRAMEWORK_WINDOW_H_
+#define GPU_DEMOS_FRAMEWORK_WINDOW_H_
-#ifndef GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
-#define GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
+#include "base/scoped_ptr.h"
+#include "gpu/demos/framework/demo.h"
+#include "gpu/demos/framework/platform.h"
-#include "base/at_exit.h"
-#include "base/message_loop.h"
-#include "base/time.h"
+namespace gpu {
+namespace demos {
-#include "gpu/demos/app_framework/platform.h"
-
-namespace gpu_demos {
-
-// Acts as a base class for GLES2 applications using command buffer.
-// The derived calls needs to call InitRenderContext() to create a render
-// surface and initialize a rendering context. Currently it only creates
-// an on-screen window. It will be extended to support pepper/nacl plugin
-// when pepper 3D api is in place.
-class Application {
+// Acts as a framework for standalone demos. It creates a window and delegates
+// all events to demo to perform rendering and other tasks.
+class Window {
public:
- Application();
- virtual ~Application();
+ Window();
+ virtual ~Window();
+ // Initializes and creates a window with given dimensions.
+ bool Init(int width, int height);
+
// Enters the event processing loop.
void MainLoop();
+
void OnPaint();
- protected:
- // Returns the width of rendering surface.
- inline int width() const { return width_; }
- // Returns the height of rendering surface.
- inline int height() const { return height_; }
-
- bool InitRenderContext();
-
- // The framework calls this function for the derived classes to do custom
- // rendering. There is no default implementation. It must be defined by the
- // derived classes. The elapsed_sec param represents the time elapsed
- // (in seconds) after Draw was called the last time. It can be used to
- // make the application frame-rate independent. It is 0.0f for the
- // first draw call.
- virtual void Draw(float elapsed_sec) = 0;
-
private:
- // Creates a native on-screen window.
- NativeWindowHandle CreateNativeWindow();
-
- int width_;
- int height_;
NativeWindowHandle window_handle_;
+ scoped_ptr<Demo> demo_;
- // Time at which draw was called last.
- base::Time last_draw_time_;
-
- // The following two variables are just needed to satisfy
- // the assumption that we are running inside a browser.
- base::AtExitManager at_exit_manager_;
- MessageLoopForUI message_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(Application);
+ DISALLOW_COPY_AND_ASSIGN(Window);
};
-} // namespace gpu_demos
-#endif // GPU_DEMOS_APP_FRAMEWORK_APPLICATION_H_
+} // namespace demos
+} // namespace gpu
+#endif // GPU_DEMOS_FRAMEWORK_WINDOW_H_
« no previous file with comments | « gpu/demos/framework/plugin.rc ('k') | gpu/demos/framework/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698