<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Problem with using surface RGB16_565 as source"
href="https://bugs.freedesktop.org/show_bug.cgi?id=90680">90680</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Problem with using surface RGB16_565 as source
</td>
</tr>
<tr>
<th>Product</th>
<td>cairo
</td>
</tr>
<tr>
<th>Version</th>
<td>1.12.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>image backend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>chris@chris-wilson.co.uk
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ondrej.tuma@firma.seznam.cz
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>cairo-bugs@cairographics.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=116078" name="attach_116078" title="Error output image">attachment 116078</a> <a href="attachment.cgi?id=116078&action=edit" title="Error output image">[details]</a></span>
Error output image
Hi,
I'm using version on debian Wheezy (1.12.2) or debian Jessie (1.14.0). Problem
"works" on both version. As i use cairomm or vala, this problem is in cairo
(vala doing precompilation source to C source).
I'm working with two image surfaces with format RGB16_565. One as source, and
one as target. Sometimes using surface work fine, sometimes cairo gets another
part of surface memmory, so get's another source part which I want.
Here is test in Vala language:
// start of Vala test
// modules: Cairo
const uint16 WIDTH = 720;
const uint16 HEIGHT = 360;
public Cairo.ImageSurface get_source () {
Cairo.ImageSurface surface = new Cairo.ImageSurface (
Cairo.Format.RGB16_565,
WIDTH,
HEIGHT);
Cairo.Context cr = new Cairo.Context (surface);
cr.set_antialias (Cairo.Antialias.NONE);
cr.set_line_width (1.0);
cr.rectangle (0, 0, WIDTH, HEIGHT);
cr.set_source_rgb(0.5, 0.5, 0.5);
cr.fill();
for (uint16 y = 0; y < HEIGHT; y+=5) {
cr.set_source_rgb (0.0, 0.0, y/(double)HEIGHT);
cr.move_to(0, y);
cr.line_to(WIDTH, y);
cr.stroke();
}
for (uint16 x = 0; x < WIDTH; x+=10) {
cr.set_source_rgb (0.0, x/(double)WIDTH, 0.0);
cr.move_to (x, 0);
cr.line_to (x, HEIGHT);
cr.stroke();
}
surface.write_to_png ("source.png");
return surface;
}
public void use_source (Cairo.ImageSurface source) {
Cairo.ImageSurface surface = new Cairo.ImageSurface (
Cairo.Format.RGB16_565,
162,
115);
Cairo.Context cr = new Cairo.Context (surface);
cr.set_antialias (Cairo.Antialias.NONE);
cr.set_line_width (1.0);
cr.set_source_surface (source, -166, -139);
cr.arc(80, 60, 30, 0, 6.28); // bad part
cr.fill();
cr.rectangle(0,0,162,30); // right part
cr.fill();
surface.write_to_png ("target.png");
}
public int main (string [] args) {
Cairo.ImageSurface source = get_source();
use_source (source);
return 0;
} // end of vala test
To compile, type:
~$ valac --pkg=cairo cairo-bug.vala
And Here is c++ test:
// Start of c++ test
#include <stdint.h>
#include <cairomm/surface.h>
#include <cairomm/context.h>
const uint16_t WIDTH = 720;
const uint16_t HEIGHT = 360;
Cairo::RefPtr<Cairo::ImageSurface> get_source () {
Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(
Cairo::FORMAT_RGB16_565,
WIDTH,
HEIGHT);
Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
cr->set_line_width(1.0);
cr->set_antialias (Cairo::Antialias::ANTIALIAS_NONE);
cr->rectangle (0, 0, WIDTH, HEIGHT);
cr->set_source_rgb(0.5, 0.5, 0.5);
cr->fill();
for (uint16_t y = 0; y < HEIGHT; y+=5) {
cr->set_source_rgb (0.0, 0.0, y/(double)HEIGHT);
cr->move_to(0, y);
cr->line_to(WIDTH, y);
cr->stroke();
}
for (uint16_t x = 0; x < WIDTH; x+=10) {
cr->set_source_rgb (0.0, x/(double)WIDTH, 0.0);
cr->move_to (x, 0);
cr->line_to (x, HEIGHT);
cr->stroke();
}
surface->write_to_png ("source.png");
return surface;
}
void use_source (Cairo::RefPtr<Cairo::ImageSurface> source) {
Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(
Cairo::FORMAT_RGB16_565,
162,
115);
Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
cr->set_line_width(1.0);
cr->set_antialias (Cairo::Antialias::ANTIALIAS_NONE);
cr->set_source (source, -166, -139);
cr->arc(80, 60, 30, 0, 6.28); // bad part
cr->fill();
cr->rectangle(0,0,162,30); // right part
cr->fill();
surface->write_to_png ("target.png");
}
int main (int argv, char ** argc) {
Cairo::RefPtr<Cairo::ImageSurface> source = get_source();
use_source (source);
return 0;
} // End of c++ test
To compile cairomm test, type:
~$ g++ `pkg-config --libs --cflags cairomm-1.0` -std=c++11 cairo-bug.cc -o
cairo-bug
In attachment image you can see what fails. If I use RGB24 format, all works
fine :)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>