Direct2D, CPU utilization, and continuous WM_PAINT messages


#1

If anyone else is trying to use Direct2D, and getting 90-100% utilization
on one core, with continuous WM_PAINT messages, you may want to try the
following experiment.

In juce_win32_Windowing.cpp, in the handlePaintMessage() method, copy the
existing calls to BeginPaint/EndPaint up in that method to bracket the
calls to direct2DContext->start() and direct2DContext->end().

Also make sure that, by whatever means you choose, you set the variable
currentRenderingEngine to direct2DRenderingEngine in the same .cpp file.

I ran this using the tutorial_main_window from juce.com, and the 5.2.0 .zip
file from github. On my system, the above code change stops the continuous
WM_PAINT messages, and drops the CPU utilization to 0.

This link may be of interest:


The Direct2D handlePaintMessage() function problem