mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 05:38:02 +02:00
[quartz] split out (experimental) quartz-image into separate file
This commit is contained in:
parent
b52f127c12
commit
e52bad5e33
6 changed files with 97 additions and 19 deletions
15
configure.in
15
configure.in
|
|
@ -342,6 +342,16 @@ CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
|
|||
quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
|
||||
])
|
||||
|
||||
CAIRO_BACKEND_ENABLE(quartz_image, Quartz Image, quartz-image, QUARTZ_IMAGE_SURFACE, no, [
|
||||
dnl There is no pkgconfig for quartz; lets do a header check
|
||||
if test "x$use_quartz" != "xyes"; then
|
||||
use_quartz_image="no (requires --enable-quartz)"
|
||||
else
|
||||
dnl we already have the header check and libs required from the quartz surface
|
||||
use_quartz_image="yes"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ===========================================================================
|
||||
|
||||
AC_MSG_CHECKING([for native Win32])
|
||||
|
|
@ -1060,6 +1070,7 @@ echo " image: yes (always builtin)"
|
|||
echo " Xlib: $use_xlib"
|
||||
echo " Xlib Xrender: $use_xlib_xrender"
|
||||
echo " Quartz: $use_quartz"
|
||||
echo " Quartz-image: $use_quartz_image"
|
||||
echo " XCB: $use_xcb"
|
||||
echo " Win32: $use_win32"
|
||||
echo " OS2: $use_os2"
|
||||
|
|
@ -1121,6 +1132,10 @@ if test x"$use_quartz" = "xyes" ; then
|
|||
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Quartz/'
|
||||
fi
|
||||
|
||||
if test x"$use_quartz_image" = "xyes" ; then
|
||||
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Quartz Image/'
|
||||
fi
|
||||
|
||||
if test x"$use_atsui" = "xyes" ; then
|
||||
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/ATSUI/'
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -186,6 +186,11 @@ cairo_sources += $(quartz_sources)
|
|||
backend_pkgconfigs += cairo-quartz.pc
|
||||
endif
|
||||
|
||||
if CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
||||
cairo_headers += cairo-quartz-image.h
|
||||
backend_pkgconfigs += cairo-quartz-image.pc
|
||||
endif
|
||||
|
||||
os_win32_sources = cairo-win32.c
|
||||
cairo_all_sources += $(os_win32_sources)
|
||||
if OS_WIN32
|
||||
|
|
|
|||
|
|
@ -36,18 +36,15 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
|
||||
#ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
||||
#include "cairo-quartz-image.h"
|
||||
#endif
|
||||
|
||||
#include "cairo-quartz-private.h"
|
||||
|
||||
#define SURFACE_ERROR_NO_MEMORY (_cairo_surface_create_in_error(_cairo_error(CAIRO_STATUS_NO_MEMORY)))
|
||||
#define SURFACE_ERROR_INVALID_FORMAT (_cairo_surface_create_in_error(_cairo_error(CAIRO_STATUS_INVALID_FORMAT)))
|
||||
|
||||
static void
|
||||
DataProviderReleaseCallback (void *info, const void *data, size_t size)
|
||||
{
|
||||
cairo_surface_t *surface = (cairo_surface_t *) info;
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
CGImageRef
|
||||
_cairo_quartz_create_cgimage (cairo_format_t format,
|
||||
unsigned int width,
|
||||
|
|
@ -129,6 +126,14 @@ FINISH:
|
|||
return image;
|
||||
}
|
||||
|
||||
#ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
||||
|
||||
static void
|
||||
DataProviderReleaseCallback (void *info, const void *data, size_t size)
|
||||
{
|
||||
cairo_surface_t *surface = (cairo_surface_t *) info;
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_cairo_quartz_image_surface_create_similar (void *asurface,
|
||||
|
|
@ -368,3 +373,5 @@ cairo_quartz_image_surface_get_image (cairo_surface_t *asurface)
|
|||
|
||||
return (cairo_surface_t*) surface->imageSurface;
|
||||
}
|
||||
|
||||
#endif /* CAIRO_HAS_QUARTZ_IMAGE_SURFACE */
|
||||
|
|
|
|||
59
src/cairo-quartz-image.h
Normal file
59
src/cairo-quartz-image.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2008 Mozilla Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it either under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation
|
||||
* (the "LGPL") or, at your option, under the terms of the Mozilla
|
||||
* Public License Version 1.1 (the "MPL"). If you do not alter this
|
||||
* notice, a recipient may use your version of this file under either
|
||||
* the MPL or the LGPL.
|
||||
*
|
||||
* You should have received a copy of the LGPL along with this library
|
||||
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* You should have received a copy of the MPL along with this library
|
||||
* in the file COPYING-MPL-1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
||||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir@mozilla.com>
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_QUARTZ_IMAGE_H
|
||||
#define CAIRO_QUARTZ_IMAGE_H
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#if CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
CAIRO_BEGIN_DECLS
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_quartz_image_surface_create (cairo_surface_t *image_surface);
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_quartz_image_surface_get_image (cairo_surface_t *surface);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#else /* CAIRO_HAS_QUARTZ_IMAGE_SURFACE */
|
||||
# error Cairo was not compiled with support for the quartz-image backend
|
||||
#endif /* CAIRO_HAS_QUARTZ_IMAGE_SURFACE */
|
||||
|
||||
#endif /* CAIRO_QUARTZ_IMAGE_H */
|
||||
|
|
@ -114,8 +114,10 @@ static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
|
|||
* Utility functions
|
||||
*/
|
||||
|
||||
#ifdef QUARTZ_DEBUG
|
||||
static void quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest);
|
||||
static void quartz_image_to_png (CGImageRef, char *dest);
|
||||
#endif
|
||||
|
||||
static cairo_quartz_surface_t *
|
||||
_cairo_quartz_surface_create_internal (CGContextRef cgContext,
|
||||
|
|
@ -2130,12 +2132,9 @@ void ExportCGImageToPNGFile(CGImageRef inImageRef, char* dest)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
quartz_image_to_png (CGImageRef imgref, char *dest)
|
||||
{
|
||||
#if 0
|
||||
static int sctr = 0;
|
||||
char sptr[] = "/Users/vladimir/Desktop/barXXXXX.png";
|
||||
|
||||
|
|
@ -2147,13 +2146,11 @@ quartz_image_to_png (CGImageRef imgref, char *dest)
|
|||
}
|
||||
|
||||
ExportCGImageToPNGFile(imgref, dest);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest)
|
||||
{
|
||||
#if 0
|
||||
static int sctr = 0;
|
||||
char sptr[] = "/Users/vladimir/Desktop/fooXXXXX.png";
|
||||
|
||||
|
|
@ -2178,5 +2175,6 @@ quartz_surface_to_png (cairo_quartz_surface_t *nq, char *dest)
|
|||
ExportCGImageToPNGFile(imgref, dest);
|
||||
|
||||
CGImageRelease(imgref);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* QUARTZ_DEBUG */
|
||||
|
|
|
|||
|
|
@ -57,12 +57,6 @@ cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext,
|
|||
cairo_public CGContextRef
|
||||
cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_quartz_image_surface_create (cairo_surface_t *image_surface);
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
cairo_quartz_image_surface_get_image (cairo_surface_t *surface);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#else /* CAIRO_HAS_QUARTZ_SURFACE */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue