mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
WIP: Use CameraView for UM camera feeds
CURA-5821 The original implementation that refreshes a QImage seems to cause memory overflow on MacOSX and Windows. This is a different implementation. It doesn't cause memory overflow, but it does consume a lot of CPU power.
This commit is contained in:
parent
b00ea4719a
commit
9d07409cce
3 changed files with 31 additions and 26 deletions
|
@ -10,7 +10,7 @@ Component {
|
|||
height: maximumHeight;
|
||||
width: maximumWidth;
|
||||
|
||||
Image {
|
||||
Cura.CameraView {
|
||||
id: cameraImage;
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter;
|
||||
|
@ -21,7 +21,7 @@ Component {
|
|||
OutputDevice.activePrinter.camera.start();
|
||||
}
|
||||
}
|
||||
height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width);
|
||||
height: Math.floor((imageHeight === 0 ? 600 * screenScaleFactor : imageHeight) * width / imageWidth);
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
||||
|
@ -33,14 +33,20 @@ Component {
|
|||
}
|
||||
}
|
||||
}
|
||||
source: {
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) {
|
||||
return OutputDevice.activePrinter.camera.latestImage;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth);
|
||||
width: Math.min(imageWidth === 0 ? 800 * screenScaleFactor : imageWidth, maximumWidth);
|
||||
z: 1;
|
||||
|
||||
Connections
|
||||
{
|
||||
target: OutputDevice.activePrinter.camera;
|
||||
onNewImage:
|
||||
{
|
||||
if (cameraImage.visible) {
|
||||
cameraImage.image = OutputDevice.activePrinter.camera.latestImage;
|
||||
cameraImage.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue