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

Side by Side Diff: cc/platform_color.h

Issue 11150025: Patch from https://codereview.chromium.org/11111005/ without actual file deletes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_unittest.cc ('k') | cc/prioritized_texture.h » ('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 2011 The Chromium Authors. All rights reserved. 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 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 #ifndef PlatformColor_h 5 #ifndef PlatformColor_h
6 #define PlatformColor_h 6 #define PlatformColor_h
7 7
8 #include "Extensions3D.h" 8 #include "third_party/khronos/GLES2/gl2ext.h"
9 #include "GraphicsContext3D.h" 9 #include "third_party/khronos/GLES2/gl2.h"
10 #include "SkTypes.h" 10 #include "SkTypes.h"
11 #include <public/WebGraphicsContext3D.h> 11 #include <public/WebGraphicsContext3D.h>
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class PlatformColor { 15 class PlatformColor {
16 public: 16 public:
17 static GraphicsContext3D::SourceDataFormat format() 17 enum SourceDataFormat { SourceFormatRGBA8, SourceFormatBGRA8 };
18
19 static SourceDataFormat format()
18 { 20 {
19 return SK_B32_SHIFT ? GraphicsContext3D::SourceFormatRGBA8 : GraphicsCon text3D::SourceFormatBGRA8; 21 return SK_B32_SHIFT ? SourceFormatRGBA8 : SourceFormatBGRA8;
20 } 22 }
21 23
22 // Returns the most efficient texture format for this platform. 24 // Returns the most efficient texture format for this platform.
23 static GC3Denum bestTextureFormat(WebKit::WebGraphicsContext3D* context, boo l supportsBGRA8888) 25 static GLenum bestTextureFormat(WebKit::WebGraphicsContext3D* context, bool supportsBGRA8888)
24 { 26 {
25 GC3Denum textureFormat = GraphicsContext3D::RGBA; 27 GLenum textureFormat = GL_RGBA;
26 switch (format()) { 28 switch (format()) {
27 case GraphicsContext3D::SourceFormatRGBA8: 29 case SourceFormatRGBA8:
28 break; 30 break;
29 case GraphicsContext3D::SourceFormatBGRA8: 31 case SourceFormatBGRA8:
30 if (supportsBGRA8888) 32 if (supportsBGRA8888)
31 textureFormat = Extensions3D::BGRA_EXT; 33 textureFormat = GL_BGRA_EXT;
32 break; 34 break;
33 default: 35 default:
34 ASSERT_NOT_REACHED(); 36 ASSERT_NOT_REACHED();
35 break; 37 break;
36 } 38 }
37 return textureFormat; 39 return textureFormat;
38 } 40 }
39 41
40 // Return true if the given texture format has the same component order 42 // Return true if the given texture format has the same component order
41 // as the color on this platform. 43 // as the color on this platform.
42 static bool sameComponentOrder(GC3Denum textureFormat) 44 static bool sameComponentOrder(GLenum textureFormat)
43 { 45 {
44 switch (format()) { 46 switch (format()) {
45 case GraphicsContext3D::SourceFormatRGBA8: 47 case SourceFormatRGBA8:
46 return textureFormat == GraphicsContext3D::RGBA; 48 return textureFormat == GL_RGBA;
47 case GraphicsContext3D::SourceFormatBGRA8: 49 case SourceFormatBGRA8:
48 return textureFormat == Extensions3D::BGRA_EXT; 50 return textureFormat == GL_BGRA_EXT;
49 default: 51 default:
50 ASSERT_NOT_REACHED(); 52 ASSERT_NOT_REACHED();
51 return false; 53 return false;
52 } 54 }
53 } 55 }
54 }; 56 };
55 57
56 } // namespace cc 58 } // namespace cc
57 59
58 #endif 60 #endif
OLDNEW
« no previous file with comments | « cc/layer_tree_host_unittest.cc ('k') | cc/prioritized_texture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698