| 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 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 // Process files. | 124 // Process files. |
| 125 std::deque<scoped_refptr<media::VideoFrame> > frames; | 125 std::deque<scoped_refptr<media::VideoFrame> > frames; |
| 126 GetFrames(file_name, width, height, num_frames, frames); | 126 GetFrames(file_name, width, height, num_frames, frames); |
| 127 | 127 |
| 128 // Initialize window and graphics context. | 128 // Initialize window and graphics context. |
| 129 base::AtExitManager at_exit_manager; | 129 base::AtExitManager at_exit_manager; |
| 130 gfx::GLSurface::InitializeOneOff(); | 130 gfx::GLSurface::InitializeOneOff(); |
| 131 scoped_ptr<media::Window> window(new media::Window(width, height)); | 131 scoped_ptr<media::Window> window(new media::Window(width, height)); |
| 132 gfx::GLSurface* surface = | 132 gfx::GLSurface* surface = |
| 133 gfx::GLSurface::CreateViewGLSurface(false, window->PluginWindow()); | 133 gfx::GLSurface::CreateViewGLSurface(false, window->PluginWindow()).get(); |
| 134 gfx::GLContext* context = gfx::GLContext::CreateGLContext( | 134 gfx::GLContext* context = gfx::GLContext::CreateGLContext( |
| 135 NULL, | 135 NULL, surface, gfx::PreferDiscreteGpu).get(); |
| 136 surface, | |
| 137 gfx::PreferDiscreteGpu); | |
| 138 context->MakeCurrent(surface); | 136 context->MakeCurrent(surface); |
| 139 // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. | 137 // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. |
| 140 context->SetSwapInterval(0); | 138 context->SetSwapInterval(0); |
| 141 | 139 |
| 142 // Initialize and name GPU painters. | 140 // Initialize and name GPU painters. |
| 143 static const int kNumPainters = 3; | 141 static const int kNumPainters = 3; |
| 144 static const struct { | 142 static const struct { |
| 145 const char* name; | 143 const char* name; |
| 146 GPUPainter* painter; | 144 GPUPainter* painter; |
| 147 } painters[] = { | 145 } painters[] = { |
| 148 { "CPU CSC + GPU Render", new CPUColorPainter() }, | 146 { "CPU CSC + GPU Render", new CPUColorPainter() }, |
| 149 { "GPU CSC/Render", new GPUColorWithLuminancePainter() }, | 147 { "GPU CSC/Render", new GPUColorWithLuminancePainter() }, |
| 150 }; | 148 }; |
| 151 | 149 |
| 152 // Run GPU painter tests. | 150 // Run GPU painter tests. |
| 153 for (int i = 0; i < kNumPainters; i++) { | 151 for (int i = 0; i < kNumPainters; i++) { |
| 154 scoped_ptr<GPUPainter> painter(painters[i].painter); | 152 scoped_ptr<GPUPainter> painter(painters[i].painter); |
| 155 painter->LoadFrames(&frames); | 153 painter->LoadFrames(&frames); |
| 156 painter->SetGLContext(surface, context); | 154 painter->SetGLContext(surface, context); |
| 157 painter->Initialize(width, height); | 155 painter->Initialize(width, height); |
| 158 printf("Running %s tests...", painters[i].name); | 156 printf("Running %s tests...", painters[i].name); |
| 159 RunTest(window.get(), painter.get()); | 157 RunTest(window.get(), painter.get()); |
| 160 } | 158 } |
| 161 | 159 |
| 162 return 0; | 160 return 0; |
| 163 } | 161 } |
| OLD | NEW |