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