Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc

Issue 806653006: Update GPU memory buffers to use StrideInBytes internally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use StrideInBytes Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/common/gpu/client/gpu_memory_buffer_impl.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/gpu/gpu_memory_buffer_factory.h" 8 #include "content/common/gpu/gpu_memory_buffer_factory.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 TEST_P(GpuMemoryBufferImplTest, Map) { 80 TEST_P(GpuMemoryBufferImplTest, Map) {
81 const int kBufferId = 1; 81 const int kBufferId = 1;
82 82
83 gfx::Size buffer_size(1, 1); 83 gfx::Size buffer_size(1, 1);
84 84
85 for (auto configuration : supported_configurations_) { 85 for (auto configuration : supported_configurations_) {
86 if (configuration.usage != gfx::GpuMemoryBuffer::MAP) 86 if (configuration.usage != gfx::GpuMemoryBuffer::MAP)
87 continue; 87 continue;
88 88
89 size_t width_in_bytes = 89 size_t width_in_bytes = GpuMemoryBufferImpl::StrideInBytes(
90 GpuMemoryBufferImpl::BytesPerPixel(configuration.format) * 90 buffer_size.width(), configuration.format);
91 buffer_size.width();
92 EXPECT_GT(width_in_bytes, 0u); 91 EXPECT_GT(width_in_bytes, 0u);
93 scoped_ptr<char[]> data(new char[width_in_bytes]); 92 scoped_ptr<char[]> data(new char[width_in_bytes]);
94 memset(data.get(), 0x2a, width_in_bytes); 93 memset(data.get(), 0x2a, width_in_bytes);
95 94
96 scoped_ptr<GpuMemoryBufferImpl> buffer( 95 scoped_ptr<GpuMemoryBufferImpl> buffer(
97 GpuMemoryBufferImpl::CreateFromHandle( 96 GpuMemoryBufferImpl::CreateFromHandle(
98 CreateGpuMemoryBuffer(kBufferId, 97 CreateGpuMemoryBuffer(kBufferId,
99 buffer_size, 98 buffer_size,
100 configuration.format, 99 configuration.format,
101 configuration.usage), 100 configuration.usage),
(...skipping 23 matching lines...) Expand all
125 return supported_types; 124 return supported_types;
126 } 125 }
127 126
128 INSTANTIATE_TEST_CASE_P( 127 INSTANTIATE_TEST_CASE_P(
129 GpuMemoryBufferImplTests, 128 GpuMemoryBufferImplTests,
130 GpuMemoryBufferImplTest, 129 GpuMemoryBufferImplTest,
131 ::testing::ValuesIn(GetSupportedGpuMemoryBufferTypes())); 130 ::testing::ValuesIn(GetSupportedGpuMemoryBufferTypes()));
132 131
133 } // namespace 132 } // namespace
134 } // namespace content 133 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698