Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 043ba295 authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

[SF] Remove needsFiltering param from Output::setProjection

This parameter is not needed because its value is always computed
as a function of the other parameters.

Bug: 161793589
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Change-Id: I7ce1b62577b9e84491185800bf98269f5f47b577
parent 8436cbdf
Loading
Loading
Loading
Loading
+17 −26
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@
#include <ui/Transform.h>
#include <utils/String8.h>

namespace android {
namespace ui {
namespace android::ui {

Transform::Transform() {
    reset();
@@ -57,8 +56,7 @@ bool Transform::operator==(const Transform& other) const {
            mMatrix[2][2] == other.mMatrix[2][2];
}

Transform Transform::operator * (const Transform& rhs) const
{
Transform Transform::operator*(const Transform& rhs) const {
    if (CC_LIKELY(mType == IDENTITY))
        return rhs;

@@ -150,8 +148,7 @@ void Transform::reset() {
    }
}

void Transform::set(float tx, float ty)
{
void Transform::set(float tx, float ty) {
    mMatrix[2][0] = tx;
    mMatrix[2][1] = ty;
    mMatrix[2][2] = 1.0f;
@@ -163,8 +160,7 @@ void Transform::set(float tx, float ty)
    }
}

void Transform::set(float a, float b, float c, float d)
{
void Transform::set(float a, float b, float c, float d) {
    mat33& M(mMatrix);
    M[0][0] = a;    M[1][0] = b;
    M[0][1] = c;    M[1][1] = d;
@@ -172,8 +168,7 @@ void Transform::set(float a, float b, float c, float d)
    mType = UNKNOWN_TYPE;
}

status_t Transform::set(uint32_t flags, float w, float h)
{
status_t Transform::set(uint32_t flags, float w, float h) {
    if (flags & ROT_INVALID) {
        // that's not allowed!
        reset();
@@ -245,13 +240,11 @@ vec2 Transform::transform(float x, float y) const {
    return transform(vec2(x, y));
}

Rect Transform::makeBounds(int w, int h) const
{
Rect Transform::makeBounds(int w, int h) const {
    return transform( Rect(w, h) );
}

Rect Transform::transform(const Rect& bounds, bool roundOutwards) const
{
Rect Transform::transform(const Rect& bounds, bool roundOutwards) const {
    Rect r;
    vec2 lt( bounds.left,  bounds.top    );
    vec2 rt( bounds.right, bounds.top    );
@@ -278,8 +271,7 @@ Rect Transform::transform(const Rect& bounds, bool roundOutwards) const
    return r;
}

FloatRect Transform::transform(const FloatRect& bounds) const
{
FloatRect Transform::transform(const FloatRect& bounds) const {
    vec2 lt(bounds.left, bounds.top);
    vec2 rt(bounds.right, bounds.top);
    vec2 lb(bounds.left, bounds.bottom);
@@ -299,8 +291,7 @@ FloatRect Transform::transform(const FloatRect& bounds) const
    return r;
}

Region Transform::transform(const Region& reg) const
{
Region Transform::transform(const Region& reg) const {
    Region out;
    if (CC_UNLIKELY(type() > TRANSLATE)) {
        if (CC_LIKELY(preserveRects())) {
@@ -320,8 +311,7 @@ Region Transform::transform(const Region& reg) const
    return out;
}

uint32_t Transform::type() const
{
uint32_t Transform::type() const {
    if (mType & UNKNOWN_TYPE) {
        // recompute what this transform is

@@ -416,16 +406,18 @@ uint32_t Transform::getType() const {
    return type() & 0xFF;
}

uint32_t Transform::getOrientation() const
{
uint32_t Transform::getOrientation() const {
    return (type() >> 8) & 0xFF;
}

bool Transform::preserveRects() const
{
bool Transform::preserveRects() const {
    return (getOrientation() & ROT_INVALID) ? false : true;
}

bool Transform::needsBilinearFiltering() const {
    return (!preserveRects() || getType() >= ui::Transform::SCALE);
}

mat4 Transform::asMatrix4() const {
    // Internally Transform uses a 3x3 matrix since the transform is meant for
    // two-dimensional values. An equivalent 4x4 matrix means inserting an extra
@@ -531,5 +523,4 @@ void Transform::dump(const char* name, const char* prefix) const {
    ALOGD("%s", out.c_str());
}

}  // namespace ui
}  // namespace android
} // namespace android::ui
+7 −3
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ public:

    // query the transform
    bool preserveRects() const;

    // Returns if bilinear filtering is needed after applying this transform to avoid aliasing.
    bool needsBilinearFiltering() const;

    uint32_t getType() const;
    uint32_t getOrientation() const;
    bool operator==(const Transform& other) const;
+1 −2
Original line number Diff line number Diff line
@@ -165,8 +165,7 @@ public:
    // Sets the projection state to use
    virtual void setProjection(const ui::Transform&, uint32_t orientation,
                               const Rect& orientedDisplaySpaceRect,
                               const Rect& layerStackSpaceRect, const Rect& displaySpaceRect,
                               bool needsFiltering) = 0;
                               const Rect& layerStackSpaceRect, const Rect& displaySpaceRect) = 0;
    // Sets the bounds to use
    virtual void setDisplaySpaceSize(const ui::Size&) = 0;

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public:
    void setCompositionEnabled(bool) override;
    void setProjection(const ui::Transform&, uint32_t orientation,
                       const Rect& orientedDisplaySpaceRect, const Rect& layerStackSpaceRect,
                       const Rect& displaySpaceRect, bool needsFiltering) override;
                       const Rect& displaySpaceRect) override;
    void setDisplaySpaceSize(const ui::Size&) override;
    void setLayerStackFilter(uint32_t layerStackId, bool isInternal) override;

+2 −2
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ public:
    MOCK_CONST_METHOD0(getDisplayId, std::optional<DisplayId>());

    MOCK_METHOD1(setCompositionEnabled, void(bool));
    MOCK_METHOD6(setProjection,
                 void(const ui::Transform&, uint32_t, const Rect&, const Rect&, const Rect&, bool));
    MOCK_METHOD5(setProjection,
                 void(const ui::Transform&, uint32_t, const Rect&, const Rect&, const Rect&));
    MOCK_METHOD1(setDisplaySpaceSize, void(const ui::Size&));
    MOCK_METHOD2(setLayerStackFilter, void(uint32_t, bool));

Loading