Bug 417275 - scanAreaWidth and scanAreaHeight are wrong
Summary: scanAreaWidth and scanAreaHeight are wrong
Status: RESOLVED NOT A BUG
Alias: None
Product: libksane
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Kåre Särs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-07 15:48 UTC by Martin
Modified: 2020-02-08 06:42 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2020-02-07 15:48:21 UTC
Checked out the scanAreaWidth() /Height functions and saw that there is returned the max value, why?
Shouldn't it return the value? m_optBrX->getValue()?

float KSaneWidget::scanAreaWidth()
{
    float result = 0.0;
    if (d->m_optBrX) {
        if (d->m_optBrX->getUnit() == SANE_UNIT_PIXEL) {
            d->m_optBrX->getMaxValue(result);
            float dpi = currentDPI();
            if (dpi < 1) {
                qDebug() << "Broken DPI value";
                dpi = 1.0;
            }
            result = result / dpi / 25.4;
        } else if (d->m_optBrX->getUnit() == SANE_UNIT_MM) {
            d->m_optBrX->getMaxValue(result);
        }
    }
    return result;
}
Comment 1 Kåre Särs 2020-02-08 06:42:51 UTC
Hi,

/** This method returns the scan area's width in mm
    * @return Width of the scannable area in mm */

Notice that they return the "scannable" area of the scan source and not the current selection.

We set tlx, tly, brx, bry to select the area of interest and the max values show what is possible to select.

If you have better wording for the the function description, so that it would be clearer, please reopen or create a review request at https://phabricator.kde.org/differential/diff/create/ (or with arc)


Thanks,
   Kåre