cairo: Update to 1.15.2

This commit is contained in:
Alexey Pavlov
2016-03-30 10:41:56 +03:00
parent fc0b12aa2d
commit 9cdd0aa4a1
2 changed files with 7 additions and 147 deletions

View File

@@ -1,138 +0,0 @@
From 16898ba11b4d6e9e2e64bb2d02d0fb5adbe266e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
=?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 26 Mar 2015 19:33:43 +0000
Subject: win32: Add cairo API to set up a Win32 surface for an HDC with an
alpha channel.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Руслан Ижбулатов <lrn1986@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
diff --git a/src/cairo-win32.h b/src/cairo-win32.h
index 3d2e1c6..db4cac6 100644
--- a/src/cairo-win32.h
+++ b/src/cairo-win32.h
@@ -49,6 +49,10 @@ cairo_public cairo_surface_t *
cairo_win32_surface_create (HDC hdc);
cairo_public cairo_surface_t *
+cairo_win32_surface_create_with_format (HDC hdc,
+ cairo_format_t format);
+
+cairo_public cairo_surface_t *
cairo_win32_printing_surface_create (HDC hdc);
cairo_public cairo_surface_t *
diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c
index 965f2c4..1571480 100644
--- a/src/win32/cairo-win32-display-surface.c
+++ b/src/win32/cairo-win32-display-surface.c
@@ -917,31 +917,41 @@ static const cairo_surface_backend_t cairo_win32_display_surface_backend = {
*/
/**
- * cairo_win32_surface_create:
+ * cairo_win32_surface_create_with_format:
* @hdc: the DC to create a surface for
+ * @format: format of pixels in the surface to create
*
* Creates a cairo surface that targets the given DC. The DC will be
* queried for its initial clip extents, and this will be used as the
- * size of the cairo surface. The resulting surface will always be of
- * format %CAIRO_FORMAT_RGB24; should you need another surface format,
- * you will need to create one through
- * cairo_win32_surface_create_with_dib().
+ * size of the cairo surface.
*
- * Return value: the newly created surface
+ * Supported formats are:
+ * %CAIRO_FORMAT_ARGB32
+ * %CAIRO_FORMAT_RGB24
*
- * Since: 1.0
+ * Note: @format only tells cairo how to draw on the surface, not what
+ * the format of the surface is. Namely, cairo does not (and cannot)
+ * check that @hdc actually supports alpha-transparency.
+ *
+ * Return value: the newly created surface, NULL on failure
+ *
+ * Since: 1.14.3
**/
cairo_surface_t *
-cairo_win32_surface_create (HDC hdc)
+cairo_win32_surface_create_with_format (HDC hdc, cairo_format_t format)
{
cairo_win32_display_surface_t *surface;
- cairo_format_t format;
cairo_status_t status;
cairo_device_t *device;
- /* Assume that everything coming in as a HDC is RGB24 */
- format = CAIRO_FORMAT_RGB24;
+ switch (format) {
+ default:
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
+ case CAIRO_FORMAT_ARGB32:
+ case CAIRO_FORMAT_RGB24:
+ break;
+ }
surface = malloc (sizeof (*surface));
if (surface == NULL)
@@ -977,6 +987,28 @@ cairo_win32_surface_create (HDC hdc)
}
/**
+ * cairo_win32_surface_create:
+ * @hdc: the DC to create a surface for
+ *
+ * Creates a cairo surface that targets the given DC. The DC will be
+ * queried for its initial clip extents, and this will be used as the
+ * size of the cairo surface. The resulting surface will always be of
+ * format %CAIRO_FORMAT_RGB24; should you need another surface format,
+ * you will need to create one through
+ * cairo_win32_surface_create_with_format() or
+ * cairo_win32_surface_create_with_dib().
+ *
+ * Return value: the newly created surface, NULL on failure
+ *
+ * Since: 1.0
+ **/
+cairo_surface_t *
+cairo_win32_surface_create (HDC hdc)
+{
+ return cairo_win32_surface_create_with_format (hdc, CAIRO_FORMAT_RGB24);
+}
+
+/**
* cairo_win32_surface_create_with_dib:
* @format: format of pixels in the surface to create
* @width: width of the surface, in pixels
@@ -1027,12 +1059,16 @@ cairo_win32_surface_create_with_ddb (HDC hdc,
HDC screen_dc, ddb_dc;
HBITMAP saved_dc_bitmap;
- if (format != CAIRO_FORMAT_RGB24)
+ switch (format) {
+ default:
+/* XXX handle these eventually */
+ case CAIRO_FORMAT_A8:
+ case CAIRO_FORMAT_A1:
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
-/* XXX handle these eventually
- format != CAIRO_FORMAT_A8 ||
- format != CAIRO_FORMAT_A1)
-*/
+ case CAIRO_FORMAT_ARGB32:
+ case CAIRO_FORMAT_RGB24:
+ break;
+ }
if (!hdc) {
screen_dc = GetDC (NULL);
--
cgit v0.10.2

View File

@@ -4,7 +4,7 @@
_realname=cairo
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.14.4
pkgver=1.15.2
pkgrel=1
pkgdesc="Cairo vector graphics library (mingw-w64)"
arch=('any')
@@ -28,20 +28,18 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
)
optdepends=("${MINGW_PACKAGE_PREFIX}-glib2: libcairo-gobject")
options=('strip' 'staticlibs')
source=("http://cairographics.org/releases/cairo-${pkgver}.tar.xz"
source=(#"http://cairographics.org/releases/cairo-${pkgver}.tar.xz"
http://cairographics.org/snapshots/cairo-${pkgver}.tar.xz
0009-standalone-headers.mingw.patch
0026-create-argb-fonts.all.patch
0030-add-cairo-API-to-setup-Win32-surface-for-HDC.patch)
sha256sums=('f6ec9c7c844db9ec011f0d66b57ef590c45adf55393d1fc249003512522ee716'
0026-create-argb-fonts.all.patch)
sha256sums=('268cc265a7f807403582f440643064bf52896556766890c8df7bad02d230f6c9'
'234de8c5d4c28b03c19e638a353e8defb2de0367a634c002b0ea7d2877bd0756'
'6db6c44fbdb4926d09afa978fe80430186c4b7b7d255059602b1f94c6a079975'
'd11afdf01514de5d95a5492227217bde9efbcd9574c3882116f4dc288e5f87d6')
'6db6c44fbdb4926d09afa978fe80430186c4b7b7d255059602b1f94c6a079975')
prepare() {
cd "${srcdir}"/${_realname}-${pkgver}
patch -p1 -i ${srcdir}/0009-standalone-headers.mingw.patch
patch -p1 -i ${srcdir}/0026-create-argb-fonts.all.patch
patch -p1 -i ${srcdir}/0030-add-cairo-API-to-setup-Win32-surface-for-HDC.patch
autoreconf -fi
}
@@ -70,7 +68,7 @@ build() {
--disable-silent-rules \
ac_cv_prog_GS=${MINGW_PREFIX}/bin/gsc
make
make #-j1 V=1
}
package() {