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

Commit 129dc842 authored by Riley Andrews's avatar Riley Andrews Committed by Android Git Automerger
Browse files

am edb86f9f: Merge "Add rotation to surfaceflingers screen cap." into lmp-dev

* commit 'edb86f9f':
  Add rotation to surfaceflingers screen cap.
parents 0ffb9138 edb86f9f
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -62,6 +62,13 @@ public:
        eDisplayIdHdmi = 1
    };

    enum Rotation {
        eRotateNone = 0,
        eRotate90   = 1,
        eRotate180  = 2,
        eRotate270  = 3
    };

    /* create connection with surface flinger, requires
     * ACCESS_SURFACE_FLINGER permission
     */
@@ -130,7 +137,8 @@ public:
            const sp<IGraphicBufferProducer>& producer,
            Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
            uint32_t minLayerZ, uint32_t maxLayerZ,
            bool useIdentityTransform) = 0;
            bool useIdentityTransform,
            Rotation rotation = eRotateNone) = 0;

    /* Clears the frame statistics for animations.
     *
+6 −2
Original line number Diff line number Diff line
@@ -106,7 +106,8 @@ public:
            const sp<IGraphicBufferProducer>& producer,
            Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
            uint32_t minLayerZ, uint32_t maxLayerZ,
            bool useIdentityTransform)
            bool useIdentityTransform,
            ISurfaceComposer::Rotation rotation)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -118,6 +119,7 @@ public:
        data.writeInt32(minLayerZ);
        data.writeInt32(maxLayerZ);
        data.writeInt32(static_cast<int32_t>(useIdentityTransform));
        data.writeInt32(static_cast<int32_t>(rotation));
        remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
        return reply.readInt32();
    }
@@ -329,10 +331,12 @@ status_t BnSurfaceComposer::onTransact(
            uint32_t minLayerZ = data.readInt32();
            uint32_t maxLayerZ = data.readInt32();
            bool useIdentityTransform = static_cast<bool>(data.readInt32());
            uint32_t rotation = data.readInt32();

            status_t res = captureScreen(display, producer,
                    sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ,
                    useIdentityTransform);
                    useIdentityTransform,
                    static_cast<ISurfaceComposer::Rotation>(rotation));
            reply->writeInt32(res);
            return NO_ERROR;
        }
+2 −1
Original line number Diff line number Diff line
@@ -288,7 +288,8 @@ void DisplayDevice::setViewportAndProjection() const {
    size_t w = mDisplayWidth;
    size_t h = mDisplayHeight;
    Rect sourceCrop(0, 0, w, h);
    mFlinger->getRenderEngine().setViewportAndProjection(w, h, sourceCrop, h, false);
    mFlinger->getRenderEngine().setViewportAndProjection(w, h, sourceCrop, h,
        false, Transform::ROT_0);
}

// ----------------------------------------------------------------------------
+20 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include <utils/String8.h>
#include <cutils/compiler.h>
#include <gui/ISurfaceComposer.h>

#include "GLES11RenderEngine.h"
#include "Mesh.h"
@@ -74,7 +75,8 @@ size_t GLES11RenderEngine::getMaxViewportDims() const {
}

void GLES11RenderEngine::setViewportAndProjection(
        size_t vpw, size_t vph, Rect sourceCrop, size_t hwh, bool yswap) {
        size_t vpw, size_t vph, Rect sourceCrop, size_t hwh, bool yswap,
        Transform::orientation_flags rotation) {
    glViewport(0, 0, vpw, vph);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
@@ -91,6 +93,23 @@ void GLES11RenderEngine::setViewportAndProjection(
    } else {
        glOrthof(l, r, b, t, 0, 1);
    }

    switch (rotation) {
        case Transform::ROT_0:
            break;
        case Transform::ROT_90:
            glRotatef(90, 0, 0, 1);
            break;
        case Transform::ROT_180:
            glRotatef(180, 0, 0, 1);
            break;
        case Transform::ROT_270:
            glRotatef(270, 0, 0, 1);
            break;
        default:
            break;
    }

    glMatrixMode(GL_MODELVIEW);
}

+2 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <sys/types.h>

#include <GLES/gl.h>
#include <Transform.h>

#include "RenderEngine.h"

@@ -50,7 +51,7 @@ protected:

    virtual void dump(String8& result);
    virtual void setViewportAndProjection(size_t vpw, size_t vph,
            Rect sourceCrop, size_t hwh, bool yswap);
            Rect sourceCrop, size_t hwh, bool yswap, Transform::orientation_flags rotation);
    virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha);
    virtual void setupDimLayerBlending(int alpha);
    virtual void setupLayerTexturing(const Texture& texture);
Loading