Bug 90436

Summary: CAIRO_STATUS_NO_MEMORY after cairo_paint on 150x150 A8 image surface
Product: cairo Reporter: freedesktoporg
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description freedesktoporg 2015-05-13 13:53:50 UTC
I am trying to paint a surface (250x160 pixel) derived by reading an SVG file with rsvg and painting it on that surface on another A8 150x150 pixel image surface.

This worked up to a few month before the 1.14.0 release (git 337ab1f is ok, 1.14.0 and 1.14.2 not). Now cairo_status after cairo_paint returns CAIRO_STATUS_NO_MEMORY.

My code is below (full code at http://svn.gna.org/viewcvs/vfrnav/trunk/src/metgraph.cc?revision=228&view=markup). 

Cairo::RefPtr<Cairo::ImageSurface> sfc(Cairo::ImageSurface::create(Cairo::FORMAT_A8, 2 * get_width(), 2 * get_height()));
Cairo::RefPtr<Cairo::Context> ctx(Cairo::Context::create(sfc));
std::random_shuffle(m_groups.begin(), m_groups.end());
int stride(sfc->get_stride());
const uint8_t *data(sfc->get_data());
	double invmaxdensity(1.0 / (255.0 * get_width() * get_height()));
	for (groups_t::iterator gi(m_groups.begin()), ge(m_groups.end()); gi != ge; ++gi) {
 	for (int x = 0; x < 2; ++x)
 	for (int y = 0; y < 2; ++y) {
 	ctx->save();
 	ctx->translate(-x * get_width(), -y * get_height());
 	ctx->set_source(gi->get_pattern());
 	ctx->paint();
 	ctx->restore();
 	}
342 	sfc->flush();
Comment 1 freedesktoporg 2015-05-28 23:48:10 UTC
Bisecting points to this commit:

commit 45934f69cd158b7bb5632f5e4334a156795147f4
Author: Bill Spitzak <spitzak@gmail.com>
Date:   Thu Oct 9 19:46:16 2014 -0700

    image: Corrected extents calculations
    
    New implementations of _cairo_pattern_sampled_area and _cairo_pattern_get_extents
    which produce a more accurate bounding box. These do not depend on side-effects
    of analyze_filter, can handle different horizontal and vertical scales, filters
    wider than 1 for down-scaling, and compute a somewhat tighter bounding box
    in most cases.
    
    I removed the pad output of _cairo_pattern_analyze_filter as it is unused.
    
    Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Comment 2 GitLab Migration User 2018-08-25 14:02:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/320.

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.