mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Direct2D: Do image cloning on GPU when possible
Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
This commit is contained in:
parent
ae784a941e
commit
bf940ae42a
2 changed files with 24 additions and 7 deletions
|
|
@ -537,6 +537,28 @@ private:
|
|||
bool initialState = extensions.isBackupEnabled();
|
||||
};
|
||||
|
||||
ImagePixelData::Ptr Direct2DPixelData::clone()
|
||||
{
|
||||
auto device = getMostRelevantDevice();
|
||||
auto* exts = getBackupExtensions();
|
||||
|
||||
if (device == nullptr || exts == nullptr || exts->isBackupEnabled())
|
||||
return new Direct2DPixelData { backingData->clone(), State::drawn };
|
||||
|
||||
Ptr clonedPixelData = new Direct2DPixelData { pixelFormat, width, height, false };
|
||||
|
||||
const ScopedBackupDisabler scope { *this };
|
||||
const ScopedBackupDisabler clonedScope { *clonedPixelData };
|
||||
|
||||
copyPages (device,
|
||||
*clonedPixelData,
|
||||
*this,
|
||||
{ 0, 0 },
|
||||
{ 0, 0, width, height });
|
||||
|
||||
return clonedPixelData;
|
||||
}
|
||||
|
||||
void Direct2DPixelData::moveValidatedImageSection (Point<int> destTopLeft, Rectangle<int> sourceRect)
|
||||
{
|
||||
auto device = getMostRelevantDevice();
|
||||
|
|
|
|||
|
|
@ -138,13 +138,8 @@ public:
|
|||
|
||||
~Direct2DPixelData() override;
|
||||
|
||||
/* Creates new software image storage with content matching the content of this image.
|
||||
Does not copy any hardware resources.
|
||||
*/
|
||||
ImagePixelData::Ptr clone() override
|
||||
{
|
||||
return new Direct2DPixelData (backingData->clone(), State::drawn);
|
||||
}
|
||||
/* Creates new image storage with content matching the content of this image. */
|
||||
ImagePixelData::Ptr clone() override;
|
||||
|
||||
std::unique_ptr<ImageType> createType() const override
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue