Title: [109809] trunk/Source/WebCore
- Revision
- 109809
- Author
- [email protected]
- Date
- 2012-03-05 15:50:13 -0800 (Mon, 05 Mar 2012)
Log Message
[BlackBerry] Upstream LayerRendererSurface.{cpp, h}
https://bugs.webkit.org/show_bug.cgi?id=80122
Patch by Robin Cao <[email protected]> on 2012-03-05
Reviewed by Rob Buis.
Initial upstream, no new tests.
* PlatformBlackBerry.cmake:
* platform/graphics/blackberry/LayerRendererSurface.cpp: Added.
(WebCore):
(WebCore::LayerRendererSurface::LayerRendererSurface):
(WebCore::LayerRendererSurface::~LayerRendererSurface):
(WebCore::LayerRendererSurface::setContentRect):
(WebCore::LayerRendererSurface::drawRect):
(WebCore::LayerRendererSurface::ensureTexture):
(WebCore::LayerRendererSurface::releaseTexture):
* platform/graphics/blackberry/LayerRendererSurface.h: Added.
(WebCore):
(LayerRendererSurface):
(WebCore::LayerRendererSurface::size):
(WebCore::LayerRendererSurface::contentRect):
(WebCore::LayerRendererSurface::clipRect):
(WebCore::LayerRendererSurface::setClipRect):
(WebCore::LayerRendererSurface::setDrawTransform):
(WebCore::LayerRendererSurface::drawTransform):
(WebCore::LayerRendererSurface::setReplicaDrawTransform):
(WebCore::LayerRendererSurface::replicaDrawTransform):
(WebCore::LayerRendererSurface::texture):
(WebCore::LayerRendererSurface::drawOpacity):
(WebCore::LayerRendererSurface::setDrawOpacity):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (109808 => 109809)
--- trunk/Source/WebCore/ChangeLog 2012-03-05 23:45:40 UTC (rev 109808)
+++ trunk/Source/WebCore/ChangeLog 2012-03-05 23:50:13 UTC (rev 109809)
@@ -1,3 +1,36 @@
+2012-03-05 Robin Cao <[email protected]>
+
+ [BlackBerry] Upstream LayerRendererSurface.{cpp, h}
+ https://bugs.webkit.org/show_bug.cgi?id=80122
+
+ Reviewed by Rob Buis.
+
+ Initial upstream, no new tests.
+
+ * PlatformBlackBerry.cmake:
+ * platform/graphics/blackberry/LayerRendererSurface.cpp: Added.
+ (WebCore):
+ (WebCore::LayerRendererSurface::LayerRendererSurface):
+ (WebCore::LayerRendererSurface::~LayerRendererSurface):
+ (WebCore::LayerRendererSurface::setContentRect):
+ (WebCore::LayerRendererSurface::drawRect):
+ (WebCore::LayerRendererSurface::ensureTexture):
+ (WebCore::LayerRendererSurface::releaseTexture):
+ * platform/graphics/blackberry/LayerRendererSurface.h: Added.
+ (WebCore):
+ (LayerRendererSurface):
+ (WebCore::LayerRendererSurface::size):
+ (WebCore::LayerRendererSurface::contentRect):
+ (WebCore::LayerRendererSurface::clipRect):
+ (WebCore::LayerRendererSurface::setClipRect):
+ (WebCore::LayerRendererSurface::setDrawTransform):
+ (WebCore::LayerRendererSurface::drawTransform):
+ (WebCore::LayerRendererSurface::setReplicaDrawTransform):
+ (WebCore::LayerRendererSurface::replicaDrawTransform):
+ (WebCore::LayerRendererSurface::texture):
+ (WebCore::LayerRendererSurface::drawOpacity):
+ (WebCore::LayerRendererSurface::setDrawOpacity):
+
2012-03-05 Mihnea Ovidenie <[email protected]>
[CSSRegions][CSSOM]Prevent creation of NamedFlow object for invalid flow name
Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (109808 => 109809)
--- trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-03-05 23:45:40 UTC (rev 109808)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-03-05 23:50:13 UTC (rev 109809)
@@ -238,6 +238,7 @@
${WEBCORE_DIR}/platform/graphics/blackberry/LayerAnimation.cpp
${WEBCORE_DIR}/platform/graphics/blackberry/LayerCompositingThread.cpp
${WEBCORE_DIR}/platform/graphics/blackberry/LayerRenderer.cpp
+ ${WEBCORE_DIR}/platform/graphics/blackberry/LayerRendererSurface.cpp
${WEBCORE_DIR}/platform/graphics/blackberry/LayerTile.cpp
${WEBCORE_DIR}/platform/graphics/blackberry/LayerTiler.cpp
${WEBCORE_DIR}/platform/graphics/blackberry/LayerWebKitThread.cpp
Added: trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.cpp (0 => 109809)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.cpp 2012-03-05 23:50:13 UTC (rev 109809)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerRendererSurface.h"
+
+#include "LayerCompositingThread.h"
+#include "LayerRenderer.h"
+#include "TextureCacheCompositingThread.h"
+
+namespace WebCore {
+
+LayerRendererSurface::LayerRendererSurface(LayerRenderer* renderer, LayerCompositingThread* owner)
+ : m_ownerLayer(owner)
+ , m_layerRenderer(renderer)
+ , m_opacity(1.0)
+{
+}
+
+LayerRendererSurface::~LayerRendererSurface()
+{
+}
+
+void LayerRendererSurface::setContentRect(const IntRect& contentRect)
+{
+ m_contentRect = contentRect;
+ m_size = contentRect.size();
+}
+
+FloatRect LayerRendererSurface::drawRect() const
+{
+ float bx = m_size.width() / 2.0;
+ float by = m_size.height() / 2.0;
+
+ FloatQuad transformedBounds;
+ transformedBounds.setP1(m_drawTransform.mapPoint(FloatPoint(-bx, -by)));
+ transformedBounds.setP2(m_drawTransform.mapPoint(FloatPoint(-bx, by)));
+ transformedBounds.setP3(m_drawTransform.mapPoint(FloatPoint(bx, by)));
+ transformedBounds.setP4(m_drawTransform.mapPoint(FloatPoint(bx, -by)));
+
+ FloatRect rect = transformedBounds.boundingBox();
+
+ if (m_ownerLayer->replicaLayer()) {
+ FloatQuad bounds;
+ bounds.setP1(m_replicaDrawTransform.mapPoint(FloatPoint(-bx, -by)));
+ bounds.setP2(m_replicaDrawTransform.mapPoint(FloatPoint(-bx, by)));
+ bounds.setP3(m_replicaDrawTransform.mapPoint(FloatPoint(bx, by)));
+ bounds.setP4(m_replicaDrawTransform.mapPoint(FloatPoint(bx, -by)));
+ rect.unite(bounds.boundingBox());
+ }
+
+ return rect;
+}
+
+bool LayerRendererSurface::ensureTexture()
+{
+ if (!m_texture)
+ m_texture = textureCacheCompositingThread()->createTexture();
+
+ return m_texture->protect(m_size);
+}
+
+void LayerRendererSurface::releaseTexture()
+{
+ m_texture->unprotect();
+}
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
Added: trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.h (0 => 109809)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.h 2012-03-05 23:50:13 UTC (rev 109809)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef LayerRendererSurface_h
+#define LayerRendererSurface_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "FloatRect.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include "Texture.h"
+#include "TransformationMatrix.h"
+
+namespace WebCore {
+
+class LayerCompositingThread;
+class LayerRenderer;
+
+class LayerRendererSurface {
+ WTF_MAKE_NONCOPYABLE(LayerRendererSurface);
+public:
+ LayerRendererSurface(LayerRenderer*, LayerCompositingThread* owner);
+ ~LayerRendererSurface();
+
+ IntSize size() const { return m_size; }
+
+ FloatRect contentRect() const { return m_contentRect; }
+ void setContentRect(const IntRect&);
+ FloatRect clipRect() const { return m_clipRect; }
+ void setClipRect(const FloatRect& rect) { m_clipRect = rect; }
+
+ void setDrawTransform(const TransformationMatrix& matrix) { m_drawTransform = matrix; }
+ const TransformationMatrix& drawTransform() const { return m_drawTransform; }
+ void setReplicaDrawTransform(const TransformationMatrix& matrix) { m_replicaDrawTransform = matrix; }
+ const TransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
+
+ FloatRect drawRect() const;
+
+ bool ensureTexture();
+ void releaseTexture();
+ Texture* texture() const { return m_texture.get(); }
+
+ float drawOpacity() { return m_opacity; }
+ void setDrawOpacity(float opacity) { m_opacity = opacity; }
+
+private:
+ RefPtr<Texture> m_texture;
+
+ FloatRect m_contentRect;
+ FloatRect m_clipRect;
+
+ TransformationMatrix m_surfaceMatrix;
+ TransformationMatrix m_drawTransform;
+ TransformationMatrix m_replicaDrawTransform;
+
+ LayerCompositingThread* m_ownerLayer;
+ LayerRenderer* m_layerRenderer;
+
+ float m_opacity;
+
+ IntSize m_size;
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // LayerRendererSurface_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes