viewer: fixed crop matrix for export dialog

This commit is contained in:
itsmattkc
2021-04-29 00:31:19 +10:00
parent 502b5971f9
commit 2a1cbc5a25
5 changed files with 36 additions and 15 deletions
+2 -2
View File
@@ -301,9 +301,9 @@ void ViewerWidget::SetColorMenuEnabled(bool enabled)
void ViewerWidget::SetMatrix(const QMatrix4x4 &mat)
{
display_widget_->SetMatrixZoom(mat);
display_widget_->SetMatrixCrop(mat);
foreach (ViewerWindow* vw, windows_) {
vw->display_widget()->SetMatrixZoom(mat);
vw->display_widget()->SetMatrixCrop(mat);
}
}
+9 -4
View File
@@ -77,6 +77,13 @@ void ViewerDisplayWidget::SetMatrixZoom(const QMatrix4x4 &mat)
UpdateMatrix();
}
void ViewerDisplayWidget::SetMatrixCrop(const QMatrix4x4 &mat)
{
crop_matrix_ = mat;
update();
}
void ViewerDisplayWidget::UpdateCursor()
{
if (Core::instance()->tool() == Tool::kHand) {
@@ -355,11 +362,9 @@ void ViewerDisplayWidget::OnPaint()
VideoParams device_params(device_width, device_height, device_format, VideoParams::kInternalChannelCount);
renderer()->BlitColorManaged(color_service(), texture_to_draw, true, device_params, false,
combined_matrix_flipped_);
combined_matrix_flipped_, crop_matrix_);
}
QTransform world_transform = GenerateWorldTransform();
// Draw gizmos if we have any
if (gizmos_) {
NodeTraverser gt;
@@ -378,7 +383,7 @@ void ViewerDisplayWidget::OnPaint()
// Draw action/title safe areas
if (safe_margin_.is_enabled()) {
QPainter p(inner_widget());
p.setWorldTransform(world_transform);
p.setWorldTransform(GenerateWorldTransform());
p.setPen(Qt::lightGray);
p.setBrush(Qt::NoBrush);
+7
View File
@@ -115,6 +115,8 @@ public slots:
*/
void SetMatrixZoom(const QMatrix4x4& mat);
void SetMatrixCrop(const QMatrix4x4& mat);
/**
* @brief Enables or disables whether this color at the cursor should be emitted
*
@@ -257,6 +259,11 @@ private:
*/
QMatrix4x4 scale_matrix_;
/**
* @brief Crop only matrix
*/
QMatrix4x4 crop_matrix_;
/**
* @brief Cached result of translate_matrix_ and scale_matrix_ multiplied
*/