| 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 // This file looks like a unit test, but it contains benchmarks and test | 5 // This file looks like a unit test, but it contains benchmarks and test |
| 6 // utilities intended for manual evaluation of the scalers in | 6 // utilities intended for manual evaluation of the scalers in |
| 7 // gl_helper*. These tests produce output in the form of files and printouts, | 7 // gl_helper*. These tests produce output in the form of files and printouts, |
| 8 // but cannot really "fail". There is no point in making these tests part | 8 // but cannot really "fail". There is no point in making these tests part |
| 9 // of any test automation run. | 9 // of any test automation run. |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/at_exit.h" | 21 #include "base/at_exit.h" |
| 22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 23 #include "base/files/file_util.h" | 23 #include "base/files/file_util.h" |
| 24 #include "base/macros.h" | 24 #include "base/macros.h" |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 27 #include "content/browser/compositor/gl_helper.h" | 27 #include "content/browser/compositor/gl_helper.h" |
| 28 #include "content/browser/compositor/gl_helper_scaling.h" | 28 #include "content/browser/compositor/gl_helper_scaling.h" |
| 29 #include "gpu/command_buffer/client/gl_in_process_context.h" | 29 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 30 #include "gpu/command_buffer/client/gles2_implementation.h" | 30 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 31 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
| 33 #include "third_party/skia/include/core/SkTypes.h" | 34 #include "third_party/skia/include/core/SkTypes.h" |
| 34 #include "ui/gfx/codec/png_codec.h" | 35 #include "ui/gfx/codec/png_codec.h" |
| 35 #include "ui/gl/gl_surface.h" | 36 #include "ui/gl/gl_surface.h" |
| 36 | 37 |
| 37 namespace content { | 38 namespace content { |
| 38 | 39 |
| 39 content::GLHelper::ScalerQuality kQualities[] = { | 40 content::GLHelper::ScalerQuality kQualities[] = { |
| 40 content::GLHelper::SCALER_QUALITY_BEST, | 41 content::GLHelper::SCALER_QUALITY_BEST, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 attributes.sample_buffers = 1; | 61 attributes.sample_buffers = 1; |
| 61 attributes.bind_generates_resource = false; | 62 attributes.bind_generates_resource = false; |
| 62 | 63 |
| 63 context_.reset(gpu::GLInProcessContext::Create( | 64 context_.reset(gpu::GLInProcessContext::Create( |
| 64 nullptr, /* service */ | 65 nullptr, /* service */ |
| 65 nullptr, /* surface */ | 66 nullptr, /* surface */ |
| 66 true, /* offscreen */ | 67 true, /* offscreen */ |
| 67 gfx::kNullAcceleratedWidget, /* window */ | 68 gfx::kNullAcceleratedWidget, /* window */ |
| 68 gfx::Size(1, 1), /* size */ | 69 gfx::Size(1, 1), /* size */ |
| 69 nullptr, /* share_context */ | 70 nullptr, /* share_context */ |
| 70 attributes, gfx::PreferDiscreteGpu, | 71 attributes, gfx::PreferDiscreteGpu, gpu::SharedMemoryLimits(), |
| 71 ::gpu::GLInProcessContextSharedMemoryLimits(), | |
| 72 nullptr, /* gpu_memory_buffer_manager */ | 72 nullptr, /* gpu_memory_buffer_manager */ |
| 73 nullptr /* image_factory */)); | 73 nullptr /* image_factory */)); |
| 74 gl_ = context_->GetImplementation(); | 74 gl_ = context_->GetImplementation(); |
| 75 gpu::ContextSupport* support = context_->GetImplementation(); | 75 gpu::ContextSupport* support = context_->GetImplementation(); |
| 76 | 76 |
| 77 helper_.reset(new content::GLHelper(gl_, support)); | 77 helper_.reset(new content::GLHelper(gl_, support)); |
| 78 helper_scaling_.reset(new content::GLHelperScaling(gl_, helper_.get())); | 78 helper_scaling_.reset(new content::GLHelperScaling(gl_, helper_.get())); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void TearDown() override { | 81 void TearDown() override { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 kQualityNames[q], percents[p]); | 238 kQualityNames[q], percents[p]); |
| 239 VLOG(0) << "Writing " << filename; | 239 VLOG(0) << "Writing " << filename; |
| 240 SaveToFile(&output_pixels, base::FilePath::FromUTF8Unsafe(filename)); | 240 SaveToFile(&output_pixels, base::FilePath::FromUTF8Unsafe(filename)); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 gl_->DeleteTextures(1, &src_texture); | 243 gl_->DeleteTextures(1, &src_texture); |
| 244 gl_->DeleteFramebuffers(1, &framebuffer); | 244 gl_->DeleteFramebuffers(1, &framebuffer); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace content | 247 } // namespace content |
| OLD | NEW |