[cairo-bugs] [Bug 90680] New: Problem with using surface RGB16_565 as source
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed May 27 07:06:42 PDT 2015
https://bugs.freedesktop.org/show_bug.cgi?id=90680
Bug ID: 90680
Summary: Problem with using surface RGB16_565 as source
Product: cairo
Version: 1.12.2
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: image backend
Assignee: chris at chris-wilson.co.uk
Reporter: ondrej.tuma at firma.seznam.cz
QA Contact: cairo-bugs at cairographics.org
Created attachment 116078
--> https://bugs.freedesktop.org/attachment.cgi?id=116078&action=edit
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 :)
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20150527/1b90567b/attachment.html>
More information about the cairo-bugs
mailing list