Diff
Modified: trunk/Source/WebCore/ChangeLog (135705 => 135706)
--- trunk/Source/WebCore/ChangeLog 2012-11-26 12:10:28 UTC (rev 135705)
+++ trunk/Source/WebCore/ChangeLog 2012-11-26 12:32:15 UTC (rev 135706)
@@ -1,3 +1,46 @@
+2012-11-26 Zeno Albisser <[email protected]>
+
+ GraphicsSurface should only store its size in a single place.
+ https://bugs.webkit.org/show_bug.cgi?id=103143
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * platform/graphics/qt/GraphicsContext3DQt.cpp:
+ (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+ Cosmetics only.
+ * platform/graphics/surfaces/GraphicsSurface.cpp:
+ (WebCore::GraphicsSurface::size):
+ Return the size as received from the platform abstraction.
+ (WebCore):
+ (WebCore::GraphicsSurface::GraphicsSurface):
+ * platform/graphics/surfaces/GraphicsSurface.h:
+ (GraphicsSurface):
+ Remove data member m_size.
+ * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
+ (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+ Always take the size of the GraphicsSurface as an argument.
+ (WebCore::GraphicsSurfacePrivate::size):
+ (GraphicsSurfacePrivate):
+ (WebCore::GraphicsSurface::platformPaintToTextureMapper):
+ Retrieve the size from GraphicsSurfacePrivate where necessary.
+ (WebCore::GraphicsSurface::platformSize):
+ (WebCore):
+ (WebCore::GraphicsSurface::platformImport):
+ * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp:
+ (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+ Add a constructor that takes a window id as an argument
+ for the receiving side of the GraphcisSurface.
+ The GraphicsSurface can then determine its dimensions
+ from the provided XWindow.
+ (WebCore::GraphicsSurfacePrivate::createPixmap):
+ (WebCore::GraphicsSurfacePrivate::size):
+ Query the size of the GraphicsSurface backing from X.
+ (WebCore::GraphicsSurface::platformPaintToTextureMapper):
+ Retrieve the size from GraphicsSurfacePrivate where necessary.
+ (WebCore::GraphicsSurface::platformSize):
+ (WebCore):
+ (WebCore::GraphicsSurface::platformImport):
+
2012-11-26 Thiago Santos <[email protected]>
[GStreamer] Floating reference handling fix
Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (135705 => 135706)
--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp 2012-11-26 12:10:28 UTC (rev 135705)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp 2012-11-26 12:32:15 UTC (rev 135706)
@@ -144,9 +144,8 @@
m_surfaceFlags = GraphicsSurface::SupportsTextureTarget
| GraphicsSurface::SupportsSharing;
- if (!surfaceSize.isEmpty()) {
+ if (!surfaceSize.isEmpty())
m_graphicsSurface = GraphicsSurface::create(surfaceSize, m_surfaceFlags, m_platformContext);
- }
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp (135705 => 135706)
--- trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp 2012-11-26 12:10:28 UTC (rev 135705)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp 2012-11-26 12:32:15 UTC (rev 135706)
@@ -78,9 +78,13 @@
return platformSwapBuffers();
}
+IntSize GraphicsSurface::size() const
+{
+ return platformSize();
+}
+
GraphicsSurface::GraphicsSurface(const IntSize& size, Flags flags)
: m_flags(flags)
- , m_size(size)
, m_platformSurface(0)
, m_texture(0)
, m_fbo(0)
Modified: trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h (135705 => 135706)
--- trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h 2012-11-26 12:10:28 UTC (rev 135705)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h 2012-11-26 12:32:15 UTC (rev 135706)
@@ -74,7 +74,7 @@
Flags flags() const { return m_flags; }
PlatformGraphicsSurface platformSurface() const { return m_platformSurface; }
- IntSize size() const { return m_size; }
+ IntSize size() const;
static PassRefPtr<GraphicsSurface> create(const IntSize&, Flags, const PlatformGraphicsContext3D shareContext = 0);
static PassRefPtr<GraphicsSurface> create(const IntSize&, Flags, const GraphicsSurfaceToken&);
@@ -103,6 +103,7 @@
void platformPaintToTextureMapper(TextureMapper*, const FloatRect& targetRect, const TransformationMatrix&, float opacity, BitmapTexture* mask);
uint32_t platformFrontBuffer() const;
uint32_t platformSwapBuffers();
+ IntSize platformSize() const;
PassOwnPtr<GraphicsContext> platformBeginPaint(const IntSize&, char* bits, int stride);
@@ -118,7 +119,6 @@
#endif
private:
- IntSize m_size;
PlatformGraphicsSurface m_platformSurface;
uint32_t m_texture;
uint32_t m_fbo;
Modified: trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp (135705 => 135706)
--- trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp 2012-11-26 12:10:28 UTC (rev 135705)
+++ trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp 2012-11-26 12:32:15 UTC (rev 135706)
@@ -72,8 +72,9 @@
struct GraphicsSurfacePrivate {
public:
- GraphicsSurfacePrivate(const GraphicsSurfaceToken& token)
+ GraphicsSurfacePrivate(const GraphicsSurfaceToken& token, const IntSize& size)
: m_context(0)
+ , m_size(size)
, m_token(token)
, m_frontBufferTexture(0)
, m_backBufferTexture(0)
@@ -86,6 +87,7 @@
GraphicsSurfacePrivate(const PlatformGraphicsContext3D shareContext, const IntSize& size, GraphicsSurface::Flags flags)
: m_context(0)
+ , m_size(size)
, m_frontBufferTexture(0)
, m_backBufferTexture(0)
, m_readFbo(0)
@@ -106,8 +108,8 @@
unsigned pixelFormat = 'BGRA';
unsigned bytesPerElement = 4;
- int width = size.width();
- int height = size.height();
+ int width = m_size.width();
+ int height = m_size.height();
unsigned long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, width * bytesPerElement);
if (!bytesPerRow)
@@ -269,8 +271,14 @@
return m_backBuffer;
}
+ IntSize size() const
+ {
+ return m_size;
+ }
+
private:
CGLContextObj m_context;
+ IntSize m_size;
CGLContextObj m_detachedContext;
PlatformGraphicsSurface m_frontBuffer;
PlatformGraphicsSurface m_backBuffer;
@@ -322,8 +330,8 @@
void GraphicsSurface::platformPaintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
{
TransformationMatrix adjustedTransform = transform;
- adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_size), targetRect));
- static_cast<TextureMapperGL*>(textureMapper)->drawTextureRectangleARB(m_private->frontBufferTextureID(), 0, m_size, targetRect, adjustedTransform, opacity, mask);
+ adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_private->size()), targetRect));
+ static_cast<TextureMapperGL*>(textureMapper)->drawTextureRectangleARB(m_private->frontBufferTextureID(), 0, m_private->size(), targetRect, adjustedTransform, opacity, mask);
}
uint32_t GraphicsSurface::platformFrontBuffer() const
@@ -336,6 +344,11 @@
return m_private->swapBuffers();
}
+IntSize GraphicsSurface::platformSize() const
+{
+ return m_private->size();
+}
+
PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags, const PlatformGraphicsContext3D shareContext)
{
// We currently disable support for CopyToTexture on Mac, because this is used for single buffered Tiles.
@@ -362,7 +375,7 @@
return PassRefPtr<GraphicsSurface>();
RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
- surface->m_private = new GraphicsSurfacePrivate(token);
+ surface->m_private = new GraphicsSurfacePrivate(token, size);
if (!surface->m_private->frontBuffer() || !surface->m_private->backBuffer())
return PassRefPtr<GraphicsSurface>();
Modified: trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp (135705 => 135706)
--- trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp 2012-11-26 12:10:28 UTC (rev 135705)
+++ trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp 2012-11-26 12:32:15 UTC (rev 135706)
@@ -199,6 +199,20 @@
m_glContext = glXCreateNewContext(m_display, m_fbConfig, GLX_RGBA_TYPE, shareContextObject, true);
}
+ GraphicsSurfacePrivate(uint32_t winId)
+ : m_display(m_offScreenWindow.display())
+ , m_xPixmap(0)
+ , m_glxPixmap(0)
+ , m_surface(winId)
+ , m_glxSurface(0)
+ , m_glContext(0)
+ , m_detachedContext(0)
+ , m_detachedSurface(0)
+ , m_fbConfig(0)
+ , m_textureIsYInverted(false)
+ , m_hasAlpha(false)
+ { }
+
~GraphicsSurfacePrivate()
{
if (m_glxPixmap)
@@ -249,7 +263,6 @@
XRenderPictFormat* format = XRenderFindVisualFormat(m_display, attr.visual);
m_hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask);
- m_size = IntSize(attr.width, attr.height);
int numberOfConfigs;
GLXFBConfig* configs = glXChooseFBConfig(m_display, XDefaultScreen(m_display), glxSpec, &numberOfConfigs);
@@ -337,7 +350,15 @@
GLXPixmap glxPixmap() const { return m_glxPixmap; }
- IntSize size() const { return m_size; }
+ IntSize size() const
+ {
+ if (m_size.isEmpty()) {
+ XWindowAttributes attr;
+ XGetWindowAttributes(m_display, m_surface, &attr);
+ const_cast<GraphicsSurfacePrivate*>(this)->m_size = IntSize(attr.width, attr.height);
+ }
+ return m_size;
+ }
private:
OffScreenRootWindow m_offScreenWindow;
@@ -408,10 +429,10 @@
{
TextureMapperGL* texMapGL = static_cast<TextureMapperGL*>(textureMapper);
TransformationMatrix adjustedTransform = transform;
- adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_size), targetRect));
+ adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_private->size()), targetRect));
TextureMapperGL::Flags flags = m_private->textureIsYInverted() ? TextureMapperGL::ShouldFlipTexture : 0;
flags |= TextureMapperGL::SupportsBlending;
- texMapGL->drawTexture(platformGetTextureID(), flags, m_size, targetRect, adjustedTransform, opacity, mask);
+ texMapGL->drawTexture(platformGetTextureID(), flags, m_private->size(), targetRect, adjustedTransform, opacity, mask);
}
uint32_t GraphicsSurface::platformFrontBuffer() const
@@ -425,6 +446,11 @@
return 0;
}
+IntSize GraphicsSurface::platformSize() const
+{
+ return m_private->size();
+}
+
PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags, const PlatformGraphicsContext3D shareContext)
{
// X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested.
@@ -453,15 +479,13 @@
return PassRefPtr<GraphicsSurface>();
RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags));
+ surface->m_platformSurface = token.frontBufferHandle;
- surface->m_private = new GraphicsSurfacePrivate();
+ surface->m_private = new GraphicsSurfacePrivate(surface->m_platformSurface);
if (!resolveGLMethods(surface->m_private))
return PassRefPtr<GraphicsSurface>();
- surface->m_platformSurface = token.frontBufferHandle;
-
surface->m_private->createPixmap(surface->m_platformSurface);
- surface->m_size = surface->m_private->size();
return surface;
}