~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to pixman/pixman/pixman-noop.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */
 
2
/*
 
3
 * Copyright © 2011 Red Hat, Inc.
 
4
 *
 
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:
 
11
 *
 
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
 
14
 * Software.
 
15
 *
 
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.
 
23
 */
 
24
#ifdef HAVE_CONFIG_H
 
25
#include <config.h>
 
26
#endif
 
27
#include <string.h>
 
28
#include <stdlib.h>
 
29
#include "pixman-private.h"
 
30
#include "pixman-combine32.h"
 
31
#include "pixman-inlines.h"
 
32
 
 
33
static void
 
34
noop_composite (pixman_implementation_t *imp,
 
35
                pixman_composite_info_t *info)
 
36
{
 
37
    return;
 
38
}
 
39
 
 
40
static uint32_t *
 
41
noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask)
 
42
{
 
43
    uint32_t *result = iter->buffer;
 
44
 
 
45
    iter->buffer += iter->image->bits.rowstride;
 
46
 
 
47
    return result;
 
48
}
 
49
 
 
50
static void
 
51
noop_init_solid_narrow (pixman_iter_t *iter,
 
52
                        const pixman_iter_info_t *info)
 
53
 
54
    pixman_image_t *image = iter->image;
 
55
    uint32_t *buffer = iter->buffer;
 
56
    uint32_t *end = buffer + iter->width;
 
57
    uint32_t color;
 
58
 
 
59
    if (iter->image->type == SOLID)
 
60
        color = image->solid.color_32;
 
61
    else
 
62
        color = image->bits.fetch_pixel_32 (&image->bits, 0, 0);
 
63
 
 
64
    while (buffer < end)
 
65
        *(buffer++) = color;
 
66
}
 
67
 
 
68
static void
 
69
noop_init_solid_wide (pixman_iter_t *iter,
 
70
                      const pixman_iter_info_t *info)
 
71
{
 
72
    pixman_image_t *image = iter->image;
 
73
    argb_t *buffer = (argb_t *)iter->buffer;
 
74
    argb_t *end = buffer + iter->width;
 
75
    argb_t color;
 
76
 
 
77
    if (iter->image->type == SOLID)
 
78
        color = image->solid.color_float;
 
79
    else
 
80
        color = image->bits.fetch_pixel_float (&image->bits, 0, 0);
 
81
 
 
82
    while (buffer < end)
 
83
        *(buffer++) = color;
 
84
}
 
85
 
 
86
static void
 
87
noop_init_direct_buffer (pixman_iter_t *iter, const pixman_iter_info_t *info)
 
88
{
 
89
    pixman_image_t *image = iter->image;
 
90
 
 
91
    iter->buffer =
 
92
        image->bits.bits + iter->y * image->bits.rowstride + iter->x;
 
93
}
 
94
 
 
95
static void
 
96
dest_write_back_direct (pixman_iter_t *iter)
 
97
{
 
98
    iter->buffer += iter->image->bits.rowstride;
 
99
}
 
100
 
 
101
static const pixman_iter_info_t noop_iters[] =
 
102
{
 
103
    /* Source iters */
 
104
    { PIXMAN_any,
 
105
      0, ITER_IGNORE_ALPHA | ITER_IGNORE_RGB | ITER_SRC,
 
106
      NULL,
 
107
      _pixman_iter_get_scanline_noop,
 
108
      NULL
 
109
    },
 
110
    { PIXMAN_solid,
 
111
      FAST_PATH_NO_ALPHA_MAP, ITER_NARROW | ITER_SRC,
 
112
      noop_init_solid_narrow,
 
113
      _pixman_iter_get_scanline_noop,
 
114
      NULL,
 
115
    },
 
116
    { PIXMAN_solid,
 
117
      FAST_PATH_NO_ALPHA_MAP, ITER_WIDE | ITER_SRC,
 
118
      noop_init_solid_wide,
 
119
      _pixman_iter_get_scanline_noop,
 
120
      NULL
 
121
    },
 
122
    { PIXMAN_a8r8g8b8,
 
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,
 
127
      noop_get_scanline,
 
128
      NULL
 
129
    },
 
130
    /* Dest iters */
 
131
    { PIXMAN_a8r8g8b8,
 
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
 
136
    },
 
137
    { PIXMAN_x8r8g8b8,
 
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
 
142
    },
 
143
    { PIXMAN_null },
 
144
};
 
145
 
 
146
static const pixman_fast_path_t noop_fast_paths[] =
 
147
{
 
148
    { PIXMAN_OP_DST, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, noop_composite },
 
149
    { PIXMAN_OP_NONE },
 
150
};
 
151
 
 
152
pixman_implementation_t *
 
153
_pixman_implementation_create_noop (pixman_implementation_t *fallback)
 
154
{
 
155
    pixman_implementation_t *imp =
 
156
        _pixman_implementation_create (fallback, noop_fast_paths);
 
157
 
 
158
    imp->iter_info = noop_iters;
 
159
 
 
160
    return imp;
 
161
}