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

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

Merge "Handle different x, y scales in drawLines AA path" into jb-mr1-dev

parents 330a5bf8 75040f8a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1978,6 +1978,10 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {

        // Find the normal to the line
        vec2 n = (b - a).copyNormalized() * halfStrokeWidth;
        float x = n.x;
        n.x = -n.y;
        n.y = x;

        if (isHairLine) {
            if (isAA) {
                float wideningFactor;
@@ -2002,14 +2006,10 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {

            float extendedNLength = extendedN.length();
            // We need to set this value on the shader prior to drawing
            boundaryWidthProportion = extendedNLength / (halfStrokeWidth + extendedNLength);
            boundaryWidthProportion = .5 - extendedNLength / (halfStrokeWidth + extendedNLength);
            n += extendedN;
        }

        float x = n.x;
        n.x = -n.y;
        n.y = x;

        // aa lines expand the endpoint vertices to encompass the AA boundary
        if (isAA) {
            vec2 abVector = (b - a);
+8 −0
Original line number Diff line number Diff line
@@ -153,6 +153,14 @@ public class LinesActivity extends Activity {
            canvas.drawLine(10.0f, 45.0f, 20.0f, 55.0f, mSmallPaint);
            canvas.drawLine(10.0f, 60.0f, 50.0f, 60.0f, mHairLinePaint);
            canvas.restore();

            canvas.save();
            canvas.scale(10.0f, 50.0f);
            mSmallPaint.setStrokeWidth(0.0f);
            canvas.drawLine(20.0f, 9.0f, 30.0f, 11.0f, mSmallPaint);
            mSmallPaint.setStrokeWidth(1.0f);
            canvas.drawLine(30.0f, 9.0f, 40.0f, 11.0f, mSmallPaint);
            canvas.restore();
        }
    }
}