1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

D2D: Use currently-selected colour when replace-clearing NativeImage

This commit is contained in:
reuk 2024-04-22 19:08:17 +01:00
parent 793af50964
commit 248a400b88
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 15 additions and 20 deletions

View file

@ -466,11 +466,6 @@ public:
targetAlpha = alpha;
}
virtual void clearBackground()
{
deviceResources.deviceContext.context->Clear (backgroundColor);
}
virtual SavedState* startFrame (float dpiScale)
{
prepare();
@ -1176,18 +1171,18 @@ void Direct2DGraphicsContext::setInterpolationQuality (Graphics::ResamplingQuali
void Direct2DGraphicsContext::fillRect (const Rectangle<int>& r, bool replaceExistingContents)
{
if (replaceExistingContents)
{
JUCE_SCOPED_TRACE_EVENT_FRAME_RECT_I32 (etw::fillRectReplace, etw::direct2dKeyword, getFrameId(), r);
applyPendingClipList();
clipToRectangle (r);
getPimpl()->clearBackground();
currentState->popTopLayer();
}
auto fill = [] (Rectangle<float> rect, ComSmartPtr<ID2D1DeviceContext1> deviceContext, ComSmartPtr<ID2D1Brush> brush)
const auto clearColour = currentState->fillType.colour;
auto fill = [replaceExistingContents, clearColour] (Rectangle<float> rect,
ComSmartPtr<ID2D1DeviceContext1> deviceContext,
ComSmartPtr<ID2D1Brush> brush)
{
deviceContext->FillRectangle (D2DUtilities::toRECT_F (rect), brush);
if (replaceExistingContents)
deviceContext->Clear (D2DUtilities::toCOLOR_F (clearColour));
else
deviceContext->FillRectangle (D2DUtilities::toRECT_F (rect), brush);
};
getPimpl()->paintPrimitive (r.toFloat(), fill);