replace cairo_pattern with trunk implementation to remove missing rasters bug with cairo (referencing data_ after delete)

This commit is contained in:
Marcin Rudowski 2011-01-23 15:30:49 +00:00
parent c14d063069
commit 9e0b15f814

View file

@ -58,7 +58,9 @@ namespace mapnik
const unsigned int *in_end = in_ptr + pixels;
unsigned int *out_ptr;
out_ptr = data_ = new unsigned int[pixels];
surface_ = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, data.width(), data.height());
out_ptr = reinterpret_cast<unsigned int *>(surface_->get_data());
while (in_ptr < in_end)
{
@ -74,14 +76,13 @@ namespace mapnik
*out_ptr++ = (a << 24) | (r << 16) | (g << 8) | b;
}
surface_ = Cairo::ImageSurface::create(reinterpret_cast<unsigned char *>(data_), Cairo::FORMAT_ARGB32, data.width(), data.height(), data.width() * 4);
// mark the surface as dirty as we've modified it behind cairo's back
surface_->mark_dirty();
pattern_ = Cairo::SurfacePattern::create(surface_);
}
~cairo_pattern(void)
{
delete [] data_;
}
void set_matrix(Cairo::Matrix const& matrix)
@ -117,7 +118,6 @@ namespace mapnik
}
private:
unsigned int *data_;
Cairo::RefPtr<Cairo::ImageSurface> surface_;
Cairo::RefPtr<Cairo::SurfacePattern> pattern_;
};