[krita] libs/ui/widgets: Scratchpad: Implement "Fill Layer"

Wolthera van Hövell tot Westerflier null at kde.org
Tue Feb 13 18:40:57 UTC 2018


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 at 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();
 }


More information about the kimageshop mailing list