From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/ui/cache/svg_preview_cache.h | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/ui/cache/svg_preview_cache.h (limited to 'src/ui/cache/svg_preview_cache.h') diff --git a/src/ui/cache/svg_preview_cache.h b/src/ui/cache/svg_preview_cache.h new file mode 100644 index 0000000..9006eb4 --- /dev/null +++ b/src/ui/cache/svg_preview_cache.h @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/** @file + * @brief Preview cache + */ +/* + * Copyright (C) 2007 Bryce W. Harrington + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#ifndef SEEN_INKSCAPE_UI_SVG_PREVIEW_CACHE_H +#define SEEN_INKSCAPE_UI_SVG_PREVIEW_CACHE_H + +#include +#include +#include +#include <2geom/rect.h> +#include <2geom/int-point.h> + +namespace Inkscape { + +class Drawing; +class DrawingItem; + +} // namespace Inkscape + + +cairo_surface_t* render_surface(Inkscape::Drawing &drawing, double scale_factor, const Geom::Rect& dbox, + Geom::IntPoint pixsize, double device_scale, const guint32* checkerboard_color, bool no_clip); + +GdkPixbuf* render_pixbuf(Inkscape::Drawing &drawing, double scale_factor, const Geom::Rect& dbox, unsigned psize); + +namespace Inkscape { +namespace UI { +namespace Cache { + +class SvgPreview { + protected: + std::map _pixmap_cache; + + public: + SvgPreview(); + ~SvgPreview(); + + Glib::ustring cache_key(gchar const *uri, gchar const *name, unsigned psize) const; + GdkPixbuf* get_preview_from_cache(const Glib::ustring& key); + void set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px); + GdkPixbuf* get_preview(const gchar* uri, const gchar* id, Inkscape::DrawingItem *root, double scale_factor, unsigned int psize); + void remove_preview_from_cache(const Glib::ustring& key); +}; + +}; // namespace Cache +}; // namespace UI +}; // namespace Inkscape + + + +#endif // SEEN_INKSCAPE_UI_SVG_PREVIEW_CACHE_H +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : + + -- cgit v1.2.3