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

Side by Side Diff: cc/platform_color.h

Issue 12471007: Part 8 of cc/ directory shuffles: resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/picture_pile_impl.cc ('k') | cc/prioritized_resource.h » ('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_PLATFORM_COLOR_H_
6 #define CC_PLATFORM_COLOR_H_
7
8 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
9 #include "third_party/khronos/GLES2/gl2.h"
10 #include "third_party/khronos/GLES2/gl2ext.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 GLenum BestTextureFormat(WebKit::WebGraphicsContext3D* context,
28 bool supports_bgra8888) {
29 GLenum texture_format = GL_RGBA;
30 switch (Format()) {
31 case SOURCE_FORMAT_RGBA8:
32 break;
33 case SOURCE_FORMAT_BGRA8:
34 if (supports_bgra8888)
35 texture_format = GL_BGRA_EXT;
36 break;
37 default:
38 NOTREACHED();
39 break;
40 }
41 return texture_format;
42 }
43
44 // Return true if the given texture format has the same component order
45 // as the color on this platform.
46 static bool SameComponentOrder(GLenum texture_format) {
47 switch (Format()) {
48 case SOURCE_FORMAT_RGBA8:
49 return texture_format == GL_RGBA;
50 case SOURCE_FORMAT_BGRA8:
51 return texture_format == GL_BGRA_EXT;
52 default:
53 NOTREACHED();
54 return false;
55 }
56 }
57 };
58
59 } // namespace cc
60
61 #endif // CC_PLATFORM_COLOR_H_
OLDNEW
« no previous file with comments | « cc/picture_pile_impl.cc ('k') | cc/prioritized_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698