summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-09-06 17:08:45 +0200
committerAndras Becsi <andras.becsi@digia.com>2014-06-04 18:06:18 +0200
commit20b77b6954b72436cf555fedddef2d42a10447d8 (patch)
tree76a7f9320ce0bf3f62489704ecd5997a239bd0eb
parentc63998535d3add533e05ec4efa85f4fc7e34700c (diff)
downloadqtwebengine-chromium-20b77b6954b72436cf555fedddef2d42a10447d8.tar.gz
<chromium> Solve conflicts when including both QtOpenGL headers and resource_provider.h
If resource_provider.h is going to be used to integrate delegated frame to external compositors, it should avoid conflicting with the system's gl.h. Change-Id: Ie37d6cde263157e6717cc006a0896f0b9ebdaa5d Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
-rw-r--r--chromium/cc/base/util.h33
-rw-r--r--chromium/cc/layers/texture_layer.cc2
-rw-r--r--chromium/cc/output/delegating_renderer.cc1
-rw-r--r--chromium/cc/output/gl_renderer.cc1
-rw-r--r--chromium/cc/quads/content_draw_quad_base.h1
-rw-r--r--chromium/cc/resources/resource_provider.h35
-rw-r--r--chromium/content/renderer/gpu/mailbox_output_surface.cc1
7 files changed, 41 insertions, 33 deletions
diff --git a/chromium/cc/base/util.h b/chromium/cc/base/util.h
index 1d716ae2a42..bd511786dca 100644
--- a/chromium/cc/base/util.h
+++ b/chromium/cc/base/util.h
@@ -8,6 +8,9 @@
#include <limits>
#include "base/basictypes.h"
+#include "cc/resources/resource_provider.h"
+#include "third_party/khronos/GLES2/gl2.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
namespace cc {
@@ -24,6 +27,36 @@ template <typename T> T RoundDown(T n, T mul) {
: ((n - mul + 1) / mul) * mul;
}
+inline GLenum GLDataType(ResourceFormat format) {
+ DCHECK_LE(format, RESOURCE_FORMAT_MAX);
+ static const unsigned format_gl_data_type[RESOURCE_FORMAT_MAX + 1] = {
+ GL_UNSIGNED_BYTE, // RGBA_8888
+ GL_UNSIGNED_SHORT_4_4_4_4, // RGBA_4444
+ GL_UNSIGNED_BYTE, // BGRA_8888
+ GL_UNSIGNED_BYTE, // LUMINANCE_8
+ GL_UNSIGNED_SHORT_5_6_5, // RGB_565,
+ GL_UNSIGNED_BYTE // ETC1
+ };
+ return format_gl_data_type[format];
+}
+
+inline GLenum GLDataFormat(ResourceFormat format) {
+ DCHECK_LE(format, RESOURCE_FORMAT_MAX);
+ static const unsigned format_gl_data_format[RESOURCE_FORMAT_MAX + 1] = {
+ GL_RGBA, // RGBA_8888
+ GL_RGBA, // RGBA_4444
+ GL_BGRA_EXT, // BGRA_8888
+ GL_LUMINANCE, // LUMINANCE_8
+ GL_RGB, // RGB_565
+ GL_ETC1_RGB8_OES // ETC1
+ };
+ return format_gl_data_format[format];
+}
+
+inline GLenum GLInternalFormat(ResourceFormat format) {
+ return GLDataFormat(format);
+}
+
} // namespace cc
#endif // CC_BASE_UTIL_H_
diff --git a/chromium/cc/layers/texture_layer.cc b/chromium/cc/layers/texture_layer.cc
index 195d05ddaba..5c954c140c2 100644
--- a/chromium/cc/layers/texture_layer.cc
+++ b/chromium/cc/layers/texture_layer.cc
@@ -13,6 +13,8 @@
#include "cc/resources/single_release_callback.h"
#include "cc/trees/blocking_task_runner.h"
#include "cc/trees/layer_tree_host.h"
+#include "third_party/khronos/GLES2/gl2.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
namespace cc {
diff --git a/chromium/cc/output/delegating_renderer.cc b/chromium/cc/output/delegating_renderer.cc
index c76f250754a..1b5716160fa 100644
--- a/chromium/cc/output/delegating_renderer.cc
+++ b/chromium/cc/output/delegating_renderer.cc
@@ -25,6 +25,7 @@
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/common/gpu_memory_allocation.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
+#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
using blink::WebGraphicsContext3D;
diff --git a/chromium/cc/output/gl_renderer.cc b/chromium/cc/output/gl_renderer.cc
index 04db7b0609b..f0e32f43083 100644
--- a/chromium/cc/output/gl_renderer.cc
+++ b/chromium/cc/output/gl_renderer.cc
@@ -16,6 +16,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
+#include "cc/base/util.h"
#include "cc/base/math_util.h"
#include "cc/layers/video_layer_impl.h"
#include "cc/output/compositor_frame.h"
diff --git a/chromium/cc/quads/content_draw_quad_base.h b/chromium/cc/quads/content_draw_quad_base.h
index cbf18ca2b15..6229d615ce1 100644
--- a/chromium/cc/quads/content_draw_quad_base.h
+++ b/chromium/cc/quads/content_draw_quad_base.h
@@ -8,7 +8,6 @@
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/quads/draw_quad.h"
-#include "third_party/khronos/GLES2/gl2.h"
#include "ui/gfx/point.h"
#include "ui/gfx/size.h"
diff --git a/chromium/cc/resources/resource_provider.h b/chromium/cc/resources/resource_provider.h
index 6e5c61a2bfa..2478661d62c 100644
--- a/chromium/cc/resources/resource_provider.h
+++ b/chromium/cc/resources/resource_provider.h
@@ -25,8 +25,6 @@
#include "cc/resources/single_release_callback.h"
#include "cc/resources/texture_mailbox.h"
#include "cc/resources/transferable_resource.h"
-#include "third_party/khronos/GLES2/gl2.h"
-#include "third_party/khronos/GLES2/gl2ext.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/size.h"
@@ -36,6 +34,9 @@ namespace gles {
class GLES2Interface;
}
}
+// A correct fix would be not to use GL types in this interal API file.
+typedef unsigned int GLenum;
+typedef int GLint;
namespace gfx {
class Rect;
@@ -525,36 +526,6 @@ inline unsigned BitsPerPixel(ResourceFormat format) {
return format_bits_per_pixel[format];
}
-inline GLenum GLDataType(ResourceFormat format) {
- DCHECK_LE(format, RESOURCE_FORMAT_MAX);
- static const unsigned format_gl_data_type[RESOURCE_FORMAT_MAX + 1] = {
- GL_UNSIGNED_BYTE, // RGBA_8888
- GL_UNSIGNED_SHORT_4_4_4_4, // RGBA_4444
- GL_UNSIGNED_BYTE, // BGRA_8888
- GL_UNSIGNED_BYTE, // LUMINANCE_8
- GL_UNSIGNED_SHORT_5_6_5, // RGB_565,
- GL_UNSIGNED_BYTE // ETC1
- };
- return format_gl_data_type[format];
-}
-
-inline GLenum GLDataFormat(ResourceFormat format) {
- DCHECK_LE(format, RESOURCE_FORMAT_MAX);
- static const unsigned format_gl_data_format[RESOURCE_FORMAT_MAX + 1] = {
- GL_RGBA, // RGBA_8888
- GL_RGBA, // RGBA_4444
- GL_BGRA_EXT, // BGRA_8888
- GL_LUMINANCE, // LUMINANCE_8
- GL_RGB, // RGB_565
- GL_ETC1_RGB8_OES // ETC1
- };
- return format_gl_data_format[format];
-}
-
-inline GLenum GLInternalFormat(ResourceFormat format) {
- return GLDataFormat(format);
-}
-
} // namespace cc
#endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
diff --git a/chromium/content/renderer/gpu/mailbox_output_surface.cc b/chromium/content/renderer/gpu/mailbox_output_surface.cc
index 09e1ec0f7ac..b23575da9ac 100644
--- a/chromium/content/renderer/gpu/mailbox_output_surface.cc
+++ b/chromium/content/renderer/gpu/mailbox_output_surface.cc
@@ -5,6 +5,7 @@
#include "content/renderer/gpu/mailbox_output_surface.h"
#include "base/logging.h"
+#include "cc/base/util.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_ack.h"
#include "cc/output/gl_frame_data.h"