2006-09-29 14:44:00 -07:00
|
|
|
|
/*
|
|
|
|
|
|
* Copyright <EFBFBD> 2006 Mozilla Corporation
|
|
|
|
|
|
*
|
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software
|
|
|
|
|
|
* and its documentation for any purpose is hereby granted without
|
|
|
|
|
|
* fee, provided that the above copyright notice appear in all copies
|
|
|
|
|
|
* and that both that copyright notice and this permission notice
|
|
|
|
|
|
* appear in supporting documentation, and that the name of
|
|
|
|
|
|
* Mozilla Corporation not be used in advertising or publicity pertaining to
|
|
|
|
|
|
* distribution of the software without specific, written prior
|
|
|
|
|
|
* permission. Mozilla Corporation makes no representations about the
|
|
|
|
|
|
* suitability of this software for any purpose. It is provided "as
|
|
|
|
|
|
* is" without express or implied warranty.
|
|
|
|
|
|
*
|
|
|
|
|
|
* MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
|
* FITNESS, IN NO EVENT SHALL MOZILLA CORPORATION BE LIABLE FOR ANY SPECIAL,
|
|
|
|
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
|
|
|
|
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Author: Vladimir Vukicevic <vladimir@pobox.com>
|
|
|
|
|
|
*/
|
2005-07-15 13:45:19 +00:00
|
|
|
|
#include <math.h>
|
|
|
|
|
|
#include "cairo-test.h"
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define SIZE 100
|
2006-09-29 14:44:00 -07:00
|
|
|
|
#define OFFSET 10
|
2005-07-15 13:45:19 +00:00
|
|
|
|
const char png_filename[] = "romedalen.png";
|
|
|
|
|
|
|
2006-07-13 12:58:24 -04:00
|
|
|
|
static cairo_test_draw_function_t draw;
|
|
|
|
|
|
|
2008-08-11 21:12:45 +01:00
|
|
|
|
static const cairo_test_t test = {
|
2005-07-15 13:45:19 +00:00
|
|
|
|
"composite-integer-translate-over",
|
|
|
|
|
|
"Test simple compositing: integer-translation 32->32 OVER",
|
2006-07-11 22:19:39 -04:00
|
|
|
|
SIZE, SIZE,
|
|
|
|
|
|
draw
|
2005-07-15 13:45:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static cairo_test_status_t
|
|
|
|
|
|
draw (cairo_t *cr, int width, int height)
|
|
|
|
|
|
{
|
2008-08-11 21:12:45 +01:00
|
|
|
|
const cairo_test_context_t *ctx = cairo_test_get_context (cr);
|
2005-07-15 13:45:19 +00:00
|
|
|
|
cairo_surface_t *image;
|
|
|
|
|
|
|
2008-08-11 21:12:45 +01:00
|
|
|
|
image = cairo_test_create_surface_from_png (ctx, png_filename);
|
2005-07-15 13:45:19 +00:00
|
|
|
|
|
|
|
|
|
|
cairo_set_source_rgba (cr, 0, 0, 0, 1);
|
|
|
|
|
|
cairo_rectangle (cr, 0, 0, SIZE, SIZE);
|
|
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
|
|
|
|
|
|
|
cairo_translate (cr, OFFSET, OFFSET);
|
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
|
|
|
|
|
cairo_set_source_surface (cr, image, 0, 0);
|
|
|
|
|
|
cairo_rectangle (cr, 0, 0, (SIZE-OFFSET), (SIZE-OFFSET));
|
|
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
|
|
|
|
|
|
|
cairo_surface_destroy (image);
|
|
|
|
|
|
|
|
|
|
|
|
return CAIRO_TEST_SUCCESS;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
|
main (void)
|
|
|
|
|
|
{
|
2006-07-11 22:19:39 -04:00
|
|
|
|
return cairo_test (&test);
|
2005-07-15 13:45:19 +00:00
|
|
|
|
}
|