aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Nißl <unknown>2022-09-17 21:59:27 +1000
committerMarkus Nißl <unknown>2022-09-17 21:59:27 +1000
commitbbd334b945e8e5543117e3f6b172ac81d1101b64 (patch)
tree5293abbfba6ad55666942f171a2a89b3430f72b0
parent148518380f5a2cc21f0090bdc9d68e67af5b5cc2 (diff)
downloadscintilla-mirror-bbd334b945e8e5543117e3f6b172ac81d1101b64.tar.gz
Bug [#2344]. Limit render target to image area when drawing images with Direct2D
for autocompletion lists. This prevents the text appearing blurred with GDI scaling.
-rw-r--r--win32/PlatWin.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index f33b1fcd3..87840ff3b 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -3203,15 +3203,17 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
ID2D1DCRenderTarget *pDCRT = nullptr;
HRESULT hr = pD2DFactory->CreateDCRenderTarget(&props, &pDCRT);
if (SUCCEEDED(hr) && pDCRT) {
- RECT rcWindow;
- GetClientRect(pDrawItem->hwndItem, &rcWindow);
- hr = pDCRT->BindDC(pDrawItem->hDC, &rcWindow);
+ const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x);
+
+ RECT rcItem = pDrawItem->rcItem;
+ rcItem.left = left;
+ rcItem.right = rcItem.left + images.GetWidth();
+
+ hr = pDCRT->BindDC(pDrawItem->hDC, &rcItem);
if (SUCCEEDED(hr)) {
surfaceItem->Init(pDCRT, pDrawItem->hwndItem);
pDCRT->BeginDraw();
- const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x);
- const PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top,
- left + images.GetWidth(), pDrawItem->rcItem.bottom);
+ const PRectangle rcImage = PRectangle::FromInts(0, 0, images.GetWidth(), rcItem.bottom - rcItem.top);
surfaceItem->DrawRGBAImage(rcImage,
pimage->GetWidth(), pimage->GetHeight(), pimage->Pixels());
pDCRT->EndDraw();