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

List:       kde-commits
Subject:    [calligra] krita/ui: don't paste layers outside the bounds of the
From:       Sven Langkamp <sven.langkamp () gmail ! com>
Date:       2011-11-30 23:56:50
Message-ID: 20111130235650.62FC5A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit af220de6e2b364c37888ab66359d63fcd3aa525c by Sven Langkamp.
Committed on 01/12/2011 at 00:54.
Pushed by langkamp into branch 'master'.

don't paste layers outside the bounds of the image
BUG:287818

M  +7    -0    krita/ui/kis_selection_manager.cc

http://commits.kde.org/calligra/af220de6e2b364c37888ab66359d63fcd3aa525c

diff --git a/krita/ui/kis_selection_manager.cc b/krita/ui/kis_selection_manager.cc
index ef15c6f..3893808 100644
--- a/krita/ui/kis_selection_manager.cc
+++ b/krita/ui/kis_selection_manager.cc
@@ -423,6 +423,13 @@ void KisSelectionManager::paste()
             viewConverter->viewToDocumentX(canvasBase->canvasController()->canvasOffsetX()) \
                + center.x(),
             viewConverter->viewToDocumentY(canvasBase->canvasController()->canvasOffsetY()) \
+ center.y()));  
+    // Pasted layer content could be outside image bounds and invisible, if that is \
the case move content into the bounds +    QRect exactBounds = clip->exactBounds();
+    if(!exactBounds.isEmpty() && !exactBounds.intersects(image->bounds())) {
+        clip->setX(clip->x() - exactBounds.x());
+        clip->setY(clip->y() - exactBounds.y());
+    }
+
     if (clip) {
         KisPaintLayer *layer = new KisPaintLayer(image.data(), \
image->nextLayerName() + i18n("(pasted)"), OPACITY_OPAQUE_U8, clip);  \
Q_CHECK_PTR(layer);


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

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