use dpi of the first cleanupped frame (#1391)
This commit is contained in:
parent
7f20440e9d
commit
e0fcf9792b
6 changed files with 47 additions and 28 deletions
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
class DVAPI TCleanupper {
|
||||
CleanupParameters *m_parameters;
|
||||
TPointD m_customDpi;
|
||||
TPointD m_sourceDpi;
|
||||
|
||||
private:
|
||||
TCleanupper()
|
||||
|
@ -101,8 +101,8 @@ time, to unlock a possibly useful memory block.
|
|||
TRasterImageP autocenterOnly(const TRasterImageP &image, bool isCameraTest,
|
||||
bool &autocentered);
|
||||
|
||||
TPointD getCustomDpi() const { return m_customDpi; }
|
||||
void setCustomDpi(const TPointD &dpi) { m_customDpi = dpi; }
|
||||
TPointD getSourceDpi() const { return m_sourceDpi; }
|
||||
void setSourceDpi(const TPointD &dpi) { m_sourceDpi = dpi; }
|
||||
|
||||
private:
|
||||
// process phase
|
||||
|
|
|
@ -439,10 +439,19 @@ static void cleanupLevel(TXshSimpleLevel *xl, std::set<TFrameId> fidsInXsheet,
|
|||
updater.update(fid, ri);
|
||||
continue;
|
||||
}
|
||||
double dpix, dpiy;
|
||||
original->getDpi(dpix, dpiy);
|
||||
cl->setCustomDpi((dpix == 0 && dpiy == 0) ? xl->getProperties()->getDpi()
|
||||
: TPointD());
|
||||
// Obtain the source dpi. Changed it to be done once at the first frame of
|
||||
// each level in order to avoid the following problem:
|
||||
// If the original raster level has no dpi (such as TGA images), obtaining
|
||||
// dpi in every frame causes dpi mismatch between the first frame and the
|
||||
// following frames, since the value
|
||||
// TXshSimpleLevel::m_properties->getDpi() will be changed to the
|
||||
// dpi of cleanup camera (= TLV's dpi) after finishing the first frame.
|
||||
if (firstImage) {
|
||||
TPointD dpi;
|
||||
original->getDpi(dpi.x, dpi.y);
|
||||
if (dpi.x == 0 && dpi.y == 0) dpi = xl->getProperties()->getDpi();
|
||||
cl->setSourceDpi(dpi);
|
||||
}
|
||||
|
||||
CleanupPreprocessedImage *cpi;
|
||||
{
|
||||
|
|
|
@ -292,9 +292,9 @@ CleanupPopup::CleanupPopup()
|
|||
, m_params(new CleanupParameters)
|
||||
, m_updater(new LevelUpdater)
|
||||
, m_originalLevelPath()
|
||||
, m_originalPalette(0) {
|
||||
, m_originalPalette(0)
|
||||
, m_firstLevelFrame(true) {
|
||||
setWindowTitle(tr("Cleanup"));
|
||||
|
||||
// Progress Bar
|
||||
m_progressLabel = new QLabel(tr("Cleanup in progress"));
|
||||
m_progressBar = new QProgressBar;
|
||||
|
@ -1217,10 +1217,20 @@ void CleanupPopup::cleanupFrame() {
|
|||
IconGenerator::instance()->invalidate(sl, fid);
|
||||
} else {
|
||||
// Perform main processing
|
||||
double dpix, dpiy;
|
||||
original->getDpi(dpix, dpiy);
|
||||
cl->setCustomDpi((dpix == 0 && dpiy == 0) ? sl->getProperties()->getDpi()
|
||||
: TPointD());
|
||||
|
||||
// Obtain the source dpi. Changed it to be done once at the first frame of
|
||||
// each level in order to avoid the following problem:
|
||||
// If the original raster level has no dpi (such as TGA images), obtaining
|
||||
// dpi in every frame causes dpi mismatch between the first frame and the
|
||||
// following frames, since the value
|
||||
// TXshSimpleLevel::m_properties->getDpi() will be changed to the
|
||||
// dpi of cleanup camera (= TLV's dpi) after finishing the first frame.
|
||||
if (m_firstLevelFrame) {
|
||||
TPointD dpi;
|
||||
original->getDpi(dpi.x, dpi.y);
|
||||
if (dpi.x == 0 && dpi.y == 0) dpi = sl->getProperties()->getDpi();
|
||||
cl->setSourceDpi(dpi);
|
||||
}
|
||||
|
||||
CleanupPreprocessedImage *cpi;
|
||||
{
|
||||
|
|
|
@ -420,10 +420,10 @@ void CleanupSettingsModel::processFrame(TXshSimpleLevel *sl, TFrameId fid) {
|
|||
bool doCameraTest = (m_cameraTestsCount > 0);
|
||||
|
||||
// Retrieve new image dpi
|
||||
double dpix, dpiy;
|
||||
imageToCleanup->getDpi(dpix, dpiy);
|
||||
cl->setCustomDpi((dpix == 0 && dpiy == 0) ? sl->getProperties()->getDpi()
|
||||
: TPointD());
|
||||
TPointD dpi;
|
||||
imageToCleanup->getDpi(dpi.x, dpi.y);
|
||||
if (dpi.x == 0 && dpi.y == 0) dpi = sl->getProperties()->getDpi();
|
||||
cl->setSourceDpi(dpi);
|
||||
|
||||
// Perform primary cleanup processing
|
||||
if (doProcessing) {
|
||||
|
|
|
@ -1332,13 +1332,13 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
|
|||
if (yetToCleanupCell) // ORIENTATION: what's this?
|
||||
{
|
||||
if (o->isVerticalTimeline())
|
||||
p.fillRect(
|
||||
rect.adjusted(rect.width() / 2, 0, 0, 0),
|
||||
(isSelected) ? SelectedFullcolorColumnColor : FullcolorColumnColor);
|
||||
p.fillRect(rect.adjusted(rect.width() / 2, 0, 0, 0),
|
||||
(isSelected) ? m_viewer->getSelectedFullcolorColumnColor()
|
||||
: m_viewer->getFullcolorColumnColor());
|
||||
else
|
||||
p.fillRect(
|
||||
rect.adjusted(0, rect.height() / 2, 0, 0),
|
||||
(isSelected) ? SelectedFullcolorColumnColor : FullcolorColumnColor);
|
||||
p.fillRect(rect.adjusted(0, rect.height() / 2, 0, 0),
|
||||
(isSelected) ? m_viewer->getSelectedFullcolorColumnColor()
|
||||
: m_viewer->getFullcolorColumnColor());
|
||||
}
|
||||
|
||||
bool isLastRow = nextCell.isEmpty() ||
|
||||
|
|
|
@ -416,11 +416,11 @@ bool TCleanupper::getResampleValues(const TRasterImageP &image, TAffine &aff,
|
|||
saveBox.getLy() > 0 && saveBox.getLy() < rasterLy))
|
||||
raster_is_savebox = false;
|
||||
|
||||
image->getDpi(dpi.x, dpi.y);
|
||||
if (dpi == TPointD()) {
|
||||
dpi = getCustomDpi();
|
||||
if (dpi == TPointD()) dpi.x = dpi.y = 65.0; // using 65.0 as default DPI
|
||||
} else if (!dpi.x)
|
||||
// Use the same source dpi throughout the level
|
||||
dpi = getSourceDpi();
|
||||
if (dpi == TPointD())
|
||||
dpi.x = dpi.y = 65.0; // using 65.0 as default DPI //??????WHY
|
||||
else if (!dpi.x)
|
||||
dpi.x = dpi.y;
|
||||
else if (!dpi.y)
|
||||
dpi.y = dpi.x;
|
||||
|
|
Loading…
Reference in a new issue