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

Commit 12efe649 authored by Chris Craik's avatar Chris Craik
Browse files

Move ortho matrix out of glop

It's fbo-global, so don't bother stashing/restoring it repeatedly.

Change-Id: Icb32e3eda5d2086aaae07140f8ff40e038dad5fe
parent a5940f8d
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -135,10 +135,6 @@ struct Glop {
    } fill;

    struct Transform {
        // Orthographic projection matrix for current FBO
        // TODO: move out of Glop, since this is static per FBO
        Matrix4 ortho;

        // modelView transform, accounting for delta between mesh transform and content of the mesh
        // often represents x/y offsets within command, or scaling for mesh unit size
        Matrix4 modelView;
+1 −2
Original line number Diff line number Diff line
@@ -461,11 +461,10 @@ GlopBuilder& GlopBuilder::setFillTextureLayer(Layer& layer, float alpha) {
// Transform
////////////////////////////////////////////////////////////////////////////////

void GlopBuilder::setTransform(const Matrix4& ortho, const Matrix4& canvas,
void GlopBuilder::setTransform(const Matrix4& canvas,
        const int transformFlags) {
    TRIGGER_STAGE(kTransformStage);

    mOutGlop->transform.ortho = ortho;
    mOutGlop->transform.canvas = canvas;
    mOutGlop->transform.transformFlags = transformFlags;
}
+2 −3
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public:
    GlopBuilder& setFillTextureLayer(Layer& layer, float alpha);

    GlopBuilder& setTransform(const Snapshot& snapshot, const int transformFlags) {
        setTransform(snapshot.getOrthoMatrix(), *snapshot.transform, transformFlags);
        setTransform(*snapshot.transform, transformFlags);
        return *this;
    }

@@ -102,8 +102,7 @@ private:
    void setFill(int color, float alphaScale,
            SkXfermode::Mode mode, Blend::ModeOrderSwap modeUsage,
            const SkShader* shader, const SkColorFilter* colorFilter);
    void setTransform(const Matrix4& ortho, const Matrix4& canvas,
            const int transformFlags);
    void setTransform(const Matrix4& canvas, const int transformFlags);

    enum StageFlags {
        kInitialStage = 0,
+1 −1
Original line number Diff line number Diff line
@@ -1405,7 +1405,7 @@ void OpenGLRenderer::renderGlop(const Glop& glop, GlopRenderType type) {

        setStencilFromClip();
    }
    mRenderState.render(glop);
    mRenderState.render(glop, currentSnapshot()->getOrthoMatrix());
    if (type == GlopRenderType::Standard && !mRenderState.stencil().isWriteEnabled()) {
        // TODO: specify more clearly when a draw should dirty the layer.
        // is writing to the stencil the only time we should ignore this?
+2 −2
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ void RenderState::postDecStrong(VirtualLightRefBase* object) {
// Render
///////////////////////////////////////////////////////////////////////////////

void RenderState::render(const Glop& glop) {
void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) {
    const Glop::Mesh& mesh = glop.mesh;
    const Glop::Mesh::Vertices& vertices = mesh.vertices;
    const Glop::Mesh::Indices& indices = mesh.indices;
@@ -223,7 +223,7 @@ void RenderState::render(const Glop& glop) {
        fill.program->setColor(fill.color);
    }

    fill.program->set(glop.transform.ortho,
    fill.program->set(orthoMatrix,
            glop.transform.modelView,
            glop.transform.meshTransform(),
            glop.transform.transformFlags & TransformFlags::OffsetByFudgeFactor);
Loading