~gnome3-team/mutter/trunk

« back to all changes in this revision

Viewing changes to cogl/cogl/deprecated/cogl-clip-state.c

  • Committer: Rui Matos
  • Date: 2016-04-27 16:36:25 UTC
  • mfrom: (0.87.3184)
  • Revision ID: git-v1:3fcbe1d3ec5c9208dde080f7e9dac24e4c379bc0
Merge cogl's cogl-1.22 branch into mutter

https://bugzilla.gnome.org/show_bug.cgi?id=760439

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Cogl
 
3
 *
 
4
 * A Low Level GPU Graphics and Utilities API
 
5
 *
 
6
 * Copyright (C) 2007,2008,2009,2010 Intel Corporation.
 
7
 *
 
8
 * Permission is hereby granted, free of charge, to any person
 
9
 * obtaining a copy of this software and associated documentation
 
10
 * files (the "Software"), to deal in the Software without
 
11
 * restriction, including without limitation the rights to use, copy,
 
12
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 
13
 * of the Software, and to permit persons to whom the Software is
 
14
 * furnished to do so, subject to the following conditions:
 
15
 *
 
16
 * The above copyright notice and this permission notice shall be
 
17
 * included in all copies or substantial portions of the Software.
 
18
 *
 
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
20
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
21
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
22
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 
23
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 
24
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
25
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
26
 * SOFTWARE.
 
27
 *
 
28
 *
 
29
 */
 
30
 
 
31
#ifdef HAVE_CONFIG_H
 
32
#include "config.h"
 
33
#endif
 
34
 
 
35
#include <string.h>
 
36
#include <math.h>
 
37
 
 
38
#include <glib.h>
 
39
 
 
40
#include "cogl-clip-state.h"
 
41
#include "cogl-clip-stack.h"
 
42
#include "cogl-context-private.h"
 
43
#include "cogl-framebuffer-private.h"
 
44
#include "cogl-journal-private.h"
 
45
#include "cogl-util.h"
 
46
#include "cogl-matrix-private.h"
 
47
#include "cogl1-context.h"
 
48
 
 
49
void
 
50
cogl_clip_push_window_rectangle (int x_offset,
 
51
                                 int y_offset,
 
52
                                 int width,
 
53
                                 int height)
 
54
{
 
55
  cogl_framebuffer_push_scissor_clip (cogl_get_draw_framebuffer (),
 
56
                                      x_offset, y_offset, width, height);
 
57
}
 
58
 
 
59
/* XXX: This is deprecated API */
 
60
void
 
61
cogl_clip_push_window_rect (float x_offset,
 
62
                            float y_offset,
 
63
                            float width,
 
64
                            float height)
 
65
{
 
66
  cogl_clip_push_window_rectangle (x_offset, y_offset, width, height);
 
67
}
 
68
 
 
69
void
 
70
cogl_clip_push_rectangle (float x_1,
 
71
                          float y_1,
 
72
                          float x_2,
 
73
                          float y_2)
 
74
{
 
75
  cogl_framebuffer_push_rectangle_clip (cogl_get_draw_framebuffer (),
 
76
                                        x_1, y_1, x_2, y_2);
 
77
}
 
78
 
 
79
/* XXX: Deprecated API */
 
80
void
 
81
cogl_clip_push (float x_offset,
 
82
                float y_offset,
 
83
                float width,
 
84
                float height)
 
85
{
 
86
  cogl_clip_push_rectangle (x_offset,
 
87
                            y_offset,
 
88
                            x_offset + width,
 
89
                            y_offset + height);
 
90
}
 
91
 
 
92
void
 
93
cogl_clip_push_primitive (CoglPrimitive *primitive,
 
94
                          float bounds_x1,
 
95
                          float bounds_y1,
 
96
                          float bounds_x2,
 
97
                          float bounds_y2)
 
98
{
 
99
  cogl_framebuffer_push_primitive_clip (cogl_get_draw_framebuffer (),
 
100
                                        primitive,
 
101
                                        bounds_x1,
 
102
                                        bounds_y1,
 
103
                                        bounds_x2,
 
104
                                        bounds_y2);
 
105
}
 
106
 
 
107
void
 
108
cogl_clip_pop (void)
 
109
{
 
110
  cogl_framebuffer_pop_clip (cogl_get_draw_framebuffer ());
 
111
}
 
112
 
 
113
void
 
114
cogl_clip_stack_save (void)
 
115
{
 
116
  /* This function was just used to temporarily switch the clip stack
 
117
   * when using an offscreen buffer. This is no longer needed because
 
118
   * each framebuffer maintains its own clip stack. The function is
 
119
   * documented to do nothing since version 1.2 */
 
120
}
 
121
 
 
122
void
 
123
cogl_clip_stack_restore (void)
 
124
{
 
125
  /* Do nothing. See cogl_clip_stack_save() */
 
126
}
 
127
 
 
128
/* XXX: This should never have been made public API! */
 
129
void
 
130
cogl_clip_ensure (void)
 
131
{
 
132
  /* Do nothing.
 
133
   *
 
134
   * This API shouldn't be used by anyone and the documented semantics
 
135
   * are basically vague enough that we can get away with doing
 
136
   * nothing here.
 
137
   */
 
138
}