Bug 5904 - scaling 1x1 images doesn't have useful results
Summary: scaling 1x1 images doesn't have useful results
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.1.1
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3387 10881
  Show dependency treegraph
 
Reported: 2006-02-16 16:57 UTC by Jeff Muizelaar
Modified: 2008-10-10 11:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
1x1 scaling with CAIRO_FILTER_BEST (4.22 KB, image/png)
2006-02-16 16:57 UTC, Jeff Muizelaar
Details
1x1 scaling with CAIRO_FILTER_BEST (13.00 KB, image/png)
2006-02-16 16:59 UTC, Jeff Muizelaar
Details
1x1 scaling with CAIRO_FILTER_NEAREST (9.84 KB, image/png)
2006-02-16 16:59 UTC, Jeff Muizelaar
Details
source code for generating the test images (2.02 KB, text/plain)
2006-02-17 04:09 UTC, Jeff Muizelaar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Muizelaar 2006-02-16 16:57:09 UTC
It seems that scaling 1x1 images produces bad results for both
CAIRO_FILTER_NEAREST and CAIRO_FILTER_BEST.

CAIRO_FILTER_BEST causes bluring at the edges.

CAIRO_FILTER_NEAREST occasionally causes the image to disapear.

examples of both bad behaviours are attached.
Comment 1 Jeff Muizelaar 2006-02-16 16:57:58 UTC
Created attachment 4629 [details]
1x1 scaling with CAIRO_FILTER_BEST
Comment 2 Jeff Muizelaar 2006-02-16 16:59:20 UTC
Created attachment 4630 [details]
1x1 scaling with CAIRO_FILTER_BEST
Comment 3 Jeff Muizelaar 2006-02-16 16:59:50 UTC
Created attachment 4631 [details]
1x1 scaling with CAIRO_FILTER_NEAREST
Comment 4 Carl Worth 2006-02-17 03:40:29 UTC
Thanks for the excellent report.

Can you contribute a program to draw those images? That would be a nice thing to
throw into the test suite.

It's possible that fixes for a couple of existing bugs will help for this
situation as well. For example:

[cairo] broken pixman bilinear filtering?
http://lists.freedesktop.org/archives/cairo/2006-February/006293.html
might explain the CAIRO_FILTER_BEST behavior and that's fixed with the patch in
bug #2488.

For CAIRO_FILTER_NEAREST, the existing XFAIL filter-nearest-offset case may
capture the failure.

Regardless, it should also be quite easy to workaround this in cairo by
recognizing a 1x1 surface pattern and instead use a solid surface in its place.

-Carl


as well as the existing XFAIL 
Comment 5 Owen Taylor 2006-02-17 04:07:34 UTC
I'm puzzled why there isn't a lot *more* blurring of the edges with
the BEST filter ... with EXTEND_NONE, scaling up a 1x1 source image
should give a blur.

(Generally, for scaling images without alpha, you want to use 
EXTEND_PAD (1.2 addition), and draw a rectangle the size of the 
scaled result.)

It's hard to interpret the images without the source code that draws 
them.
Comment 6 Jeff Muizelaar 2006-02-17 04:09:31 UTC
Created attachment 4633 [details]
source code for generating the test images
Comment 7 Chris Wilson 2008-10-10 11:36:47 UTC
The behaviour of the current code appears to be correct, the test suite exercises NEAREST and BILINEAR scaling and the suggestion to swap the 1x1 source with a solid colour has been added to todo.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.