Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete rounding scale #30

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ void OnPaint(HDC hdc, const std::string& filePath, Viewer& viewer) {
viewport.x = viewer.window_size.x;
viewport.y = viewer.window_size.y;
}

graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias8x8);
graphics.SetTextContrast(100);
graphics.SetCompositingMode(Gdiplus::CompositingModeSourceOver);
graphics.SetPixelOffsetMode(Gdiplus::PixelOffsetModeHighQuality);
graphics.SetInterpolationMode(Gdiplus::InterpolationModeHighQuality);

graphics.SetClip(Gdiplus::Rect(0, 0, viewport.x, viewport.y));
if ((viewport.x != viewbox.second.x || viewport.y != viewbox.second.y) &&
viewbox.second.x != 0 && viewbox.second.y != 0) {
float scale_x = viewport.x / viewbox.second.x;
float scale_y = viewport.y / viewbox.second.y;
float scale = std::min(scale_x, scale_y);
scale = roundf(scale * 100) / 100;
graphics.ScaleTransform(scale, scale);
float offset_x = 0.0f;
float offset_y = 0.0f;
Expand All @@ -43,12 +49,6 @@ void OnPaint(HDC hdc, const std::string& filePath, Viewer& viewer) {
}
graphics.TranslateTransform(-viewbox.first.x, -viewbox.first.y);

graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias8x8);
graphics.SetTextContrast(100);
graphics.SetCompositingMode(Gdiplus::CompositingModeSourceOver);
graphics.SetPixelOffsetMode(Gdiplus::PixelOffsetModeHighQuality);
graphics.SetInterpolationMode(Gdiplus::InterpolationModeHighQuality);

Gdiplus::Matrix matrix;
Gdiplus::Region region;
graphics.GetClip(&region);
Expand Down
Loading