[cogl/wip/example-crate: 3/20] framebuffer: expose viewport getters/setters
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/example-crate: 3/20] framebuffer: expose viewport getters/setters
- Date: Wed, 29 Jun 2011 15:12:22 +0000 (UTC)
commit caa0fa2ffd9e10c3df09595657bd9d9b47b4295b
Author: Robert Bragg <robert linux intel com>
Date: Wed Jun 15 00:06:29 2011 +0100
framebuffer: expose viewport getters/setters
This exposes experimental cogl_framebuffer APIs for getting and setting
a viewport without having to refer to the implicit CoglContext. It adds
the following experimental API:
cogl_framebuffer_set_viewport
cogl_framebuffer_get_viewport4fv
cogl_framebuffer_get_viewport_x
cogl_framebuffer_get_viewport_y
cogl_framebuffer_get_viewport_width
cogl_framebuffer_get_viewport_height
cogl/cogl-framebuffer-private.h | 22 ----------------------
cogl/cogl-framebuffer.c | 22 +++++++++++-----------
cogl/cogl-framebuffer.h | 29 +++++++++++++++++++++++++++++
cogl/cogl-journal.c | 3 +--
cogl/cogl-texture.c | 2 +-
cogl/cogl.c | 12 ++++++------
6 files changed, 48 insertions(+), 42 deletions(-)
---
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index 42d7bab..509dc19 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -194,28 +194,6 @@ void
_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer,
CoglClipStack *stack);
-void
-_cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
- float x,
- float y,
- float width,
- float height);
-float
-_cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer);
-
-float
-_cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer);
-
-float
-_cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer);
-
-float
-_cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer);
-
-void
-_cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer,
- float *viewport);
-
CoglMatrixStack *
_cogl_framebuffer_get_modelview_stack (CoglFramebuffer *framebuffer);
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 564a0c9..8257201 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -507,11 +507,11 @@ _cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer,
}
void
-_cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
- float x,
- float y,
- float width,
- float height)
+cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
+ float x,
+ float y,
+ float width,
+ float height)
{
g_return_if_fail (width > 0 && height > 0);
@@ -533,32 +533,32 @@ _cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
}
float
-_cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer)
+cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer)
{
return framebuffer->viewport_x;
}
float
-_cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer)
+cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer)
{
return framebuffer->viewport_y;
}
float
-_cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer)
+cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer)
{
return framebuffer->viewport_width;
}
float
-_cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer)
+cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer)
{
return framebuffer->viewport_height;
}
void
-_cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer,
- float *viewport)
+cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer,
+ float *viewport)
{
viewport[0] = framebuffer->viewport_x;
viewport[1] = framebuffer->viewport_y;
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index ae2419a..8b56d98 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -58,6 +58,35 @@ cogl_framebuffer_get_width (CoglFramebuffer *framebuffer);
int
cogl_framebuffer_get_height (CoglFramebuffer *framebuffer);
+#define cogl_framebuffer_set_viewport cogl_framebuffer_set_viewport_EXP
+void
+cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
+ float x,
+ float y,
+ float width,
+ float height);
+
+#define cogl_framebuffer_get_viewport_x cogl_framebuffer_get_viewport_x_EXP
+float
+cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer);
+
+#define cogl_framebuffer_get_viewport_y cogl_framebuffer_get_viewport_y_EXP
+float
+cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer);
+
+#define cogl_framebuffer_get_viewport_width cogl_framebuffer_get_viewport_width_EXP
+float
+cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer);
+
+#define cogl_framebuffer_get_viewport_height cogl_framebuffer_get_viewport_height_EXP
+float
+cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer);
+
+#define cogl_framebuffer_get_viewport4fv cogl_framebuffer_get_viewport4fv_EXP
+void
+cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer,
+ float *viewport);
+
#define cogl_framebuffer_swap_buffers cogl_framebuffer_swap_buffers_EXP
void
cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer);
diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
index cb378bb..755584b 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -1647,8 +1647,7 @@ entry_to_screen_polygon (const CoglJournalEntry *entry,
poly, /* points_out */
4 /* n_points */);
- _cogl_framebuffer_get_viewport4fv (cogl_get_draw_framebuffer (),
- viewport);
+ cogl_framebuffer_get_viewport4fv (cogl_get_draw_framebuffer (), viewport);
/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1)
* to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index d7b2070..f1ff63d 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -1066,7 +1066,7 @@ _cogl_texture_draw_and_read (CoglHandle handle,
framebuffer = cogl_get_draw_framebuffer ();
/* Viewport needs to have some size and be inside the window for this */
- _cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
+ cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
if (viewport[0] < 0 || viewport[1] < 0 ||
viewport[2] <= 0 || viewport[3] <= 0)
return FALSE;
diff --git a/cogl/cogl.c b/cogl/cogl.c
index 38cef49..9df40f5 100644
--- a/cogl/cogl.c
+++ b/cogl/cogl.c
@@ -349,11 +349,11 @@ cogl_set_viewport (int x,
framebuffer = cogl_get_draw_framebuffer ();
- _cogl_framebuffer_set_viewport (framebuffer,
- x,
- y,
- width,
- height);
+ cogl_framebuffer_set_viewport (framebuffer,
+ x,
+ y,
+ width,
+ height);
}
/* XXX: This should be deprecated, and we should expose a way to also
@@ -393,7 +393,7 @@ cogl_get_viewport (float viewport[4])
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
framebuffer = cogl_get_draw_framebuffer ();
- _cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
+ cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]