Commit bef5a548 authored by Kristian Høgsberg's avatar Kristian Høgsberg

2005-05-12 Kristian Høgsberg <krh@redhat.com>

        * poppler/CairoOutputDev.cc:
        * poppler/CairoOutputDevX.cc:
        * poppler/CairoOutputDevImage.cc:
        * test/gtk-cairo-test.cc: Update to latest cairo changes, patch
        from Jens Taprogge (#3281)
parent c10ea2dd
2005-05-12 Kristian Høgsberg <krh@redhat.com>
* poppler/CairoOutputDev.cc:
* poppler/CairoOutputDevX.cc:
* poppler/CairoOutputDevImage.cc:
* test/gtk-cairo-test.cc: Update to latest cairo changes, patch
from Jens Taprogge (#3281)
2005-05-11 Kristian Høgsberg <krh@redhat.com>
* glib/poppler.cc (poppler_get_backend, poppler_get_version): Add
......
......@@ -77,7 +77,7 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state) {
createCairo (state);
cairo_reset_clip (cairo);
cairo_set_rgb_color (cairo, 0, 0, 0);
cairo_set_source_rgb (cairo, 0, 0, 0);
cairo_set_operator (cairo, CAIRO_OPERATOR_OVER);
cairo_set_line_cap (cairo, CAIRO_LINE_CAP_BUTT);
cairo_set_line_join (cairo, CAIRO_LINE_JOIN_MITER);
......@@ -283,7 +283,7 @@ void CairoOutputDev::doPath(GfxState *state, GfxPath *path,
void CairoOutputDev::stroke(GfxState *state) {
doPath (state, state->getPath(), gFalse);
cairo_set_rgb_color (cairo,
cairo_set_source_rgb (cairo,
stroke_color.r, stroke_color.g, stroke_color.b);
LOG(printf ("stroke\n"));
cairo_stroke (cairo);
......@@ -292,7 +292,7 @@ void CairoOutputDev::stroke(GfxState *state) {
void CairoOutputDev::fill(GfxState *state) {
doPath (state, state->getPath(), gFalse);
cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING);
cairo_set_rgb_color (cairo,
cairo_set_source_rgb (cairo,
fill_color.r, fill_color.g, fill_color.b);
LOG(printf ("fill\n"));
cairo_fill (cairo);
......@@ -301,7 +301,7 @@ void CairoOutputDev::fill(GfxState *state) {
void CairoOutputDev::eoFill(GfxState *state) {
doPath (state, state->getPath(), gFalse);
cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_rgb_color (cairo,
cairo_set_source_rgb (cairo,
fill_color.r, fill_color.g, fill_color.b);
LOG(printf ("fill-eo\n"));
cairo_fill (cairo);
......@@ -410,7 +410,7 @@ void CairoOutputDev::drawString(GfxState *state, GooString *s)
// fill
if (!(render & 1)) {
LOG (printf ("fill string\n"));
cairo_set_rgb_color (cairo,
cairo_set_source_rgb (cairo,
fill_color.r, fill_color.g, fill_color.b);
cairo_show_glyphs (cairo, glyphs, count);
}
......@@ -418,7 +418,7 @@ void CairoOutputDev::drawString(GfxState *state, GooString *s)
// stroke
if ((render & 3) == 1 || (render & 3) == 2) {
LOG (printf ("stroke string\n"));
cairo_set_rgb_color (cairo,
cairo_set_source_rgb (cairo,
stroke_color.r, stroke_color.g, stroke_color.b);
cairo_glyph_path (cairo, glyphs, count);
cairo_stroke (cairo);
......@@ -497,7 +497,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
}
}
image = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_A8,
image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_A8,
width, height, row_stride);
if (image == NULL)
return;
......@@ -517,7 +517,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
cairo_matrix_invert (&matrix);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_surface_set_filter (image, CAIRO_FILTER_BEST);
cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST);
/* FIXME: Doesn't the image mask support any colorspace? */
cairo_set_source_rgb (cairo, fill_color.r, fill_color.g, fill_color.b);
cairo_mask (cairo, pattern);
......@@ -594,8 +594,8 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
}
}
image = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_ARGB32,
width, height, width * 4);
image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32,
width, height, width * 4);
if (image == NULL)
return;
pattern = cairo_pattern_create_for_surface (image);
......@@ -615,7 +615,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
cairo_matrix_invert (&matrix);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_surface_set_filter (image, CAIRO_FILTER_BEST);
cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST);
cairo_set_source (cairo, pattern);
cairo_paint (cairo);
......
......@@ -40,6 +40,7 @@ CairoOutputDevImage::~CairoOutputDevImage() {
void
CairoOutputDevImage::createCairo(GfxState *state) {
int w, h;
cairo_surface_t* surface;
w = state ? (int)(state->getPageWidth() + 0.5) : 1;
h = state ? (int)(state->getPageHeight() + 0.5) : 1;
......@@ -55,11 +56,11 @@ CairoOutputDevImage::createCairo(GfxState *state) {
memset (pixels, 0xff, pixels_w * pixels_h * 4);
cairo = cairo_create ();
cairo_set_target_image (cairo, (unsigned char *)pixels, CAIRO_FORMAT_ARGB32,
pixels_w, pixels_h,
pixels_w*4);
surface = cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32,
pixels_w, pixels_h,
pixels_w*4);
cairo = cairo_create (surface);
cairo_surface_destroy (surface);
}
......
......@@ -84,6 +84,7 @@ CairoOutputDevX::createCairo(GfxState *state) {
int w, h;
XGCValues gcv;
GC gc;
cairo_surface_t *surface;
w = state ? (int)(state->getPageWidth() + 0.5) : 1;
h = state ? (int)(state->getPageHeight() + 0.5) : 1;
......@@ -107,8 +108,10 @@ CairoOutputDevX::createCairo(GfxState *state) {
gc = XCreateGC(display, pixmap, GCForeground, &gcv);
XFillRectangle(display, pixmap, gc, 0, 0, w, h);
cairo = cairo_create ();
cairo_set_target_drawable (cairo, display, pixmap);
surface = cairo_xlib_surface_create_for_pixmap_with_visual(display, pixmap,
DefaultVisual(display, DefaultScreen(display)));
cairo = cairo_create (surface);
cairo_surface_destroy (surface);
XFreeGC(display, gc);
}
......
......@@ -85,10 +85,9 @@ GDKCairoOutputDev::createCairo(GfxState *state) {
Drawable xid;
GdkGC *gc;
GdkColor white;
cairo_surface_t *surface;
int w, h;
cairo = cairo_create ();
w = state ? (int)(state->getPageWidth() + 0.5) : 1;
h = state ? (int)(state->getPageHeight() + 0.5) : 1;
......@@ -113,7 +112,10 @@ GDKCairoOutputDev::createCairo(GfxState *state) {
display = gdk_x11_drawable_get_xdisplay (pixmap);
xid = gdk_x11_drawable_get_xid (pixmap);
cairo_set_target_drawable (cairo, display, xid);
surface = cairo_xlib_surface_create_for_pixmap_with_visual(display, xid,
DefaultVisual(display, DefaultScreen(display)));
cairo = cairo_create (surface);
cairo_surface_destroy (surface);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment