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

Side by Side Diff: cc/resources/platform_color.h

Issue 1533773002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@cl-2e
Patch Set: rebase Created 5 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
« no previous file with comments | « cc/resources/layer_quad_unittest.cc ('k') | cc/resources/platform_color_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_RESOURCES_PLATFORM_COLOR_H_
6 #define CC_RESOURCES_PLATFORM_COLOR_H_
7
8 #include "base/basictypes.h"
9 #include "base/logging.h"
10 #include "cc/resources/resource_format.h"
11 #include "third_party/skia/include/core/SkTypes.h"
12
13 namespace cc {
14
15 class PlatformColor {
16 public:
17 enum SourceDataFormat {
18 SOURCE_FORMAT_RGBA8,
19 SOURCE_FORMAT_BGRA8
20 };
21
22 static SourceDataFormat Format() {
23 return SK_B32_SHIFT ? SOURCE_FORMAT_RGBA8 : SOURCE_FORMAT_BGRA8;
24 }
25
26 // Returns the most efficient texture format for this platform.
27 static ResourceFormat BestTextureFormat(bool supports_bgra8888) {
28 switch (Format()) {
29 case SOURCE_FORMAT_BGRA8:
30 return (supports_bgra8888) ? BGRA_8888 : RGBA_8888;
31 case SOURCE_FORMAT_RGBA8:
32 return RGBA_8888;
33 }
34 NOTREACHED();
35 return RGBA_8888;
36 }
37
38 // Return true if the given texture format has the same component order
39 // as the color on this platform.
40 static bool SameComponentOrder(ResourceFormat format) {
41 switch (Format()) {
42 case SOURCE_FORMAT_RGBA8:
43 return format == RGBA_8888 || format == RGBA_4444;
44 case SOURCE_FORMAT_BGRA8:
45 return format == BGRA_8888 || format == RGBA_4444;
46 }
47 NOTREACHED();
48 return false;
49 }
50
51 private:
52 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformColor);
53 };
54
55 } // namespace cc
56
57 #endif // CC_RESOURCES_PLATFORM_COLOR_H_
OLDNEW
« no previous file with comments | « cc/resources/layer_quad_unittest.cc ('k') | cc/resources/platform_color_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698