Skip to content

Commit

Permalink
Merge pull request #30 from ntkwan/hoang
Browse files Browse the repository at this point in the history
Delete rounding scale
  • Loading branch information
hoangfitus authored Jan 6, 2024
2 parents 23cf20e + 906fe0b commit f618b52
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit f618b52

Please sign in to comment.