Bug 417275

Summary: scanAreaWidth and scanAreaHeight are wrong
Product: [Frameworks and Libraries] libksane Reporter: Martin <martin.marmsoler>
Component: generalAssignee: Kåre Särs <kare.sars>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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