mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 952977: Various other changes of gfx3DMatrix -> Matrix4x4 r=nical
This commit is contained in:
parent
4b4513563e
commit
07112b161c
@ -100,6 +100,8 @@ using namespace mozilla::layers;
|
|||||||
using namespace mozilla::gl;
|
using namespace mozilla::gl;
|
||||||
using namespace mozilla::widget;
|
using namespace mozilla::widget;
|
||||||
|
|
||||||
|
using mozilla::gfx::Matrix4x4;
|
||||||
|
|
||||||
#undef DEBUG_UPDATE
|
#undef DEBUG_UPDATE
|
||||||
#undef INVALIDATE_DEBUGGING // flash areas as they are invalidated
|
#undef INVALIDATE_DEBUGGING // flash areas as they are invalidated
|
||||||
|
|
||||||
@ -325,7 +327,7 @@ public:
|
|||||||
|
|
||||||
void Draw(mozilla::layers::GLManager* aManager,
|
void Draw(mozilla::layers::GLManager* aManager,
|
||||||
const nsIntPoint& aLocation,
|
const nsIntPoint& aLocation,
|
||||||
const gfx3DMatrix& aTransform = gfx3DMatrix());
|
const Matrix4x4& aTransform = Matrix4x4());
|
||||||
|
|
||||||
static nsIntSize TextureSizeForSize(const nsIntSize& aSize);
|
static nsIntSize TextureSizeForSize(const nsIntSize& aSize);
|
||||||
|
|
||||||
@ -2522,8 +2524,8 @@ nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect
|
|||||||
aManager->gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_SRC_ALPHA,
|
aManager->gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_SRC_ALPHA,
|
||||||
LOCAL_GL_ZERO, LOCAL_GL_SRC_ALPHA);
|
LOCAL_GL_ZERO, LOCAL_GL_SRC_ALPHA);
|
||||||
|
|
||||||
gfx3DMatrix flipX = gfx3DMatrix::ScalingMatrix(-1, 1, 1);
|
Matrix4x4 flipX = Matrix4x4().Scale(-1, 1, 1);
|
||||||
gfx3DMatrix flipY = gfx3DMatrix::ScalingMatrix(1, -1, 1);
|
Matrix4x4 flipY = Matrix4x4().Scale(1, -1, 1);
|
||||||
|
|
||||||
if (mIsCoveringTitlebar && !mIsFullscreen) {
|
if (mIsCoveringTitlebar && !mIsFullscreen) {
|
||||||
// Mask the top corners.
|
// Mask the top corners.
|
||||||
@ -2849,7 +2851,7 @@ RectTextureImage::UpdateFromDrawTarget(const nsIntSize& aNewSize,
|
|||||||
void
|
void
|
||||||
RectTextureImage::Draw(GLManager* aManager,
|
RectTextureImage::Draw(GLManager* aManager,
|
||||||
const nsIntPoint& aLocation,
|
const nsIntPoint& aLocation,
|
||||||
const gfx3DMatrix& aTransform)
|
const Matrix4x4& aTransform)
|
||||||
{
|
{
|
||||||
ShaderProgramOGL* program = aManager->GetProgram(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
|
ShaderProgramOGL* program = aManager->GetProgram(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
|
||||||
gfx::SurfaceFormat::R8G8B8A8);
|
gfx::SurfaceFormat::R8G8B8A8);
|
||||||
@ -2858,8 +2860,7 @@ RectTextureImage::Draw(GLManager* aManager,
|
|||||||
|
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetProjectionMatrix(aManager->GetProjMatrix());
|
program->SetProjectionMatrix(aManager->GetProjMatrix());
|
||||||
gfx::Matrix4x4 transform = gfx::ToMatrix4x4(aTransform);
|
program->SetLayerTransform(aTransform * gfx::Matrix4x4().Translate(aLocation.x, aLocation.y, 0));
|
||||||
program->SetLayerTransform(transform * gfx::Matrix4x4().Translate(aLocation.x, aLocation.y, 0));
|
|
||||||
program->SetTextureTransform(gfx::Matrix4x4());
|
program->SetTextureTransform(gfx::Matrix4x4());
|
||||||
program->SetRenderOffset(nsIntPoint(0, 0));
|
program->SetRenderOffset(nsIntPoint(0, 0));
|
||||||
program->SetTexCoordMultiplier(mUsedSize.width, mUsedSize.height);
|
program->SetTexCoordMultiplier(mUsedSize.width, mUsedSize.height);
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#define LAYER_COUNT_INCREMENTS 5
|
#define LAYER_COUNT_INCREMENTS 5
|
||||||
|
|
||||||
using namespace android;
|
using namespace android;
|
||||||
|
using namespace mozilla::gfx;
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -193,8 +194,8 @@ HwcComposer2D::setHwcGeometry(bool aGeometryChanged)
|
|||||||
bool
|
bool
|
||||||
HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||||
const nsIntRect& aClip,
|
const nsIntRect& aClip,
|
||||||
const gfxMatrix& aParentTransform,
|
const Matrix& aParentTransform,
|
||||||
const gfxMatrix& aGLWorldTransform)
|
const Matrix& aGLWorldTransform)
|
||||||
{
|
{
|
||||||
// NB: we fall off this path whenever there are container layers
|
// NB: we fall off this path whenever there are container layers
|
||||||
// that require intermediate surfaces. That means all the
|
// that require intermediate surfaces. That means all the
|
||||||
@ -234,8 +235,8 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
|||||||
//
|
//
|
||||||
// A 2D transform with PreservesAxisAlignedRectangles() has all the attributes
|
// A 2D transform with PreservesAxisAlignedRectangles() has all the attributes
|
||||||
// above
|
// above
|
||||||
gfxMatrix transform;
|
Matrix transform;
|
||||||
gfx3DMatrix transform3D = gfx::To3DMatrix(aLayer->GetEffectiveTransform());
|
Matrix4x4 transform3D = aLayer->GetEffectiveTransform();
|
||||||
|
|
||||||
if (!transform3D.Is2D(&transform) || !transform.PreservesAxisAlignedRectangles()) {
|
if (!transform3D.Is2D(&transform) || !transform.PreservesAxisAlignedRectangles()) {
|
||||||
LOGD("Layer has a 3D transform or a non-square angle rotation");
|
LOGD("Layer has a 3D transform or a non-square angle rotation");
|
||||||
@ -377,7 +378,7 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
|||||||
// And ignore scaling.
|
// And ignore scaling.
|
||||||
//
|
//
|
||||||
// Reflection is applied before rotation
|
// Reflection is applied before rotation
|
||||||
gfxMatrix rotation = transform * aGLWorldTransform;
|
gfx::Matrix rotation = transform * aGLWorldTransform;
|
||||||
// Compute fuzzy zero like PreservesAxisAlignedRectangles()
|
// Compute fuzzy zero like PreservesAxisAlignedRectangles()
|
||||||
if (fabs(rotation._11) < 1e-6) {
|
if (fabs(rotation._11) < 1e-6) {
|
||||||
if (rotation._21 < 0) {
|
if (rotation._21 < 0) {
|
||||||
@ -775,10 +776,9 @@ HwcComposer2D::Reset()
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
HwcComposer2D::TryRender(Layer* aRoot,
|
HwcComposer2D::TryRender(Layer* aRoot,
|
||||||
const gfx::Matrix& GLWorldTransform,
|
const gfx::Matrix& aGLWorldTransform,
|
||||||
bool aGeometryChanged)
|
bool aGeometryChanged)
|
||||||
{
|
{
|
||||||
gfxMatrix aGLWorldTransform = ThebesMatrix(GLWorldTransform);
|
|
||||||
if (!aGLWorldTransform.PreservesAxisAlignedRectangles()) {
|
if (!aGLWorldTransform.PreservesAxisAlignedRectangles()) {
|
||||||
LOGD("Render aborted. World transform has non-square angle rotation");
|
LOGD("Render aborted. World transform has non-square angle rotation");
|
||||||
return false;
|
return false;
|
||||||
@ -802,7 +802,7 @@ HwcComposer2D::TryRender(Layer* aRoot,
|
|||||||
MOZ_ASSERT(mHwcLayerMap.IsEmpty());
|
MOZ_ASSERT(mHwcLayerMap.IsEmpty());
|
||||||
if (!PrepareLayerList(aRoot,
|
if (!PrepareLayerList(aRoot,
|
||||||
mScreenRect,
|
mScreenRect,
|
||||||
gfxMatrix(),
|
gfx::Matrix(),
|
||||||
aGLWorldTransform))
|
aGLWorldTransform))
|
||||||
{
|
{
|
||||||
mHwcLayerMap.Clear();
|
mHwcLayerMap.Clear();
|
||||||
|
@ -94,7 +94,7 @@ private:
|
|||||||
bool TryHwComposition();
|
bool TryHwComposition();
|
||||||
bool ReallocLayerList();
|
bool ReallocLayerList();
|
||||||
bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip,
|
bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip,
|
||||||
const gfxMatrix& aParentTransform, const gfxMatrix& aGLWorldTransform);
|
const gfx::Matrix& aParentTransform, const gfx::Matrix& aGLWorldTransform);
|
||||||
void setCrop(HwcLayer* layer, hwc_rect_t srcCrop);
|
void setCrop(HwcLayer* layer, hwc_rect_t srcCrop);
|
||||||
void setHwcGeometry(bool aGeometryChanged);
|
void setHwcGeometry(bool aGeometryChanged);
|
||||||
void SendtoLayerScope();
|
void SendtoLayerScope();
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include "HwcUtils.h"
|
#include "HwcUtils.h"
|
||||||
#include "gfxUtils.h"
|
#include "gfxUtils.h"
|
||||||
|
#include "gfx2DGlue.h"
|
||||||
|
|
||||||
#define LOG_TAG "HwcUtils"
|
#define LOG_TAG "HwcUtils"
|
||||||
|
|
||||||
@ -36,11 +37,12 @@ namespace mozilla {
|
|||||||
|
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
HwcUtils::PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform,
|
HwcUtils::PrepareLayerRects(nsIntRect aVisible, const gfx::Matrix& transform,
|
||||||
nsIntRect aClip, nsIntRect aBufferRect,
|
nsIntRect aClip, nsIntRect aBufferRect,
|
||||||
bool aYFlipped,
|
bool aYFlipped,
|
||||||
hwc_rect_t* aSourceCrop, hwc_rect_t* aVisibleRegionScreen) {
|
hwc_rect_t* aSourceCrop, hwc_rect_t* aVisibleRegionScreen) {
|
||||||
|
|
||||||
|
gfxMatrix aTransform = gfx::ThebesMatrix(transform);
|
||||||
gfxRect visibleRect(aVisible);
|
gfxRect visibleRect(aVisible);
|
||||||
gfxRect clip(aClip);
|
gfxRect clip(aClip);
|
||||||
gfxRect visibleRectScreen = aTransform.TransformBounds(visibleRect);
|
gfxRect visibleRectScreen = aTransform.TransformBounds(visibleRect);
|
||||||
@ -51,7 +53,7 @@ HwcUtils::PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix inverse(aTransform);
|
gfxMatrix inverse = aTransform;
|
||||||
inverse.Invert();
|
inverse.Invert();
|
||||||
gfxRect crop = inverse.TransformBounds(visibleRectScreen);
|
gfxRect crop = inverse.TransformBounds(visibleRectScreen);
|
||||||
|
|
||||||
@ -88,10 +90,11 @@ HwcUtils::PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform,
|
|||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
HwcUtils::PrepareVisibleRegion(const nsIntRegion& aVisible,
|
HwcUtils::PrepareVisibleRegion(const nsIntRegion& aVisible,
|
||||||
const gfxMatrix& aTransform,
|
const gfx::Matrix& transform,
|
||||||
nsIntRect aClip, nsIntRect aBufferRect,
|
nsIntRect aClip, nsIntRect aBufferRect,
|
||||||
RectVector* aVisibleRegionScreen) {
|
RectVector* aVisibleRegionScreen) {
|
||||||
|
|
||||||
|
gfxMatrix aTransform = gfx::ThebesMatrix(transform);
|
||||||
nsIntRegionRectIterator rect(aVisible);
|
nsIntRegionRectIterator rect(aVisible);
|
||||||
bool isVisible = false;
|
bool isVisible = false;
|
||||||
while (const nsIntRect* visibleRect = rect.Next()) {
|
while (const nsIntRect* visibleRect = rect.Next()) {
|
||||||
@ -117,10 +120,11 @@ HwcUtils::PrepareVisibleRegion(const nsIntRegion& aVisible,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
HwcUtils::CalculateClipRect(const gfxMatrix& aTransform,
|
HwcUtils::CalculateClipRect(const gfx::Matrix& transform,
|
||||||
const nsIntRect* aLayerClip,
|
const nsIntRect* aLayerClip,
|
||||||
nsIntRect aParentClip, nsIntRect* aRenderClip) {
|
nsIntRect aParentClip, nsIntRect* aRenderClip) {
|
||||||
|
|
||||||
|
gfxMatrix aTransform = gfx::ThebesMatrix(transform);
|
||||||
*aRenderClip = aParentClip;
|
*aRenderClip = aParentClip;
|
||||||
|
|
||||||
if (!aLayerClip) {
|
if (!aLayerClip) {
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
namespace gfx {
|
||||||
|
class Matrix;
|
||||||
|
}
|
||||||
|
|
||||||
class HwcUtils {
|
class HwcUtils {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -62,7 +66,7 @@ typedef std::vector<hwc_rect_t> RectVector;
|
|||||||
* @return true if the layer should be rendered.
|
* @return true if the layer should be rendered.
|
||||||
* false if the layer can be skipped
|
* false if the layer can be skipped
|
||||||
*/
|
*/
|
||||||
static bool CalculateClipRect(const gfxMatrix& aTransform,
|
static bool CalculateClipRect(const gfx::Matrix& aTransform,
|
||||||
const nsIntRect* aLayerClip,
|
const nsIntRect* aLayerClip,
|
||||||
nsIntRect aParentClip, nsIntRect* aRenderClip);
|
nsIntRect aParentClip, nsIntRect* aRenderClip);
|
||||||
|
|
||||||
@ -84,7 +88,7 @@ static bool CalculateClipRect(const gfxMatrix& aTransform,
|
|||||||
* false if the layer can be skipped
|
* false if the layer can be skipped
|
||||||
*/
|
*/
|
||||||
static bool PrepareVisibleRegion(const nsIntRegion& aVisible,
|
static bool PrepareVisibleRegion(const nsIntRegion& aVisible,
|
||||||
const gfxMatrix& aTransform,
|
const gfx::Matrix& aTransform,
|
||||||
nsIntRect aClip, nsIntRect aBufferRect,
|
nsIntRect aClip, nsIntRect aBufferRect,
|
||||||
RectVector* aVisibleRegionScreen);
|
RectVector* aVisibleRegionScreen);
|
||||||
|
|
||||||
@ -108,7 +112,7 @@ static bool PrepareVisibleRegion(const nsIntRegion& aVisible,
|
|||||||
* @return true if the layer should be rendered.
|
* @return true if the layer should be rendered.
|
||||||
* false if the layer can be skipped
|
* false if the layer can be skipped
|
||||||
*/
|
*/
|
||||||
static bool PrepareLayerRects(nsIntRect aVisible, const gfxMatrix& aTransform,
|
static bool PrepareLayerRects(nsIntRect aVisible, const gfx::Matrix& aTransform,
|
||||||
nsIntRect aClip, nsIntRect aBufferRect,
|
nsIntRect aClip, nsIntRect aBufferRect,
|
||||||
bool aYFlipped,
|
bool aYFlipped,
|
||||||
hwc_rect_t* aSourceCrop,
|
hwc_rect_t* aSourceCrop,
|
||||||
|
Loading…
Reference in New Issue
Block a user