app: add gimp_cairo_image_surface_create_buffer()
and use it to shrink text layer rendering to even fewer lines.
This commit is contained in:
@ -135,10 +135,12 @@ workaround_that_file_depends_on_plug_in = \
|
|||||||
# core, vectors and gegl are on the same architectural layer, prevent
|
# core, vectors and gegl are on the same architectural layer, prevent
|
||||||
# the linker from panicing
|
# the linker from panicing
|
||||||
calm_down_linker = \
|
calm_down_linker = \
|
||||||
-u $(SYMPREFIX)gimp_vectors_undo_get_type \
|
-u $(SYMPREFIX)gimp_vectors_undo_get_type \
|
||||||
-u $(SYMPREFIX)gimp_vectors_mod_undo_get_type \
|
-u $(SYMPREFIX)gimp_vectors_mod_undo_get_type \
|
||||||
-u $(SYMPREFIX)gimp_vectors_prop_undo_get_type \
|
-u $(SYMPREFIX)gimp_vectors_prop_undo_get_type \
|
||||||
-u $(SYMPREFIX)gimp_curve_map_pixels
|
-u $(SYMPREFIX)gimp_curve_map_pixels \
|
||||||
|
-u $(SYMPREFIX)gimp_cairo_image_surface_create_buffer \
|
||||||
|
-u $(SYMPREFIX)gimp_param_spec_duplicate
|
||||||
|
|
||||||
AM_LDFLAGS = \
|
AM_LDFLAGS = \
|
||||||
$(munix) \
|
$(munix) \
|
||||||
@ -147,8 +149,7 @@ AM_LDFLAGS = \
|
|||||||
$(workaround_that_core_depends_on_xcf) \
|
$(workaround_that_core_depends_on_xcf) \
|
||||||
$(workaround_that_core_depends_on_pdb) \
|
$(workaround_that_core_depends_on_pdb) \
|
||||||
$(workaround_that_plug_in_depends_on_pdb) \
|
$(workaround_that_plug_in_depends_on_pdb) \
|
||||||
$(workaround_that_file_depends_on_plug_in) \
|
$(workaround_that_file_depends_on_plug_in)
|
||||||
-u $(SYMPREFIX)gimp_param_spec_duplicate
|
|
||||||
|
|
||||||
gimpconsoleldadd = \
|
gimpconsoleldadd = \
|
||||||
xcf/libappxcf.a \
|
xcf/libappxcf.a \
|
||||||
|
@ -36,6 +36,34 @@
|
|||||||
static cairo_user_data_key_t surface_data_key = { 0, };
|
static cairo_user_data_key_t surface_data_key = { 0, };
|
||||||
|
|
||||||
|
|
||||||
|
GeglBuffer *
|
||||||
|
gimp_cairo_image_surface_create_buffer (cairo_surface_t *surface)
|
||||||
|
{
|
||||||
|
const Babl *format;
|
||||||
|
gint width;
|
||||||
|
gint height;
|
||||||
|
|
||||||
|
g_return_val_if_fail (surface != NULL, NULL);
|
||||||
|
g_return_val_if_fail (cairo_surface_get_type (surface) ==
|
||||||
|
CAIRO_SURFACE_TYPE_IMAGE, NULL);
|
||||||
|
|
||||||
|
width = cairo_image_surface_get_width (surface);
|
||||||
|
height = cairo_image_surface_get_height (surface);
|
||||||
|
|
||||||
|
if (cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR_ALPHA)
|
||||||
|
format = babl_format ("cairo-ARGB32");
|
||||||
|
else
|
||||||
|
format = babl_format ("cairo-RGB24");
|
||||||
|
|
||||||
|
return
|
||||||
|
gegl_buffer_linear_new_from_data (cairo_image_surface_get_data (surface),
|
||||||
|
format,
|
||||||
|
GEGL_RECTANGLE (0, 0, width, height),
|
||||||
|
cairo_image_surface_get_stride (surface),
|
||||||
|
(GDestroyNotify) cairo_surface_destroy,
|
||||||
|
cairo_surface_reference (surface));
|
||||||
|
}
|
||||||
|
|
||||||
cairo_pattern_t *
|
cairo_pattern_t *
|
||||||
gimp_cairo_stipple_pattern_create (const GimpRGB *fg,
|
gimp_cairo_stipple_pattern_create (const GimpRGB *fg,
|
||||||
const GimpRGB *bg,
|
const GimpRGB *bg,
|
||||||
|
@ -25,19 +25,21 @@
|
|||||||
#define __GIMP_CAIRO_H__
|
#define __GIMP_CAIRO_H__
|
||||||
|
|
||||||
|
|
||||||
cairo_pattern_t * gimp_cairo_stipple_pattern_create (const GimpRGB *fg,
|
GeglBuffer * gimp_cairo_image_surface_create_buffer (cairo_surface_t *surface);
|
||||||
const GimpRGB *bg,
|
|
||||||
gint index);
|
|
||||||
|
|
||||||
void gimp_cairo_add_arc (cairo_t *cr,
|
cairo_pattern_t * gimp_cairo_stipple_pattern_create (const GimpRGB *fg,
|
||||||
gdouble center_x,
|
const GimpRGB *bg,
|
||||||
gdouble center_y,
|
gint index);
|
||||||
gdouble radius,
|
|
||||||
gdouble start_angle,
|
void gimp_cairo_add_arc (cairo_t *cr,
|
||||||
gdouble slice_angle);
|
gdouble center_x,
|
||||||
void gimp_cairo_add_segments (cairo_t *cr,
|
gdouble center_y,
|
||||||
GimpSegment *segs,
|
gdouble radius,
|
||||||
gint n_segs);
|
gdouble start_angle,
|
||||||
|
gdouble slice_angle);
|
||||||
|
void gimp_cairo_add_segments (cairo_t *cr,
|
||||||
|
GimpSegment *segs,
|
||||||
|
gint n_segs);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_CAIRO_H__ */
|
#endif /* __GIMP_CAIRO_H__ */
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "gegl/gimp-gegl-utils.h"
|
#include "gegl/gimp-gegl-utils.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
|
#include "core/gimp-cairo.h"
|
||||||
#include "core/gimp-utils.h"
|
#include "core/gimp-utils.h"
|
||||||
#include "core/gimpcontext.h"
|
#include "core/gimpcontext.h"
|
||||||
#include "core/gimpcontainer.h"
|
#include "core/gimpcontainer.h"
|
||||||
@ -670,18 +671,13 @@ gimp_text_layer_render_layout (GimpTextLayer *layer,
|
|||||||
|
|
||||||
cairo_surface_flush (surface);
|
cairo_surface_flush (surface);
|
||||||
|
|
||||||
buffer =
|
buffer = gimp_cairo_image_surface_create_buffer (surface);
|
||||||
gegl_buffer_linear_new_from_data (cairo_image_surface_get_data (surface),
|
|
||||||
babl_format ("cairo-ARGB32"),
|
|
||||||
GEGL_RECTANGLE (0, 0, width, height),
|
|
||||||
cairo_image_surface_get_stride (surface),
|
|
||||||
(GDestroyNotify) cairo_surface_destroy,
|
|
||||||
surface);
|
|
||||||
|
|
||||||
gegl_buffer_copy (buffer, NULL,
|
gegl_buffer_copy (buffer, NULL,
|
||||||
gimp_drawable_get_buffer (drawable), NULL);
|
gimp_drawable_get_buffer (drawable), NULL);
|
||||||
|
|
||||||
g_object_unref (buffer);
|
g_object_unref (buffer);
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
gimp_drawable_update (drawable, 0, 0, width, height);
|
gimp_drawable_update (drawable, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user