+ fix: printing scaling problem related to DPI awareness changes

This commit is contained in:
Rainer Kottenhoff 2020-06-18 17:53:47 +02:00
parent 3ab734aa81
commit c71fc18b41
3 changed files with 8 additions and 8 deletions

View File

@ -1813,10 +1813,10 @@ Sci::Position Editor::FormatRange(bool draw, const Sci_RangeToFormat *pfr) {
if (!pfr)
return 0;
AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT);
AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT, true);
if (!surface)
return 0;
AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT);
AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT, true);
if (!surfaceMeasure) {
return 0;
}

View File

@ -655,10 +655,10 @@ public:
surf->SetBidiR2L(ed->BidirectionalR2L());
}
}
AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) {
AutoSurface(SurfaceID sid, Editor *ed, int technology = -1, bool printing = false) {
if (ed->wMain.GetID()) {
surf.reset(Surface::Allocate(technology != -1 ? technology : ed->technology));
surf->Init(sid, ed->wMain.GetID());
surf->Init(sid, ed->wMain.GetID(), printing);
surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage());
//~surf->SetDBCSMode(ed->CodePage());
surf->SetBidiR2L(ed->BidirectionalR2L());

View File

@ -573,7 +573,7 @@ public:
~SurfaceGDI() noexcept override;
void Init(WindowID wid) noexcept override;
void Init(SurfaceID sid, WindowID wid, bool printing) noexcept override;
void Init(SurfaceID sid, WindowID wid, bool printing = false) noexcept override;
void InitPixMap(int width, int height, Surface *surface_, WindowID wid) noexcept override;
void Release() noexcept override;
@ -668,7 +668,7 @@ void SurfaceGDI::Init(WindowID wid) noexcept {
::SetTextAlign(hdc, TA_BASELINE);
}
void SurfaceGDI::Init(SurfaceID sid, WindowID wid, bool printing) noexcept {
void SurfaceGDI::Init(SurfaceID sid, WindowID wid, bool printing /*=false*/) noexcept {
Release();
hdc = static_cast<HDC>(sid);
// Windows on screen are scaled but printers are not.
@ -1343,9 +1343,9 @@ void SurfaceD2D::Init(WindowID wid) noexcept {
logPixelsY = DpiYForWindow(wid);
}
void SurfaceD2D::Init(SurfaceID sid, WindowID wid, bool /*printing*/) noexcept {
void SurfaceD2D::Init(SurfaceID sid, WindowID wid, bool printing /*=false*/) noexcept {
Release();
// printing always using GDI
// printing always using GDI technology
logPixelsY = DpiYForWindow(wid);
pRenderTarget = static_cast<ID2D1RenderTarget *>(sid);
}