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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(window->PluginWindow()).get(); | 133 gfx::GLSurface::CreateViewGLSurface(window->PluginWindow()).get(); |
134 gfx::GLContext* context = gfx::GLContext::CreateGLContext( | 134 gfx::GLContext* context = gfx::GLContext::CreateGLContext( |
135 NULL, surface, gfx::PreferDiscreteGpu).get(); | 135 NULL, surface, gfx::PreferDiscreteGpu).get(); |
136 context->MakeCurrent(surface); | 136 context->MakeCurrent(surface); |
137 // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. | 137 // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. |
138 context->SetSwapInterval(0); | 138 context->SetSwapInterval(0); |
139 | 139 |
140 // Initialize and name GPU painters. | 140 // Initialize and name GPU painters. |
141 static const int kNumPainters = 3; | |
142 static const struct { | 141 static const struct { |
143 const char* name; | 142 const char* name; |
144 GPUPainter* painter; | 143 GPUPainter* painter; |
145 } painters[] = { | 144 } painters[] = { |
146 { "CPU CSC + GPU Render", new CPUColorPainter() }, | 145 { "CPU CSC + GPU Render", new CPUColorPainter() }, |
147 { "GPU CSC/Render", new GPUColorWithLuminancePainter() }, | 146 { "GPU CSC/Render", new GPUColorWithLuminancePainter() }, |
148 }; | 147 }; |
149 | 148 |
150 // Run GPU painter tests. | 149 // Run GPU painter tests. |
151 for (int i = 0; i < kNumPainters; i++) { | 150 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(painters); i++) { |
152 scoped_ptr<GPUPainter> painter(painters[i].painter); | 151 scoped_ptr<GPUPainter> painter(painters[i].painter); |
153 painter->LoadFrames(&frames); | 152 painter->LoadFrames(&frames); |
154 painter->SetGLContext(surface, context); | 153 painter->SetGLContext(surface, context); |
155 painter->Initialize(width, height); | 154 painter->Initialize(width, height); |
156 printf("Running %s tests...", painters[i].name); | 155 printf("Running %s tests...", painters[i].name); |
157 RunTest(window.get(), painter.get()); | 156 RunTest(window.get(), painter.get()); |
158 } | 157 } |
159 | 158 |
160 return 0; | 159 return 0; |
161 } | 160 } |
OLD | NEW |