Skip to content

Commit

Permalink
fix: rotate bitmaps over the correct corner
Browse files Browse the repository at this point in the history
  • Loading branch information
richardapeters committed Oct 10, 2024
1 parent 384d2c3 commit 8197d45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions preview/views/ViewRotating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ namespace services
if (subView)
{
subView->ResetSize();
ResizeWithoutTrigger(infra::RotatedVectorInRegion(subView->ViewRegion().Size(), angle, rotatedRegion));
rotatedRegion = infra::RotatedRegionInRegion(subView->ViewRegion(), -angle, subView->ViewRegion());
ResizeWithoutTrigger(rotatedRegion.Size());
}
else
ResizeWithoutTrigger(infra::Vector());
Expand Down Expand Up @@ -125,17 +126,17 @@ namespace services

void ViewRotating::CanvasRotating::DrawBitmap(infra::Point position, const infra::Bitmap& sourceBitmap, infra::Region boundingBox)
{
canvas.DrawBitmap(Rotated(position), sourceBitmap, Rotated(boundingBox));
canvas.DrawBitmap(Rotated(infra::Region(position, sourceBitmap.size)).TopLeft(), sourceBitmap, Rotated(boundingBox));
}

void ViewRotating::CanvasRotating::DrawTransparentBitmap(infra::Point position, const infra::Bitmap& sourceBitmap, uint32_t transparencyColour, infra::Region boundingBox)
{
canvas.DrawTransparentBitmap(Rotated(position), sourceBitmap, transparencyColour, Rotated(boundingBox));
canvas.DrawTransparentBitmap(Rotated(infra::Region(position, sourceBitmap.size)).TopLeft(), sourceBitmap, transparencyColour, Rotated(boundingBox));
}

void ViewRotating::CanvasRotating::DrawIcon(infra::Point position, const infra::Bitmap& sourceBitmap, infra::Colour colour, infra::Region boundingBox)
{
canvas.DrawIcon(Rotated(position), sourceBitmap, colour, Rotated(boundingBox));
canvas.DrawIcon(Rotated(infra::Region(position, sourceBitmap.size)).TopLeft(), sourceBitmap, colour, Rotated(boundingBox));
}

void ViewRotating::CanvasRotating::DrawString(infra::Point position, infra::BoundedConstString string, const infra::Font& font, infra::Colour colour, infra::RightAngle direction, infra::Region boundingBox)
Expand Down

0 comments on commit 8197d45

Please sign in to comment.