app: pass a format, not bpp, to gimp_viewable_get_dummy_pixbuf()
and add tons of <gegl.h> includes.
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* memcmp */
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
|
@ -794,35 +794,33 @@ gimp_viewable_get_new_preview (GimpViewable *viewable,
|
||||
* Returns: a #GimpTempBuf containing the preview image.
|
||||
**/
|
||||
GimpTempBuf *
|
||||
gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp)
|
||||
gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
const Babl *format)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GimpTempBuf *buf;
|
||||
guchar *src;
|
||||
guchar *dest;
|
||||
GeglBuffer *src_buffer;
|
||||
GeglBuffer *dest_buffer;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail (bpp == 3 || bpp == 4, NULL);
|
||||
g_return_val_if_fail (format != NULL, NULL);
|
||||
|
||||
pixbuf = gimp_viewable_get_dummy_pixbuf (viewable, width, height, bpp);
|
||||
pixbuf = gimp_viewable_get_dummy_pixbuf (viewable, width, height,
|
||||
babl_format_has_alpha (format));
|
||||
|
||||
buf = gimp_temp_buf_new (width, height, gimp_bpp_to_babl_format (bpp));
|
||||
buf = gimp_temp_buf_new (width, height, format);
|
||||
|
||||
src = gdk_pixbuf_get_pixels (pixbuf);
|
||||
dest = gimp_temp_buf_get_data (buf);
|
||||
src_buffer = gimp_pixbuf_create_buffer (pixbuf);
|
||||
dest_buffer = gimp_temp_buf_create_buffer (buf);
|
||||
|
||||
while (height--)
|
||||
{
|
||||
memcpy (dest, src, width * bpp);
|
||||
gegl_buffer_copy (src_buffer, NULL, dest_buffer, NULL);
|
||||
|
||||
src += gdk_pixbuf_get_rowstride (pixbuf);
|
||||
dest += width * bpp;
|
||||
}
|
||||
g_object_unref (src_buffer);
|
||||
g_object_unref (dest_buffer);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
@ -968,7 +966,7 @@ GdkPixbuf *
|
||||
gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp)
|
||||
gboolean with_alpha)
|
||||
{
|
||||
GdkPixbuf *icon;
|
||||
GdkPixbuf *pixbuf;
|
||||
@ -978,7 +976,6 @@ gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
||||
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail (bpp == 3 || bpp == 4, NULL);
|
||||
|
||||
icon = gdk_pixbuf_new_from_inline (-1, stock_question_64, FALSE, NULL);
|
||||
|
||||
@ -993,7 +990,7 @@ gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
||||
w = RINT (ratio * (gdouble) w);
|
||||
h = RINT (ratio * (gdouble) h);
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, (bpp == 4), 8, width, height);
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, with_alpha, 8, width, height);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
|
||||
if (w && h)
|
||||
|
@ -148,7 +148,7 @@ GimpTempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable,
|
||||
GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp);
|
||||
const Babl *format);
|
||||
|
||||
GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
||||
GimpContext *context,
|
||||
@ -162,7 +162,7 @@ GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
|
||||
GdkPixbuf * gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp);
|
||||
gboolean with_alpha);
|
||||
|
||||
gchar * gimp_viewable_get_description (GimpViewable *viewable,
|
||||
gchar **tooltip);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpthumb/gimpthumb.h"
|
||||
|
@ -735,13 +735,22 @@ drawable_thumbnail_invoker (GimpProcedure *procedure,
|
||||
width = MAX (1, (height * dwidth) / dheight);
|
||||
|
||||
if (image->gimp->config->layer_previews)
|
||||
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
|
||||
width, height);
|
||||
{
|
||||
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
|
||||
width, height);
|
||||
}
|
||||
else
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
width, height,
|
||||
gimp_drawable_has_alpha (drawable) ?
|
||||
4 : 3);
|
||||
{
|
||||
const Babl *format;
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
format = babl_format ("R'G'B'A u8");
|
||||
else
|
||||
format = babl_format ("R'G'B' u8");
|
||||
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
width, height, format);
|
||||
}
|
||||
|
||||
if (buf)
|
||||
{
|
||||
@ -813,15 +822,25 @@ drawable_sub_thumbnail_invoker (GimpProcedure *procedure,
|
||||
GimpTempBuf *buf;
|
||||
|
||||
if (image->gimp->config->layer_previews)
|
||||
buf = gimp_drawable_get_sub_preview (drawable,
|
||||
src_x, src_y,
|
||||
src_width, src_height,
|
||||
dest_width, dest_height);
|
||||
{
|
||||
buf = gimp_drawable_get_sub_preview (drawable,
|
||||
src_x, src_y,
|
||||
src_width, src_height,
|
||||
dest_width, dest_height);
|
||||
}
|
||||
else
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
dest_width, dest_height,
|
||||
gimp_drawable_has_alpha (drawable) ?
|
||||
4 : 3);
|
||||
{
|
||||
const Babl *format;
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
format = babl_format ("R'G'B'A u8");
|
||||
else
|
||||
format = babl_format ("R'G'B' u8");
|
||||
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
dest_width, dest_height,
|
||||
format);
|
||||
}
|
||||
|
||||
if (buf)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <pango/pangofc-fontmap.h>
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "tools-types.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpthumb/gimpthumb.h"
|
||||
|
@ -719,13 +719,22 @@ HELP
|
||||
width = MAX (1, (height * dwidth) / dheight);
|
||||
|
||||
if (image->gimp->config->layer_previews)
|
||||
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
|
||||
width, height);
|
||||
{
|
||||
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context,
|
||||
width, height);
|
||||
}
|
||||
else
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
width, height,
|
||||
gimp_drawable_has_alpha (drawable) ?
|
||||
4 : 3);
|
||||
{
|
||||
const Babl *format;
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
format = babl_format ("R'G'B'A u8");
|
||||
else
|
||||
format = babl_format ("R'G'B' u8");
|
||||
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
width, height, format);
|
||||
}
|
||||
|
||||
if (buf)
|
||||
{
|
||||
@ -798,15 +807,25 @@ HELP
|
||||
GimpTempBuf *buf;
|
||||
|
||||
if (image->gimp->config->layer_previews)
|
||||
buf = gimp_drawable_get_sub_preview (drawable,
|
||||
src_x, src_y,
|
||||
src_width, src_height,
|
||||
dest_width, dest_height);
|
||||
{
|
||||
buf = gimp_drawable_get_sub_preview (drawable,
|
||||
src_x, src_y,
|
||||
src_width, src_height,
|
||||
dest_width, dest_height);
|
||||
}
|
||||
else
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
dest_width, dest_height,
|
||||
gimp_drawable_has_alpha (drawable) ?
|
||||
4 : 3);
|
||||
{
|
||||
const Babl *format;
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
format = babl_format ("R'G'B'A u8");
|
||||
else
|
||||
format = babl_format ("R'G'B' u8");
|
||||
|
||||
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
|
||||
dest_width, dest_height,
|
||||
format);
|
||||
}
|
||||
|
||||
if (buf)
|
||||
{
|
||||
|
Reference in New Issue
Block a user