| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if defined(USE_X11) | 5 #if defined(USE_X11) |
| 6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/aura/window_tree_host.h" | 26 #include "ui/aura/window_tree_host.h" |
| 27 #include "ui/base/hit_test.h" | 27 #include "ui/base/hit_test.h" |
| 28 #include "ui/compositor/compositor.h" | 28 #include "ui/compositor/compositor.h" |
| 29 #include "ui/compositor/compositor_observer.h" | 29 #include "ui/compositor/compositor_observer.h" |
| 30 #include "ui/compositor/debug_utils.h" | 30 #include "ui/compositor/debug_utils.h" |
| 31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
| 32 #include "ui/compositor/test/in_process_context_factory.h" | 32 #include "ui/compositor/test/in_process_context_factory.h" |
| 33 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
| 34 #include "ui/gfx/rect.h" | 34 #include "ui/gfx/rect.h" |
| 35 #include "ui/gfx/skia_util.h" | 35 #include "ui/gfx/skia_util.h" |
| 36 #include "ui/gfx/x/x11_connection.h" | |
| 37 #include "ui/gl/gl_surface.h" | 36 #include "ui/gl/gl_surface.h" |
| 38 | 37 |
| 39 #ifndef GL_GLEXT_PROTOTYPES | 38 #ifndef GL_GLEXT_PROTOTYPES |
| 40 #define GL_GLEXT_PROTOTYPES 1 | 39 #define GL_GLEXT_PROTOTYPES 1 |
| 41 #endif | 40 #endif |
| 42 #include "third_party/khronos/GLES2/gl2ext.h" | 41 #include "third_party/khronos/GLES2/gl2ext.h" |
| 43 | 42 |
| 43 #if defined(USE_X11) |
| 44 #include "base/message_loop/message_pump_x11.h" |
| 45 #endif |
| 46 |
| 44 using base::TimeTicks; | 47 using base::TimeTicks; |
| 45 using ui::Compositor; | 48 using ui::Compositor; |
| 46 using ui::Layer; | 49 using ui::Layer; |
| 47 using ui::LayerDelegate; | 50 using ui::LayerDelegate; |
| 48 | 51 |
| 49 namespace { | 52 namespace { |
| 50 | 53 |
| 51 class ColoredLayer : public Layer, public LayerDelegate { | 54 class ColoredLayer : public Layer, public LayerDelegate { |
| 52 public: | 55 public: |
| 53 explicit ColoredLayer(SkColor color) | 56 explicit ColoredLayer(SkColor color) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } // namespace | 287 } // namespace |
| 285 | 288 |
| 286 int main(int argc, char** argv) { | 289 int main(int argc, char** argv) { |
| 287 CommandLine::Init(argc, argv); | 290 CommandLine::Init(argc, argv); |
| 288 | 291 |
| 289 base::AtExitManager exit_manager; | 292 base::AtExitManager exit_manager; |
| 290 | 293 |
| 291 #if defined(USE_X11) | 294 #if defined(USE_X11) |
| 292 // This demo uses InProcessContextFactory which uses X on a separate Gpu | 295 // This demo uses InProcessContextFactory which uses X on a separate Gpu |
| 293 // thread. | 296 // thread. |
| 294 gfx::InitializeThreadedX11(); | 297 XInitThreads(); |
| 295 #endif | 298 #endif |
| 296 | 299 |
| 297 gfx::GLSurface::InitializeOneOff(); | 300 gfx::GLSurface::InitializeOneOff(); |
| 298 | 301 |
| 299 // The ContextFactory must exist before any Compositors are created. | 302 // The ContextFactory must exist before any Compositors are created. |
| 300 scoped_ptr<ui::InProcessContextFactory> context_factory( | 303 scoped_ptr<ui::InProcessContextFactory> context_factory( |
| 301 new ui::InProcessContextFactory()); | 304 new ui::InProcessContextFactory()); |
| 302 ui::ContextFactory::SetInstance(context_factory.get()); | 305 ui::ContextFactory::SetInstance(context_factory.get()); |
| 303 | 306 |
| 304 base::i18n::InitializeICU(); | 307 base::i18n::InitializeICU(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 ui::PrintLayerHierarchy(host->window()->layer(), gfx::Point(100, 100)); | 361 ui::PrintLayerHierarchy(host->window()->layer(), gfx::Point(100, 100)); |
| 359 #endif | 362 #endif |
| 360 | 363 |
| 361 host->Show(); | 364 host->Show(); |
| 362 base::MessageLoopForUI::current()->Run(); | 365 base::MessageLoopForUI::current()->Run(); |
| 363 focus_client.reset(); | 366 focus_client.reset(); |
| 364 host.reset(); | 367 host.reset(); |
| 365 | 368 |
| 366 return 0; | 369 return 0; |
| 367 } | 370 } |
| OLD | NEW |