Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
32fb7585
Commit
32fb7585
authored
Feb 16, 2022
by
Matan Ziv-Av
Committed by
Tomaz Canabrava
Feb 23, 2022
Browse files
Save sixel aspect ratio as a rational number, rather than a real number
Avoiding inexact floating point comparisons.
parent
34df013e
Pipeline
#141426
passed with stage
in 2 minutes and 17 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/Vt102Emulation.cpp
View file @
32fb7585
...
...
@@ -2246,8 +2246,8 @@ void Vt102Emulation::SixelModeDisable()
row
=
0
;
}
QPixmap
pixmap
=
QPixmap
::
fromImage
(
m_currentImage
.
copy
(
QRect
(
0
,
0
,
m_actualSize
.
width
(),
m_actualSize
.
height
())));
if
(
m_aspect
!=
1
)
{
pixmap
=
pixmap
.
scaled
(
pixmap
.
width
(),
m_aspect
*
pixmap
.
height
());
if
(
m_aspect
.
first
!=
m_aspect
.
second
)
{
pixmap
=
pixmap
.
scaled
(
pixmap
.
width
(),
m_aspect
.
first
*
pixmap
.
height
()
/
m_aspect
.
second
);
}
int
rows
=
-
1
,
cols
=
-
1
;
int
needScroll
=
_currentScreen
->
currentTerminalDisplay
()
->
addPlacement
(
pixmap
,
rows
,
cols
,
row
,
col
,
m_SixelScrolling
);
...
...
@@ -2446,7 +2446,7 @@ bool Vt102Emulation::processSixel(uint cc)
}
}
if
(
!
m_SixelStarted
&&
(
sixel
()
||
s
[
0
]
==
'!'
||
s
[
0
]
==
'#'
))
{
m_aspect
=
1
;
m_aspect
=
qMakePair
(
1
,
1
)
;
SixelModeEnable
(
30
,
6
);
}
if
(
sixel
())
{
...
...
@@ -2475,7 +2475,11 @@ bool Vt102Emulation::processSixel(uint cc)
// const int pixelHeight = argv[1];
if
(
!
m_SixelStarted
)
{
m_aspect
=
(
qreal
)
argv
[
0
]
/
argv
[
1
];
if
(
argv
[
1
]
==
0
||
argv
[
0
]
==
0
)
{
m_aspect
=
qMakePair
(
1
,
1
);
}
else
{
m_aspect
=
qMakePair
(
argv
[
0
],
argv
[
1
]);
}
const
int
width
=
argv
[
2
];
const
int
height
=
argv
[
3
];
SixelModeEnable
(
width
,
height
);
...
...
src/Vt102Emulation.h
View file @
32fb7585
...
...
@@ -212,7 +212,7 @@ private:
bool
m_preserveBackground
=
true
;
int
m_previousWidth
=
128
;
int
m_previousHeight
=
32
;
qreal
m_aspect
=
1.0
;
QPair
<
int
,
int
>
m_aspect
=
qMakePair
(
1
,
1
)
;
bool
m_SixelScrolling
=
true
;
QSize
m_actualSize
;
// For efficiency reasons, we keep the image in memory larger than what the end result is
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment