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

Side by Side Diff: ui/gfx/buffer_format_util.cc

Issue 1389133002: content: Use type-parameterized tests for GpuMemoryBuffer implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add blankline Created 5 years, 2 months 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
« no previous file with comments | « ui/gfx/buffer_format_util.h ('k') | ui/ozone/common/stub_client_native_pixmap_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/gfx/buffer_format_util.h" 5 #include "ui/gfx/buffer_format_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/numerics/safe_math.h" 8 #include "base/numerics/safe_math.h"
9 9
10 namespace gfx { 10 namespace gfx {
11 namespace {
12
13 const BufferFormat kBufferFormats[] = {
14 BufferFormat::ATC, BufferFormat::ATCIA,
15 BufferFormat::DXT1, BufferFormat::DXT5,
16 BufferFormat::ETC1, BufferFormat::R_8,
17 BufferFormat::RGBA_4444, BufferFormat::RGBA_8888,
18 BufferFormat::BGRX_8888, BufferFormat::BGRA_8888,
19 BufferFormat::UYVY_422, BufferFormat::YUV_420_BIPLANAR,
20 BufferFormat::YUV_420};
21
22 static_assert(arraysize(kBufferFormats) ==
23 (static_cast<int>(BufferFormat::LAST) + 1),
24 "BufferFormat::LAST must be last value of kBufferFormats");
25
26 } // namespace
27
28 std::vector<BufferFormat> GetBufferFormats() {
29 return std::vector<BufferFormat>(kBufferFormats,
30 kBufferFormats + arraysize(kBufferFormats));
31 }
11 32
12 size_t NumberOfPlanesForBufferFormat(BufferFormat format) { 33 size_t NumberOfPlanesForBufferFormat(BufferFormat format) {
13 switch (format) { 34 switch (format) {
14 case BufferFormat::ATC: 35 case BufferFormat::ATC:
15 case BufferFormat::ATCIA: 36 case BufferFormat::ATCIA:
16 case BufferFormat::DXT1: 37 case BufferFormat::DXT1:
17 case BufferFormat::DXT5: 38 case BufferFormat::DXT5:
18 case BufferFormat::ETC1: 39 case BufferFormat::ETC1:
19 case BufferFormat::R_8: 40 case BufferFormat::R_8:
20 case BufferFormat::RGBA_4444: 41 case BufferFormat::RGBA_4444:
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return false; 162 return false;
142 checked_size += checked_plane_size.ValueOrDie(); 163 checked_size += checked_plane_size.ValueOrDie();
143 if (!checked_size.IsValid()) 164 if (!checked_size.IsValid())
144 return false; 165 return false;
145 } 166 }
146 *size_in_bytes = checked_size.ValueOrDie(); 167 *size_in_bytes = checked_size.ValueOrDie();
147 return true; 168 return true;
148 } 169 }
149 170
150 } // namespace gfx 171 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/buffer_format_util.h ('k') | ui/ozone/common/stub_client_native_pixmap_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698