mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 00:48:02 +02:00
Add some comments describing what a cairo_meta_surface_t is.
Remove unused _test_fallback_surface_create_for_data. Remove unused _test_meta_surface_create_for_data. Add missing source file src/test-meta-surface.h.
This commit is contained in:
parent
7cc38be7d1
commit
e95376c1c3
6 changed files with 83 additions and 73 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
2005-12-20 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo-meta-surface.c: Add some comments describing what a
|
||||
cairo_meta_surface_t is.
|
||||
|
||||
* src/test-fallback-surface.c:
|
||||
* src/test-fallback-surface.h: Remove unused
|
||||
_test_fallback_surface_create_for_data.
|
||||
|
||||
* src/test-meta-surface.c:
|
||||
* src/test-meta-surface.h: Remove unused
|
||||
_test_meta_surface_create_for_data. Add missing source file
|
||||
src/test-meta-surface.h.
|
||||
|
||||
2005-12-20 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairoint.h:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,25 @@
|
|||
* Carl Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
/* A meta surface is a surface that records all drawing operations at
|
||||
* the highest level of the surface backend interface, (that is, the
|
||||
* level of paint, mask, stroke, fill, and show_glyphs). The meta
|
||||
* surface can then be "replayed" against any target surface with:
|
||||
*
|
||||
* _cairo_meta_surface_replay (meta, target);
|
||||
*
|
||||
* after which the results in target will be identical to the results
|
||||
* that would have been obtained if the original operations applied to
|
||||
* the meta surface had instead been applied to the target surface.
|
||||
*
|
||||
* The recording phase of the meta surface is careful to snapshot all
|
||||
* necessary objects (paths, patterns, etc.), in order to acheive
|
||||
* accurate replay. The efficiency of the meta surface could be
|
||||
* improved by improving the implementation of snapshot for the
|
||||
* various objects. For example, it would be nice to have a
|
||||
* copy-on-write implementation for _cairo_surface_snapshot.
|
||||
*/
|
||||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-meta-surface-private.h"
|
||||
#include "cairo-clip-private.h"
|
||||
|
|
|
|||
|
|
@ -89,34 +89,6 @@ _test_fallback_surface_create (cairo_format_t format,
|
|||
return &surface->base;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
_test_fallback_surface_create_for_data (unsigned char *data,
|
||||
cairo_format_t format,
|
||||
int width,
|
||||
int height,
|
||||
int stride)
|
||||
{
|
||||
test_fallback_surface_t *surface;
|
||||
cairo_surface_t *backing;
|
||||
|
||||
backing = cairo_image_surface_create_for_data (data, format,
|
||||
width, height, stride);
|
||||
if (cairo_surface_status (backing))
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
|
||||
surface = malloc (sizeof (test_fallback_surface_t));
|
||||
if (surface == NULL) {
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
}
|
||||
|
||||
_cairo_surface_init (&surface->base, &test_fallback_surface_backend);
|
||||
|
||||
surface->backing = backing;
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_test_fallback_surface_create_similar (void *abstract_surface,
|
||||
cairo_content_t content,
|
||||
|
|
|
|||
|
|
@ -45,13 +45,6 @@ _test_fallback_surface_create (cairo_format_t format,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
cairo_surface_t *
|
||||
_test_fallback_surface_create_for_data (unsigned char *data,
|
||||
cairo_format_t format,
|
||||
int width,
|
||||
int height,
|
||||
int stride);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#endif /* TEST_FALLBACK_SURFACE_H */
|
||||
|
|
|
|||
|
|
@ -101,44 +101,6 @@ _test_meta_surface_create (cairo_format_t format,
|
|||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
_test_meta_surface_create_for_data (unsigned char *data,
|
||||
cairo_format_t format,
|
||||
int width,
|
||||
int height,
|
||||
int stride)
|
||||
{
|
||||
test_meta_surface_t *surface;
|
||||
cairo_surface_t *meta, *image;
|
||||
|
||||
meta = _cairo_meta_surface_create (width, height);
|
||||
if (cairo_surface_status (meta))
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
|
||||
image = cairo_image_surface_create_for_data (data, format,
|
||||
width, height, stride);
|
||||
if (cairo_surface_status (image)) {
|
||||
cairo_surface_destroy (meta);
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
}
|
||||
|
||||
surface = malloc (sizeof (test_meta_surface_t));
|
||||
if (surface == NULL) {
|
||||
cairo_surface_destroy (meta);
|
||||
cairo_surface_destroy (image);
|
||||
_cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
}
|
||||
|
||||
_cairo_surface_init (&surface->base, &test_meta_surface_backend);
|
||||
|
||||
surface->meta = meta;
|
||||
surface->image = image;
|
||||
surface->image_reflects_meta = FALSE;
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
_test_meta_surface_create_similar (void *abstract_surface,
|
||||
cairo_content_t content,
|
||||
|
|
|
|||
50
src/test-meta-surface.h
Normal file
50
src/test-meta-surface.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* 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 Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#ifndef TEST_META_SURFACE_H
|
||||
#define TEST_META_SURFACE_H
|
||||
|
||||
#include "cairo.h"
|
||||
|
||||
CAIRO_BEGIN_DECLS
|
||||
|
||||
cairo_surface_t *
|
||||
_test_meta_surface_create (cairo_format_t format,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#endif /* TEST_META_SURFACE_H */
|
||||
Loading…
Add table
Reference in a new issue