Skip to content

Non-working save/restore #8

@p0nce

Description

@p0nce

Repro this approximately

float pointRadius = 9;
float  strokeWidth = 4.5;

float  marginArrow = 30;
float arrowDeep   = 10;
float arrowWidth  = 20;
float arrowColor  = __red
float arrowBack   = -10.0;

 with(canvasity)
        {            
            //shadowBlur = _S * blurLength;
            strokeStyle = ptColor;      
            fillStyle = pointCenter;
            lineWidth = strokeWidth * _S;
            float radius = pointRadius * _S;

            beginPath();
            arc(pt.x, pt.y, radius, 0, 2 * PI);
            fill();
            stroke();

            {
                save(); // BUG, uncomment to have wrong render
                translate(pt.x, pt.y);

                //            A 
                //            C
                //         B     D

                vec2f A = vec2f(0, marginArrow + arrowDeep)* _S;
                vec2f B = vec2f(-arrowWidth, arrowBack)* _S;
                vec2f C = vec2f(0, marginArrow)* _S;
                vec2f D = vec2f(arrowWidth, arrowBack)* _S;

                fillStyle = arrowColor;

                for (int n = 0; n < 4; ++n)
                {
                    beginPath;
                        moveTo(A);
                        lineTo(B);
                        lineTo(C);
                        lineTo(D);
                        lineTo(A);
                    fill;
                    rotate(PI/2);
                }
                restore(); // BUG, uncomment to have wrong render
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions