[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    [krita] libs/ui/widgets: Scratchpad: Implement "Fill Layer"
From:       Wolthera_van_Hövell_tot_Westerflier <null () kde ! org>
Date:       2018-02-13 18:40:57
Message-ID: E1elfVh-0003Fo-Rc () code ! kde ! org
[Download RAW message or body]

Git commit 8aa5a1df66f32c7acc22e62a4000126508590519 by Wolthera van Hövell tot Westerflier.
Committed on 13/02/2018 at 18:33.
Pushed by woltherav into branch 'master'.

Scratchpad: Implement "Fill Layer"

So, I implemented this because the button for it had shown up but didn't do anything.

The text for this said "TODO" and given the way it was named(fillLayer)
and the fact that the fill with background color was implemented just fine,
I figured the intention was to have the current image be copied into the scratchpad.

So that is what this does.

CCMAIL:Kimageshop@kde.org

M  +6    -1    libs/ui/widgets/kis_scratch_pad.cpp

https://commits.kde.org/krita/8aa5a1df66f32c7acc22e62a4000126508590519

diff --git a/libs/ui/widgets/kis_scratch_pad.cpp b/libs/ui/widgets/kis_scratch_pad.cpp
index 0230376d9a5..c7c1a0f1c5c 100644
--- a/libs/ui/widgets/kis_scratch_pad.cpp
+++ b/libs/ui/widgets/kis_scratch_pad.cpp
@@ -508,5 +508,10 @@ void KisScratchPad::fillBackground()
 
 void KisScratchPad::fillLayer()
 {
-    // TODO
+    if(!m_paintLayer) return;
+    KisPaintDeviceSP paintDevice = m_paintLayer->paintDevice();
+    KisPainter painter(paintDevice);
+    QRect sourceRect(0, 0, paintDevice->exactBounds().width(), paintDevice->exactBounds().height());
+    painter.bitBlt(QPoint(0, 0), m_resourceProvider->currentImage()->projection(), sourceRect);
+    update();
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic