Bug 390418

Summary: Saving layers with python script gives incorrect results
Product: [Applications] krita Reporter: heff
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley
Priority: NOR    
Version: 4.0.0-beta.1   
Target Milestone: ---   
Platform: unspecified   
OS: Unspecified   
Latest Commit: Version Fixed In:

Description heff 2018-02-14 02:15:10 UTC
When using the Node::save() function of libkis in python, the data that is saved does not take into account the position of the layer, and as such saves the wrong data.

The width and height of the layer is respected, but the data seems to always be pulled from the top left.

To reproduce: Enable the exportslayers python plugin and create a layer that does not fill the canvas fully and has no content in the top left corner, then export.


Quick speculation:
I'm new to this codebase, and currently do not have a setup available to properly debug, but peeking at the code I'm guessing that the intersection calculation in KisPaintDevice::makeCloneFrom is given invalid bounds data, and that's where I'd start looking for a trace. 
(https://phabricator.kde.org/source/krita/browse/master/libs/image/kis_paint_device.cc)