input: Rename wl_pointer to weston_pointer
[platform/upstream/weston.git] / src / noop-renderer.c
1 /*
2  * Copyright © 2012 Intel Corporation
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation for any purpose is hereby granted without fee, provided
6  * that the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of the copyright holders not be used in
9  * advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission.  The copyright holders make
11  * no representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  */
22
23 #define _GNU_SOURCE
24
25 #include <stdlib.h>
26
27 #include "compositor.h"
28
29 static int
30 noop_renderer_read_pixels(struct weston_output *output,
31                                pixman_format_code_t format, void *pixels,
32                                uint32_t x, uint32_t y,
33                                uint32_t width, uint32_t height)
34 {
35         return 0;
36 }
37
38 static void
39 noop_renderer_repaint_output(struct weston_output *output,
40                              pixman_region32_t *output_damage)
41 {
42 }
43
44 static void
45 noop_renderer_flush_damage(struct weston_surface *surface)
46 {
47 }
48
49 static void
50 noop_renderer_attach(struct weston_surface *es, struct wl_buffer *buffer)
51 {
52 }
53
54 static int
55 noop_renderer_create_surface(struct weston_surface *surface)
56 {
57         return 0;
58 }
59
60 static void
61 noop_renderer_surface_set_color(struct weston_surface *surface,
62                  float red, float green, float blue, float alpha)
63 {
64 }
65
66 static void
67 noop_renderer_destroy_surface(struct weston_surface *surface)
68 {
69 }
70
71 static void
72 noop_renderer_destroy(struct weston_compositor *ec)
73 {
74         free(ec->renderer);
75         ec->renderer = NULL;
76 }
77
78 WL_EXPORT int
79 noop_renderer_init(struct weston_compositor *ec)
80 {
81         struct weston_renderer *renderer;
82
83         renderer = malloc(sizeof *renderer);
84         if (renderer == NULL)
85                 return -1;
86
87         renderer->read_pixels = noop_renderer_read_pixels;
88         renderer->repaint_output = noop_renderer_repaint_output;
89         renderer->flush_damage = noop_renderer_flush_damage;
90         renderer->attach = noop_renderer_attach;
91         renderer->create_surface = noop_renderer_create_surface;
92         renderer->surface_set_color = noop_renderer_surface_set_color;
93         renderer->destroy_surface = noop_renderer_destroy_surface;
94         renderer->destroy = noop_renderer_destroy;
95         ec->renderer = renderer;
96
97         return 0;
98 }