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

Commit b9def8e7 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Lines would not set the scissor before drawing."

parents a4f03f98 7f78b0c3
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -941,8 +941,11 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int
}

void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
    // TODO: Should do quickReject for each line
    if (mSnapshot->invisible) return;

    setupDraw();

    int alpha;
    SkXfermode::Mode mode;
    getAlphaAndMode(paint, &alpha, &mode);
@@ -961,7 +964,7 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
                mode, false, true, (GLvoid*) 0, (GLvoid*) gMeshTextureOffset,
                mCaches.line.getMeshBuffer());
    } else {
        setupColorRect(0.0f, 0.0f, 1.0f, 1.0f, r, g, b, a, mode, false);
        setupColorRect(0.0f, 0.0f, 1.0f, 1.0f, r, g, b, a, mode, false, true);
    }

    const float strokeWidth = paint->getStrokeWidth();
@@ -1408,7 +1411,8 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot
}

void OpenGLRenderer::setupColorRect(float left, float top, float right, float bottom,
        float r, float g, float b, float a, SkXfermode::Mode mode, bool ignoreTransform) {
        float r, float g, float b, float a, SkXfermode::Mode mode,
        bool ignoreTransform, bool ignoreMatrix) {
    GLuint textureUnit = 0;

    // Describe the required shaders
@@ -1433,6 +1437,7 @@ void OpenGLRenderer::setupColorRect(float left, float top, float right, float bo
    glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
            gMeshStride, 0);

    if (!ignoreMatrix) {
        // Setup uniforms
        mModelView.loadTranslate(left, top, 0.0f);
        mModelView.scale(right - left, bottom - top, 1.0f);
@@ -1444,10 +1449,12 @@ void OpenGLRenderer::setupColorRect(float left, float top, float right, float bo
            mCaches.currentProgram->set(mOrthoMatrix, mModelView, identity);
            dirtyLayer(left, top, right, bottom);
        }
    }
    mCaches.currentProgram->setColor(r, g, b, a);

    // Setup attributes and uniforms required by the shaders
    if (mShader) {
        if (ignoreMatrix) mModelView.loadIdentity();
        mShader->setupProgram(mCaches.currentProgram, mModelView, *mSnapshot, &textureUnit);
    }
    if (mColorFilter) {
+2 −1
Original line number Diff line number Diff line
@@ -233,7 +233,8 @@ private:
     * Setups shaders to draw a colored rect.
     */
    void setupColorRect(float left, float top, float right, float bottom,
            float r, float g, float b, float a, SkXfermode::Mode mode, bool ignoreTransform);
            float r, float g, float b, float a, SkXfermode::Mode mode,
            bool ignoreTransform, bool ignoreMatrix = false);

    /**
     * Draws a textured rectangle with the specified texture. The specified coordinates