Drop skia backend

Commit 38806bc3 already disabled the backend from use, now drop the
code.
This commit is contained in:
Bryce Harrington 2018-10-16 10:31:48 -07:00
parent f246a2144f
commit 7786b8fe4e
10 changed files with 1 additions and 3540 deletions

6
README
View file

@ -181,12 +181,6 @@ Experimental surface backends
packages and developer dependencies are available at Netlabs:
ftp://ftp.netlabs.org/pub/cairo
skia backend
------------
Requires the skia library as of June 2014. Since skia is not
API stable, building against newer (or older) versions of skia
will probably fail.
Compiling
=========

View file

@ -249,31 +249,6 @@ AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printin
dnl ===========================================================================
dnl NOTE: We're temporarily disabiling this backend to see if anyone
dnl is actually using it. If you are, please mention on the cairo
dnl mailing list.
dnl CAIRO_ENABLE_SURFACE_BACKEND(skia, Skia, no, [
dnl AC_ARG_WITH([skia],
dnl [AS_HELP_STRING([--with-skia=/path/to/skia],
dnl [directory to find compiled skia sources])],
dnl [skia_DIR="$withval"],
dnl [skia_DIR="`pwd`/../skia"])
dnl AC_ARG_WITH([skia-build-type],
dnl [AS_HELP_STRING([--with-skia-build-type=(Release|Debug)]
dnl [build of skia to link with, default is Release])],
dnl [skia_BUILD_TYPE="$withval"],
dnl [skia_BUILD_TYPE="Release"])
dnl skia_NONPKGCONFIG_CFLAGS="-I$skia_DIR/include/config -I$skia_DIR/include/core -I$skia_DIR/include/effects"
dnl if test "x$skia_BUILD_TYPE" = "xRelease"; then
dnl skia_NONPKGCONFIG_CFLAGS="-DSK_RELEASE -DSK_CAN_USE_FLOAT $skia_NONPKGCONFIG_CFLAGS"
dnl fi
dnl skia_NONPKGCONFIG_LIBS="-L$skia_DIR/out/$skia_BUILD_TYPE/lib.target/ -lskia -lstdc++"
dnl AC_SUBST(skia_DIR)
dnl ])
dnl ===========================================================================
CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
case "$host" in
*-*-os2*)
@ -887,7 +862,6 @@ dnl ===========================================================================
dnl Extra stuff we need to do when building C++ code
need_cxx="no"
dnl AS_IF([test "x$use_skia" = "xyes"], [need_cxx="yes"])
AS_IF([test "x$use_qt" = "xyes"], [need_cxx="yes"])
AS_IF([test "x$use_beos" = "xyes"], [need_cxx="yes"])

View file

@ -375,13 +375,6 @@ cairo_win32_font_sources = \
win32/cairo-win32-font.c \
$(NULL)
cairo_skia_headers = cairo-skia.h
cairo_skia_private = skia/cairo-skia-private.h
cairo_skia_cxx_sources = \
skia/cairo-skia-context.cpp \
skia/cairo-skia-surface.cpp \
$(NULL)
cairo_os2_headers = cairo-os2.h
cairo_os2_private = cairo-os2-private.h
cairo_os2_sources = cairo-os2-surface.c

View file

@ -4694,7 +4694,7 @@ _cairo_debug_print_surface_pattern (FILE *file,
case CAIRO_SURFACE_TYPE_DRM: s = "drm"; break;
case CAIRO_SURFACE_TYPE_TEE: s = "tee"; break;
case CAIRO_SURFACE_TYPE_XML: s = "xml"; break;
case CAIRO_SURFACE_TYPE_SKIA: s = "skia"; break;
case CAIRO_SURFACE_TYPE_SKIA: s = "skia"; break; /* Deprecated */
case CAIRO_SURFACE_TYPE_SUBSURFACE: s = "subsurface"; break;
case CAIRO_SURFACE_TYPE_COGL: s = "cogl"; break;
default: s = "invalid"; ASSERT_NOT_REACHED; break;

File diff suppressed because it is too large Load diff

View file

@ -1,66 +0,0 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, 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 University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@cworth.org>
*/
#ifndef CAIRO_SKIA_H
#define CAIRO_SKIA_H
#include "cairo.h"
#if CAIRO_HAS_SKIA_SURFACE
CAIRO_BEGIN_DECLS
cairo_public cairo_surface_t *
cairo_skia_surface_create (cairo_format_t format,
int width,
int height);
cairo_public cairo_surface_t *
cairo_skia_surface_create_for_data (unsigned char *data,
cairo_format_t format,
int width,
int height,
int stride);
CAIRO_END_DECLS
#else
# error Cairo was not compiled with support for the Skia backend
#endif
#endif

View file

@ -2366,7 +2366,6 @@ cairo_surface_status (cairo_surface_t *surface);
* @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10
* @CAIRO_SURFACE_TYPE_TEE: The surface is of type 'tee' (a multiplexing surface), since 1.10
* @CAIRO_SURFACE_TYPE_XML: The surface is of type XML (for debugging), since 1.10
* @CAIRO_SURFACE_TYPE_SKIA: The surface is of type Skia, since 1.10
* @CAIRO_SURFACE_TYPE_SUBSURFACE: The surface is a subsurface created with
* cairo_surface_create_for_rectangle(), since 1.10
* @CAIRO_SURFACE_TYPE_COGL: This surface is of type Cogl, since 1.12

File diff suppressed because it is too large Load diff

View file

@ -1,127 +0,0 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2005 Red Hat, Inc.
*
* 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 Red Hat, Inc.
*
* Contributor(s):
* Carl D. Worth <cworth@redhat.com>
*/
#ifndef CAIRO_SKIA_CONTEXT_PRIVATE_H
#define CAIRO_SKIA_CONTEXT_PRIVATE_H
#include "cairo-private.h"
#include "cairo-image-surface-private.h"
#include <SkBitmap.h>
#include <SkCanvas.h>
#include <SkPaint.h>
#include <SkPath.h>
/**
* cairo_skia_context_t:
*
* A #cairo_skia_context_t includes handles to Skia's canvas,
* paint, and path objects along with the Cairo source surfaces
* and matrix, and the original and target #cairo_skia_surface_t
* objects.
*
* Since: 1.10
**/
typedef struct _cairo_skia_context cairo_skia_context_t;
/**
* cairo_skia_surface_t:
*
* A #cairo_skia_surface_t is a container for the underlying
* #SkBitmap and the corresponding Cairo image surface.
*
* Since: 1.10
**/
typedef struct _cairo_skia_surface cairo_skia_surface_t;
struct _cairo_skia_context {
cairo_t base;
cairo_skia_surface_t *original;
cairo_skia_surface_t *target;
cairo_matrix_t matrix;
SkCanvas *canvas;
SkPaint *paint;
SkPath *path;
cairo_surface_t *source;
cairo_image_surface_t *source_image;
void *source_extra;
};
struct _cairo_skia_surface {
cairo_image_surface_t image;
SkBitmap *bitmap;
};
static inline bool
format_to_sk_config (cairo_format_t format,
SkBitmap::Config& config,
bool& opaque)
{
opaque = false;
switch (format) {
case CAIRO_FORMAT_ARGB32:
config = SkBitmap::kARGB_8888_Config;
break;
case CAIRO_FORMAT_RGB24:
config = SkBitmap::kARGB_8888_Config;
opaque = true;
break;
case CAIRO_FORMAT_RGB16_565:
config = SkBitmap::kRGB_565_Config;
opaque = true;
break;
case CAIRO_FORMAT_A8:
config = SkBitmap::kA8_Config;
break;
case CAIRO_FORMAT_RGB30:
case CAIRO_FORMAT_INVALID:
case CAIRO_FORMAT_A1:
default:
return false;
}
return true;
}
cairo_private cairo_t *
_cairo_skia_context_create (void *target);
#endif /* CAIRO_SKIA_CONTEXT_PRIVATE_H */

View file

@ -1,323 +0,0 @@
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2007 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>
*/
#include "cairoint.h"
#include "cairo-skia.h"
#include "cairo-skia-private.h"
#include "cairo-composite-rectangles-private.h"
#include "cairo-error-private.h"
#include "cairo-surface-backend-private.h"
#include "cairo-surface-fallback-private.h"
static cairo_skia_surface_t *
_cairo_skia_surface_create_internal (SkBitmap::Config config,
bool opaque,
unsigned char *data,
int width,
int height,
int stride);
static cairo_surface_t *
_cairo_skia_surface_create_similar (void *asurface,
cairo_content_t content,
int width,
int height)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
SkBitmap::Config config;
bool opaque;
if (content == surface->image.base.content)
{
config = surface->bitmap->config ();
opaque = surface->bitmap->isOpaque ();
}
else if (! format_to_sk_config (_cairo_format_from_content (content),
config, opaque))
{
return NULL;
}
return &_cairo_skia_surface_create_internal (config, opaque,
NULL,
width, height,
0)->image.base;
}
static cairo_status_t
_cairo_skia_surface_finish (void *asurface)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
cairo_surface_finish (&surface->image.base);
delete surface->bitmap;
return CAIRO_STATUS_SUCCESS;
}
static cairo_image_surface_t *
_cairo_skia_surface_map_to_image (void *asurface,
const cairo_rectangle_int_t *extents)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
surface->bitmap->lockPixels ();
return _cairo_image_surface_map_to_image (&surface->image, extents);
}
static cairo_int_status_t
_cairo_skia_surface_unmap_image (void *asurface,
cairo_image_surface_t *image)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
cairo_int_status_t status;
status = _cairo_image_surface_unmap_image (&surface->image, image);
surface->bitmap->unlockPixels ();
return status;
}
static cairo_status_t
_cairo_skia_surface_acquire_source_image (void *asurface,
cairo_image_surface_t **image_out,
void **image_extra)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
surface->bitmap->lockPixels ();
*image_out = &surface->image;
*image_extra = NULL;
return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_skia_surface_release_source_image (void *asurface,
cairo_image_surface_t *image,
void *image_extra)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
surface->bitmap->unlockPixels ();
}
static cairo_bool_t
_cairo_skia_surface_get_extents (void *asurface,
cairo_rectangle_int_t *extents)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface;
extents->x = extents->y = 0;
extents->width = surface->image.width;
extents->height = surface->image.height;
return TRUE;
}
static void
_cairo_skia_surface_get_font_options (void *abstract_surface,
cairo_font_options_t *options)
{
_cairo_font_options_init_default (options);
cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_ON);
_cairo_font_options_set_round_glyph_positions (options, CAIRO_ROUND_GLYPH_POS_ON);
}
static const struct _cairo_surface_backend
cairo_skia_surface_backend = {
CAIRO_SURFACE_TYPE_SKIA,
_cairo_skia_surface_finish,
_cairo_skia_context_create,
_cairo_skia_surface_create_similar,
NULL, //_cairo_skia_surface_create_similar_image,
_cairo_skia_surface_map_to_image,
_cairo_skia_surface_unmap_image,
_cairo_surface_default_source,
_cairo_skia_surface_acquire_source_image,
_cairo_skia_surface_release_source_image,
NULL, /* snapshot */
NULL, /* copy_page */
NULL, /* show_page */
_cairo_skia_surface_get_extents,
_cairo_skia_surface_get_font_options,
NULL, /* flush */
NULL, /* mark_dirty_rectangle */
/* XXX native surface functions? */
_cairo_surface_fallback_paint,
_cairo_surface_fallback_mask,
_cairo_surface_fallback_stroke,
_cairo_surface_fallback_fill,
NULL, /* fill/stroke */
_cairo_surface_fallback_glyphs
};
/*
* Surface constructors
*/
static inline pixman_format_code_t
sk_config_to_pixman_format_code (SkBitmap::Config config,
bool opaque)
{
switch (config) {
case SkBitmap::kARGB_8888_Config:
return opaque ? PIXMAN_x8r8g8b8 : PIXMAN_a8r8g8b8;
case SkBitmap::kA8_Config:
return PIXMAN_a8;
case SkBitmap::kRGB_565_Config:
return PIXMAN_r5g6b5;
case SkBitmap::kARGB_4444_Config:
return PIXMAN_a4r4g4b4;
case SkBitmap::kNo_Config:
case SkBitmap::kIndex8_Config:
default:
ASSERT_NOT_REACHED;
return (pixman_format_code_t) -1;
}
}
static cairo_skia_surface_t *
_cairo_skia_surface_create_internal (SkBitmap::Config config,
bool opaque,
unsigned char *data,
int width,
int height,
int stride)
{
cairo_skia_surface_t *surface;
pixman_image_t *pixman_image;
pixman_format_code_t pixman_format;
SkColorType colorType;
surface = (cairo_skia_surface_t *) _cairo_malloc (sizeof (cairo_skia_surface_t));
if (unlikely (surface == NULL))
return (cairo_skia_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
pixman_format = sk_config_to_pixman_format_code (config, opaque);
pixman_image = pixman_image_create_bits (pixman_format,
width, height,
(uint32_t *) data, stride);
if (unlikely (pixman_image == NULL)) {
free (surface);
return (cairo_skia_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}
_cairo_surface_init (&surface->image.base,
&cairo_skia_surface_backend,
NULL, /* device */
_cairo_content_from_pixman_format (pixman_format));
_cairo_image_surface_init (&surface->image, pixman_image, pixman_format);
surface->bitmap = new SkBitmap;
colorType = SkBitmapConfigToColorType(config);
surface->bitmap->setAlphaType (opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
surface->bitmap->setInfo (SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType), surface->image.stride);
surface->bitmap->setPixels (surface->image.data);
surface->image.base.is_clear = data == NULL;
return surface;
}
cairo_surface_t *
cairo_skia_surface_create (cairo_format_t format,
int width,
int height)
{
SkBitmap::Config config;
bool opaque;
if (! CAIRO_FORMAT_VALID (format) ||
! format_to_sk_config (format, config, opaque))
{
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
}
return &_cairo_skia_surface_create_internal (config, opaque, NULL, width, height, 0)->image.base;
}
cairo_surface_t *
cairo_skia_surface_create_for_data (unsigned char *data,
cairo_format_t format,
int width,
int height,
int stride)
{
SkBitmap::Config config;
bool opaque;
if (! CAIRO_FORMAT_VALID (format) ||
! format_to_sk_config (format, config, opaque))
{
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
}
return &_cairo_skia_surface_create_internal (config, opaque, data, width, height, stride)->image.base;
}
/***
Todo:
*** Skia:
- mask()
*** Sk:
High:
- antialiased clipping?
Medium:
- implement clip path reset (to avoid restore/save)
- implement complex radial patterns (2 centers and 2 radii)
Low:
- implement EXTEND_NONE
***/