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

Commit f15a83f5 authored by Jamie Gennis's avatar Jamie Gennis
Browse files

SurfaceFlinger: add a crop to the layer state

This change adds a crop rectangle specified in window coordinates to the layer
state.  The all window pixels outside this crop rectangle are treated as though
they were fully transparent.  This change also adds the plumbing necessary for
WindowManager to set that crop.

Change-Id: I582bc445dc8c97d4c943d4db8d582a6ef5a66081
parent f30fd014
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public:
        eTransparentRegionChanged   = 0x00000020,
        eVisibilityChanged          = 0x00000040,
        eFreezeTintChanged          = 0x00000080,
        eCropChanged                = 0x00000100,
    };

    enum {
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ public:
    status_t    setAlpha(float alpha=1.0f);
    status_t    setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
    status_t    setFreezeTint(uint32_t tint);
    status_t    setCrop(const Rect& crop);

    static status_t writeSurfaceToParcel(
            const sp<SurfaceControl>& control, Parcel* parcel);
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ public:
    status_t    setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy);
    status_t    setPosition(SurfaceID id, float x, float y);
    status_t    setSize(SurfaceID id, uint32_t w, uint32_t h);
    status_t    setCrop(SurfaceID id, const Rect& crop);
    status_t    destroySurface(SurfaceID sid);

private:
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <utils/Errors.h>

#include <ui/Region.h>
#include <ui/Rect.h>
#include <gui/ISurface.h>

namespace android {
@@ -40,6 +41,7 @@ struct layer_state_t {
    {
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
        crop.makeInvalid();
    }

    status_t    write(Parcel& output) const;
@@ -64,6 +66,7 @@ struct layer_state_t {
            uint8_t         mask;
            uint8_t         reserved;
            matrix22_t      matrix;
            Rect            crop;
            // non POD must be last. see write/read
            Region          transparentRegion;
};
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public:
    // a ROT90 then the output rectangle is defined in a space extending to
    // (height, width).  Otherwise the output rectangle is in the same space as
    // the input.
    Rect transform(uint32_t xform, int32_t width, int32_t height);
    Rect transform(uint32_t xform, int32_t width, int32_t height) const;
};

ANDROID_BASIC_TYPES_TRAITS(Rect)
Loading