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

Commit e1f788b3 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Rename matrices for consistency"

parents 80914669 e10e827e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ DisplayListData* DisplayListRenderer::finishRecording() {

void DisplayListRenderer::setViewport(int width, int height) {
    // TODO: DisplayListRenderer shouldn't have a projection matrix, as it should never be used
    mViewProjMatrix.loadOrtho(0, width, height, 0, -1, 1);
    mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1);

    initializeViewport(width, height);
}
+11 −12
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ void OpenGLRenderer::setViewport(int width, int height) {
}

void OpenGLRenderer::initViewport(int width, int height) {
    mViewProjMatrix.loadOrtho(0, width, height, 0, -1, 1);
    mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1);

    initializeViewport(width, height);
}
@@ -628,7 +628,7 @@ void OpenGLRenderer::onSnapshotRestored(const Snapshot& removed, const Snapshot&
    if (restoreOrtho) {
        const Rect& r = restored.viewport;
        glViewport(r.left, r.top, r.right, r.bottom);
        mViewProjMatrix.load(removed.orthoMatrix); // TODO: should ortho be stored in 'restored'?
        mProjectionMatrix.load(removed.orthoMatrix); // TODO: should ortho be stored in 'restored'?
    }

    if (restoreClip) {
@@ -854,7 +854,7 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) {
    mSnapshot->resetClip(clip.left, clip.top, clip.right, clip.bottom);
    mSnapshot->viewport.set(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight());
    mSnapshot->height = bounds.getHeight();
    mSnapshot->orthoMatrix.load(mViewProjMatrix);
    mSnapshot->orthoMatrix.load(mProjectionMatrix);

    endTiling();
    debugOverdraw(false, false);
@@ -884,8 +884,7 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) {
    // Change the ortho projection
    glViewport(0, 0, bounds.getWidth(), bounds.getHeight());

    // TODO: determine best way to support 3d drawing within HW layers
    mViewProjMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f);
    mProjectionMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f);

    return true;
}
@@ -1689,17 +1688,17 @@ void OpenGLRenderer::setupDrawDirtyRegionsDisabled() {

void OpenGLRenderer::setupDrawModelView(ModelViewMode mode, bool offset,
        float left, float top, float right, float bottom, bool ignoreTransform) {
    mModelView.loadTranslate(left, top, 0.0f);
    mModelViewMatrix.loadTranslate(left, top, 0.0f);
    if (mode == kModelViewMode_TranslateAndScale) {
        mModelView.scale(right - left, bottom - top, 1.0f);
        mModelViewMatrix.scale(right - left, bottom - top, 1.0f);
    }

    bool dirty = right - left > 0.0f && bottom - top > 0.0f;
    if (!ignoreTransform) {
        mCaches.currentProgram->set(mViewProjMatrix, mModelView, *currentTransform(), offset);
        mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, *currentTransform(), offset);
        if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *currentTransform());
    } else {
        mCaches.currentProgram->set(mViewProjMatrix, mModelView, mat4::identity(), offset);
        mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, mat4::identity(), offset);
        if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom);
    }
}
@@ -1724,11 +1723,11 @@ void OpenGLRenderer::setupDrawShaderUniforms(bool ignoreTransform) {
            // compensate.
            mat4 modelViewWithoutTransform;
            modelViewWithoutTransform.loadInverse(*currentTransform());
            modelViewWithoutTransform.multiply(mModelView);
            mModelView.load(modelViewWithoutTransform);
            modelViewWithoutTransform.multiply(mModelViewMatrix);
            mModelViewMatrix.load(modelViewWithoutTransform);
        }
        mDrawModifiers.mShader->setupProgram(mCaches.currentProgram,
                mModelView, *mSnapshot, &mTextureUnit);
                mModelViewMatrix, *mSnapshot, &mTextureUnit);
    }
}

+7 −7
Original line number Diff line number Diff line
@@ -930,8 +930,8 @@ private:
     */
    Texture* getTexture(const SkBitmap* bitmap);

    // Matrix used for view/projection in shaders
    mat4 mViewProjMatrix;
    // Ortho matrix used for projection in shaders
    mat4 mProjectionMatrix;

    /**
     * Model-view matrix used to position/size objects
@@ -939,15 +939,15 @@ private:
     * Stores operation-local modifications to the draw matrix that aren't incorporated into the
     * currentTransform().
     *
     * If generated with kModelViewMode_Translate, the mModelView will reflect an x/y offset,
     * If generated with kModelViewMode_Translate, mModelViewMatrix will reflect an x/y offset,
     * e.g. the offset in drawLayer(). If generated with kModelViewMode_TranslateAndScale,
     * mModelView will reflect a translation and scale, e.g. the translation and scale required to
     * make VBO 0 (a rect of (0,0,1,1)) scaled to match the x,y offset, and width/height of a
     * bitmap.
     * mModelViewMatrix will reflect a translation and scale, e.g. the translation and scale
     * required to make VBO 0 (a rect of (0,0,1,1)) scaled to match the x,y offset, and width/height
     * of a bitmap.
     *
     * Used as input to SkiaShader transformation.
     */
    mat4 mModelView;
    mat4 mModelViewMatrix;

    // State used to define the clipping region
    Rect mTilingClip;