diff --git a/widget/gonk/HwcComposer2D.cpp b/widget/gonk/HwcComposer2D.cpp index 361ccff85d4..f1ee00a5c27 100644 --- a/widget/gonk/HwcComposer2D.cpp +++ b/widget/gonk/HwcComposer2D.cpp @@ -287,6 +287,7 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer, transform * aGLWorldTransform, clip, bufferRect, + state.YFlipped(), &(sourceCrop), &(hwcLayer.displayFrame))) { diff --git a/widget/gonk/HwcUtils.cpp b/widget/gonk/HwcUtils.cpp index acd4e37b628..4afd3753974 100644 --- a/widget/gonk/HwcUtils.cpp +++ b/widget/gonk/HwcUtils.cpp @@ -38,6 +38,7 @@ namespace mozilla { /* static */ bool HwcUtils::PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform, nsIntRect aClip, nsIntRect aBufferRect, + bool aYFlipped, hwc_rect_t* aSourceCrop, hwc_rect_t* aVisibleRegionScreen) { gfxRect visibleRect(aVisible); @@ -70,6 +71,9 @@ HwcUtils::PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform, // Map from layer space to buffer space crop -= aBufferRect.TopLeft(); + if (aYFlipped) { + crop.y = aBufferRect.height - (crop.y + crop.height); + } aSourceCrop->left = crop.x; aSourceCrop->top = crop.y; diff --git a/widget/gonk/HwcUtils.h b/widget/gonk/HwcUtils.h index 0c5c6ab4633..9f3d7c93fde 100644 --- a/widget/gonk/HwcUtils.h +++ b/widget/gonk/HwcUtils.h @@ -100,6 +100,7 @@ static bool PrepareVisibleRegion(const nsIntRegion& aVisible, * The origin is the top-left corner of the screen * @param aBufferRect Input. The layer's buffer bounds * The origin is the top-left corner of the layer + * @param aYFlipped Input. true if the buffer is rendered as Y flipped * @param aSurceCrop Output. Area of the source to consider, * the origin is the top-left corner of the buffer * @param aVisibleRegionScreen Output. Visible region in screen space. @@ -109,6 +110,7 @@ static bool PrepareVisibleRegion(const nsIntRegion& aVisible, */ static bool PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform, nsIntRect aClip, nsIntRect aBufferRect, + bool aYFlipped, hwc_rect_t* aSourceCrop, hwc_rect_t* aVisibleRegionScreen);