Rotation related code needed when Direct Rendering is on are added.
Change-Id: I900e883e0fb24afd17f7b65beed0ddefdf3303c8
#endif
namespace WebCore {
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+static int gAngle = 0;
+#endif
struct TextureMapperGLData {
struct SharedGLData : public RefCounted<SharedGLData> {
GLint viewport[4];
GL_CMD(glGetIntegerv(GL_VIEWPORT, viewport));
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ if (gAngle == 90)
+ GL_CMD(glScissor(viewport[3] - rect.maxX(), viewport[2] - rect.maxY(), rect.width(), rect.height()));
+ else if (gAngle == 180)
+ GL_CMD(glScissor(viewport[2] - rect.maxX(), rect.y(), rect.width(), rect.height()));
+ else if (gAngle == 270)
+ GL_CMD(glScissor(rect.x(), rect.y(), rect.width(), rect.height()));
+ else
+#endif
+
GL_CMD(glScissor(rect.x(), viewport[3] - rect.maxY(), rect.width(), rect.height()));
}
return data().currentSurface ? toBitmapTextureGL(data().currentSurface.get())->m_clipStack : m_clipStack;
}
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+void TextureMapperGL::setAngle(int angle)
+{
+ gAngle = angle;
+}
+#endif
+
void TextureMapperGL::beginPainting(PaintFlags flags)
{
// Make sure that no GL error code stays from previous operations.
}
#endif
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored, int angle = 0)
+#else
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored)
+#endif
{
const float near = 9999999;
const float far = -99999;
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ if (angle == 90 || angle == 270)
+ return TransformationMatrix(2.0 / float(size.height()), 0, 0, 0,
+ 0, (mirrored ? 2.0 : -2.0) / float(size.width()), 0, 0,
+ 0, 0, -2.f / (far - near), 0,
+ -1, mirrored ? -1 : 1, -(far + near) / (far - near), 1);
+ else
+#endif
return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0,
0, (mirrored ? 2.0 : -2.0) / float(size.height()), 0, 0,
0, 0, -2.f / (far - near), 0,
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, data().targetFrameBuffer));
IntSize viewportSize(data().viewport[2], data().viewport[3]);
+#if !ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
data().projectionMatrix = createProjectionMatrix(viewportSize, data().PaintFlags & PaintingMirrored);
+#else
+ data().projectionMatrix = createProjectionMatrix(viewportSize, data().PaintFlags & PaintingMirrored, gAngle);
+#endif
#if !USE(TIZEN_TEXTURE_MAPPER)
GL_CMD(glViewport(data().viewport[0], data().viewport[1], viewportSize.width(), viewportSize.height()));
if (!quad.isRectilinear() || rect.isEmpty())
return false;
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ if (gAngle == 90 || gAngle == 270)
+ rect = IntRect(rect.y(), rect.x(), rect.height(), rect.width());
+#endif
+
clipStack().current().scissorBox.intersect(rect);
clipStack().apply();
return true;
virtual AccelerationMode accelerationMode() const OVERRIDE { return OpenGLMode; }
virtual void setGraphicsContext(GraphicsContext* context) OVERRIDE { m_context = context; }
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ void setAngle(int angle);
+#endif
+
#if ENABLE(CSS_FILTERS)
void drawFiltered(const BitmapTexture& sourceTexture, const BitmapTexture& contentTexture, const FilterOperation&);
#endif
, m_context(0)
, m_surface(0)
, m_config(0)
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ , m_angle(0)
+#endif
, m_isAcceleratedCompositingModeInitialized(false)
#endif
#endif
// ex) Navigate user typed URL, then IME is hidden and visible content rect's size can be changed.
m_visibleContentRectForDrawContents.setSize(m_visibleContentRect.size());
}
-
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewWidget));
+ int angle = ecore_evas_rotation_get(ee);
+ m_angle = angle;
+ if (drawingArea())
+ drawingArea()->setAngle(m_angle);
+ matrix.makeIdentity();
+ matrix.rotate3d(0.0, 0.0, 1.0, 360 - m_angle);
+ if (m_angle == 90 || m_angle == 270) {
+ glViewport(0, 0, m_visibleContentRectForDrawContents.height(), m_visibleContentRectForDrawContents.width());
+ if (m_angle == 90)
+ matrix.translate(-m_visibleContentRectForDrawContents.x() -m_visibleContentRectForDrawContents.width(), -m_visibleContentRectForDrawContents.y());
+ else if (m_angle == 270)
+ matrix.translate(-m_visibleContentRectForDrawContents.x(), -m_visibleContentRectForDrawContents.y() - m_visibleContentRectForDrawContents.height());
+ matrix.scale(m_scaleFactor);
+ clipRect = IntRect(0, 0, m_visibleContentRectForDrawContents.height(), m_visibleContentRectForDrawContents.width());
+ } else {
+ glViewport(0, 0, m_visibleContentRectForDrawContents.width(), m_visibleContentRectForDrawContents.height());
+ if (m_angle == 180) {
+ matrix.translate(-m_visibleContentRectForDrawContents.x() - m_visibleContentRectForDrawContents.width(), -m_visibleContentRectForDrawContents.y() - m_visibleContentRectForDrawContents.height());
+ matrix.scale(m_scaleFactor);
+ } else
+ matrix.setMatrix(m_scaleFactor, 0, 0, m_scaleFactor, -m_visibleContentRectForDrawContents.x(), -m_visibleContentRectForDrawContents.y());
+ clipRect = IntRect(IntPoint(), m_visibleContentRectForDrawContents.size());
+ }
+#else
glViewport(0, 0, m_visibleContentRectForDrawContents.width(), m_visibleContentRectForDrawContents.height());
matrix.setMatrix(m_scaleFactorForDrawContents, 0, 0, m_scaleFactorForDrawContents, -m_visibleContentRectForDrawContents.x(), -m_visibleContentRectForDrawContents.y());
clipRect = IntRect(IntPoint(), m_visibleContentRectForDrawContents.size());
+#endif
float bgRed, bgGreen, bgBlue, bgAlpha;
m_bgColor.getRGBA(bgRed, bgGreen, bgBlue, bgAlpha);
Evas_Native_Surface nativeSurface;
evas_gl_native_surface_get(m_evasGL, m_surface, &nativeSurface);
ewk_view_image_native_surface_set(page()->viewWidget(), &nativeSurface);
+
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewWidget));
+ int angle = ecore_evas_rotation_get(ee);
+ m_angle = angle;
+ drawingArea()->setAngle(m_angle);
+#endif
}
#endif
Evas_GL_Context* m_context;
Evas_GL_Surface* m_surface;
Evas_GL_Config* m_config;
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ int m_angle;
+#endif
bool m_isAcceleratedCompositingModeInitialized;
#endif
#endif
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
virtual void didSuspendPainting() { }
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ virtual void setAngle(int) { }
+#endif
#endif
protected:
m_layerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, scale, trajectoryVector, accurateVisibleContentsPosition);
}
+#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+void DrawingAreaProxyImpl::setAngle(int angle)
+{
+ if (m_layerTreeHostProxy)
+ m_layerTreeHostProxy->setAngle(angle);
+}
+#endif
+#endif
+
#if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
void DrawingAreaProxyImpl::setVisibleContentsRectForScrollingContentsLayers(const WebCore::IntRect& visibleRect)
{
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
virtual void didSuspendPainting();
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ virtual void setAngle(int);
+#endif
#endif
private:
m_renderer->setActive(true);
renderNextFrame();
}
+
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+void LayerTreeHostProxy::setAngle(int angle)
+{
+ m_renderer->setAngle(angle);
+}
+#endif
#endif
#if ENABLE(TIZEN_ONESHOT_DRAWING_SYNCHRONIZATION)
WebLayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); }
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ void setAngle(int);
+#endif
+
void clearBackingStores();
void restoreBackingStores();
#endif
: m_layerTreeHostProxy(layerTreeHostProxy)
, m_rootLayerID(InvalidWebLayerID)
, m_isActive(false)
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ , m_angle(0)
+#endif
{
}
if (!layer)
return;
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ static_cast<TextureMapperGL*>(m_textureMapper.get())->setAngle(m_angle);
+#endif
+
layer->setTextureMapper(m_textureMapper.get());
m_textureMapper->beginPainting(PaintFlags);
m_textureMapper->beginClip(TransformationMatrix(), clipRect);
virtual void platformLayerChanged(WebCore::GraphicsLayer*, WebCore::PlatformLayer* oldPlatformLayer, WebCore::PlatformLayer* newPlatformLayer);
#endif
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ void setAngle(int angle) { m_angle = angle; }
+#endif
+
#if ENABLE(TIZEN_ONESHOT_DRAWING_SYNCHRONIZATION)
void setNeedsOneShotDrawingSynchronization();
void doOneShotDrawingSynchronization();
#if ENABLE(TIZEN_WEBKIT2_TILED_AC)
DrawingAreaProxy* m_drawingAreaProxy;
+#if ENABLE(TIZEN_WEBKIT2_DIRECT_RENDERING)
+ int m_angle;
+#endif
#if ENABLE(TIZEN_ONESHOT_DRAWING_SYNCHRONIZATION)
bool m_needsOneShotDrawingSynchronization;
#endif