From 92c7d73d2d782f3c802a4b2a041a409c85e37547 Mon Sep 17 00:00:00 2001 From: reuk Date: Sat, 8 Feb 2025 16:12:30 +0000 Subject: [PATCH] Direct2D: Fix image artefacts at the edge of alpha-clipped regions This addresses the same issue that 95d416ab77cc132a7d663ca438574b2d9a820e75 was intended to fix: Drawing a drop shadow on a high-res display on Windows could sometimes produce thin lines around the edge of the shadow. Using the 'clamp' rather than the 'wrap' clipping mode seems to help. --- .../native/juce_Direct2DGraphicsContext_windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp index e0cc632802..4ffa939266 100644 --- a/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DGraphicsContext_windows.cpp @@ -1211,7 +1211,7 @@ void Direct2DGraphicsContext::clipToImageAlpha (const Image& sourceImage, const auto matrix = D2DUtilities::transformToMatrix (brushTransform); D2D1_BRUSH_PROPERTIES brushProps = { 1.0f, matrix }; - auto bitmapBrushProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP); + auto bitmapBrushProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_CLAMP); auto hr = deviceContext->CreateBitmapBrush (bitmap, bitmapBrushProps, brushProps, brush.resetAndGetPointerAddress()); if (FAILED (hr))