Description
When applying a scale to the canvas, it limits the size at which you can clip. It seems to be inversely proportional to the scale. So a scale of 2.0 reduces the size by 50%, while 1.5 reduces the size by 33%. Either way, it makes it impossible to apply a clipping rectangle while in a scaled canvas, since it cannot be larger than canvasSize / scale. Anything beyond that is clipped either way.
This is happening with the Win2D backend, I don't know how any of the other backends behave.
Codecanvas.ResetState() is used at the beginning and the end since that is also broken: #405
public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.ResetState();
// Scale the canvas
const float scale = 1.5f;
canvas.Scale(1 / scale, 1 / scale);
// Create a rectangle much larger than the screen
var largeRect = Rect.FromLTRB(-100000.0, -100000.0, 100000.0, 100000.0);
// Apply a clip rect so large that it shouldn't do anything
canvas.ClipRectangle(largeRect);
// Draw a rectangle that should definitely fill the entire screen
canvas.FillColor = Colors.Red;
canvas.FillRectangle(largeRect);
canvas.ResetState();
}
Description When applying a scale to the canvas, it limits the size at which you can clip. It seems to be inversely proportional to the scale. So a scale of 2.0 reduces the size by 50%, while 1.5 reduces the size by 33%. Either way, it makes it impossible to apply a clipping rectangle while in a scaled canvas, since it cannot be larger than
canvasSize / scale
. Anything beyond that is clipped either way.This is happening with the Win2D backend, I don't know how any of the other backends behave.
Code
canvas.ResetState()
is used at the beginning and the end since that is also broken: #405Screenshots
scale = 1.0
scale = 1.5
scale = 2.0
Versions