From f640a7757e6346e833bd9d9df54ca42fe65d68cb Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Sat, 22 Feb 2014 04:56:02 -0800 Subject: [PATCH] Bug 957276 - Fix YFlipped buffer's source crop r=sushil --- widget/gonk/HwcComposer2D.cpp | 1 + widget/gonk/HwcUtils.cpp | 4 ++++ widget/gonk/HwcUtils.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/widget/gonk/HwcComposer2D.cpp b/widget/gonk/HwcComposer2D.cpp index 361ccff85d48..f1ee00a5c27b 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 acd4e37b6280..4afd3753974b 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 0c5c6ab46339..9f3d7c93fde0 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); -- 2.11.4.GIT