Commit 5dac3e90 authored by Debarshi Ray's avatar Debarshi Ray

Add a sink to guess the size of a GeglBuffer after PNG compression

https://bugzilla.gnome.org/show_bug.cgi?id=759363
parent 1e7aec38
......@@ -95,6 +95,7 @@ AC_DEFINE([GOA_API_IS_SUBJECT_TO_CHANGE], [], [We are aware that GOA's API can c
PKG_CHECK_MODULES(GRILO, [grilo-0.3 >= $GRILO_MIN_VERSION])
PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= $GTK_MIN_VERSION])
PKG_CHECK_MODULES(GTK_UNIX_PRINT, [gtk+-unix-print-3.0])
PKG_CHECK_MODULES(PNG, [libpng16])
PKG_CHECK_MODULES(TRACKER, [tracker-control-1.0 tracker-sparql-1.0])
AX_REQUIRE_DEFINED([LIBGD_INIT])
......
......@@ -134,6 +134,8 @@ gnome_photos_SOURCES = \
photos-operation-insta-filter.h \
photos-operation-jpg-guess-sizes.c \
photos-operation-jpg-guess-sizes.h \
photos-operation-png-guess-sizes.c \
photos-operation-png-guess-sizes.h \
photos-organize-collection-dialog.c \
photos-organize-collection-dialog.h \
photos-organize-collection-model.c \
......@@ -144,6 +146,8 @@ gnome_photos_SOURCES = \
photos-overview-searchbar.h \
photos-pipeline.c \
photos-pipeline.h \
photos-png-count.c \
photos-png-count.h \
photos-preview-model.c \
photos-preview-model.h \
photos-preview-nav-buttons.c \
......@@ -282,6 +286,7 @@ AM_CPPFLAGS = \
$(GRILO_CFLAGS) \
$(GTK_CFLAGS) \
$(GTK_UNIX_PRINT_CFLAGS) \
$(PNG_CFLAGS) \
$(TRACKER_CFLAGS) \
-I$(top_srcdir)/libgd \
$(NULL)
......@@ -309,6 +314,7 @@ gnome_photos_LDADD = \
$(GTK_LIBS) \
$(GTK_UNIX_PRINT_LIBS) \
$(JPEG_LIBS) \
$(PNG_LIBS) \
$(TRACKER_LIBS) \
$(LIBM) \
$(top_builddir)/libgd/libgd.la \
......
This diff is collapsed.
/*
* Photos - access, organize and share your photos on GNOME
* Copyright © 2016 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef PHOTOS_OPERATION_PNG_GUESS_SIZES_H
#define PHOTOS_OPERATION_PNG_GUESS_SIZES_H
#include <glib-object.h>
G_BEGIN_DECLS
#define PHOTOS_TYPE_OPERATION_PNG_GUESS_SIZES (photos_operation_png_guess_sizes_get_type ())
#define PHOTOS_OPERATION_PNG_GUESS_SIZES(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PHOTOS_TYPE_OPERATION_PNG_GUESS_SIZES, PhotosOperationPngGuessSizes))
#define PHOTOS_IS_OPERATION_PNG_GUESS_SIZES(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PHOTOS_TYPE_OPERATION_PNG_GUESS_SIZES))
typedef struct _PhotosOperationPngGuessSizes PhotosOperationPngGuessSizes;
typedef struct _PhotosOperationPngGuessSizesClass PhotosOperationPngGuessSizesClass;
GType photos_operation_png_guess_sizes_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* PHOTOS_OPERATION_PNG_GUESS_SIZES_H */
/*
* Photos - access, organize and share your photos on GNOME
* Copyright © 2016 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#include "config.h"
#include "photos-png-count.h"
static void
photos_png_count_flush_data (png_structp png_ptr)
{
}
static void
photos_png_count_write_data (png_structp png_ptr, png_bytep data, png_size_t length)
{
gsize *out_count;
out_count = (gsize *) png_get_io_ptr (png_ptr);
if (out_count != NULL)
*out_count += (gsize) length;
}
void
photos_png_init_count (png_structp png_ptr, gsize *out_count)
{
png_set_write_fn (png_ptr, out_count, photos_png_count_write_data, photos_png_count_flush_data);
if (out_count != NULL)
*out_count = 0;
}
/*
* Photos - access, organize and share your photos on GNOME
* Copyright © 2016 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef PHOTOS_PNG_COUNT_H
#define PHOTOS_PNG_COUNT_H
#include <glib.h>
#include <png.h>
G_BEGIN_DECLS
void photos_png_init_count (png_structp png_ptr, gsize *out_count);
G_END_DECLS
#endif /* PHOTOS_PNG_COUNT_H */
......@@ -45,6 +45,7 @@
#include "photos-operation-insta-curve.h"
#include "photos-operation-insta-filter.h"
#include "photos-operation-jpg-guess-sizes.h"
#include "photos-operation-png-guess-sizes.h"
#include "photos-query.h"
#include "photos-source.h"
#include "photos-tool.h"
......@@ -812,6 +813,7 @@ photos_utils_ensure_builtins (void)
g_type_ensure (PHOTOS_TYPE_OPERATION_INSTA_CURVE);
g_type_ensure (PHOTOS_TYPE_OPERATION_INSTA_FILTER);
g_type_ensure (PHOTOS_TYPE_OPERATION_JPG_GUESS_SIZES);
g_type_ensure (PHOTOS_TYPE_OPERATION_PNG_GUESS_SIZES);
g_type_ensure (PHOTOS_TYPE_TOOL_COLORS);
g_type_ensure (PHOTOS_TYPE_TOOL_CROP);
......
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