1 /* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */
3 * Copyright © 2011 Red Hat, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
29 #include "pixman-private.h"
30 #include "pixman-combine32.h"
31 #include "pixman-inlines.h"
34 noop_composite (pixman_implementation_t *imp,
35 pixman_composite_info_t *info)
41 noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask)
43 uint32_t *result = iter->buffer;
45 iter->buffer += iter->image->bits.rowstride;
51 noop_init_solid_narrow (pixman_iter_t *iter,
52 const pixman_iter_info_t *info)
54 pixman_image_t *image = iter->image;
55 uint32_t *buffer = iter->buffer;
56 uint32_t *end = buffer + iter->width;
59 if (iter->image->type == SOLID)
60 color = image->solid.color_32;
62 color = image->bits.fetch_pixel_32 (&image->bits, 0, 0);
69 noop_init_solid_wide (pixman_iter_t *iter,
70 const pixman_iter_info_t *info)
72 pixman_image_t *image = iter->image;
73 argb_t *buffer = (argb_t *)iter->buffer;
74 argb_t *end = buffer + iter->width;
77 if (iter->image->type == SOLID)
78 color = image->solid.color_float;
80 color = image->bits.fetch_pixel_float (&image->bits, 0, 0);
87 noop_init_direct_buffer (pixman_iter_t *iter, const pixman_iter_info_t *info)
89 pixman_image_t *image = iter->image;
92 image->bits.bits + iter->y * image->bits.rowstride + iter->x;
96 dest_write_back_direct (pixman_iter_t *iter)
98 iter->buffer += iter->image->bits.rowstride;
101 static const pixman_iter_info_t noop_iters[] =
105 0, ITER_IGNORE_ALPHA | ITER_IGNORE_RGB | ITER_SRC,
107 _pixman_iter_get_scanline_noop,
111 FAST_PATH_NO_ALPHA_MAP, ITER_NARROW | ITER_SRC,
112 noop_init_solid_narrow,
113 _pixman_iter_get_scanline_noop,
117 FAST_PATH_NO_ALPHA_MAP, ITER_WIDE | ITER_SRC,
118 noop_init_solid_wide,
119 _pixman_iter_get_scanline_noop,
123 FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM |
124 FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST,
125 ITER_NARROW | ITER_SRC,
126 noop_init_direct_buffer,
132 FAST_PATH_STD_DEST_FLAGS, ITER_NARROW | ITER_DEST,
133 noop_init_direct_buffer,
134 _pixman_iter_get_scanline_noop,
135 dest_write_back_direct
138 FAST_PATH_STD_DEST_FLAGS, ITER_NARROW | ITER_DEST | ITER_LOCALIZED_ALPHA,
139 noop_init_direct_buffer,
140 _pixman_iter_get_scanline_noop,
141 dest_write_back_direct
146 static const pixman_fast_path_t noop_fast_paths[] =
148 { PIXMAN_OP_DST, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, noop_composite },
152 pixman_implementation_t *
153 _pixman_implementation_create_noop (pixman_implementation_t *fallback)
155 pixman_implementation_t *imp =
156 _pixman_implementation_create (fallback, noop_fast_paths);
158 imp->iter_info = noop_iters;