From 185630085ca76459b5f5a2613eef6c10b8b0ebf7 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 6 Mar 2012 18:21:28 +0000 Subject: [PATCH] Add -Wmissing-declarations to maintainer flags and fix problems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option to GCC makes it give a warning whenever a global function is defined without a declaration. This should catch cases were we've defined a function but forgot to put it in a header. In that case it is either only used within one file so we should make it static or we should declare it in a header. The following changes where made to fix problems: • Some functions were made static • cogl-path.h (the one containing the 1.0 API) was split into two files, one defining the functions and one defining the enums so that cogl-path.c can include the enum and function declarations from the 2.0 API as well as the function declarations from the 1.0 API. • cogl2-clip-state has been removed. This only had one experimental function called cogl_clip_push_from_path but as this is unstable we might as well remove it favour of the equivalent cogl_framebuffer_* API. • The GLX, SDL and WGL winsys's now have a private header to define their get_vtable function instead of directly declaring in the C file where it is called. • All places that were calling COGL_OBJECT_DEFINE need to have the cogl_is_whatever function declared so these have been added either as a public function or in a private header. • Some files that were not including the header containing their function declarations have been fixed to do so. • Any unused error quark functions have been removed. If we later want them we should add them back one by one and add a declaration for them in a header. • _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and made a public function with a declaration in cogl-framebuffer.h • Similarly for CoglOnscreen. • cogl_vdraw_indexed_attributes is called cogl_framebuffer_vdraw_indexed_attributes in the header. The definition has been changed to match the header. • cogl_index_buffer_allocate has been removed. This had no declaration and I'm not sure what it's supposed to do. • CoglJournal has been changed to use the internal CoglObject macro so that it won't define an exported cogl_is_journal symbol. • The _cogl_blah_pointer_from_handle functions have been removed. CoglHandle isn't used much anymore anyway and in the few places where it is used I think it's safe to just use the implicit cast from void* to the right type. • The test-utils.h header for the conformance tests explicitly disables the -Wmissing-declaration option using a pragma because all of the tests declare their main function without a header. Any mistakes relating to missing declarations aren't really important for the tests. • cogl_quaternion_init_from_quaternion and init_from_matrix have been given declarations in cogl-quaternion.h Reviewed-by: Robert Bragg --- cogl-pango/cogl-pango-render.c | 2 +- cogl/Makefile.am | 7 +- cogl/cogl-atlas-texture-private.h | 3 + cogl/cogl-atlas.h | 3 + cogl/cogl-blend-string.c | 4 + cogl/cogl-clip-stack.c | 2 +- cogl/cogl-clip-state.c | 13 +- cogl/cogl-color.c | 1 + cogl/cogl-config.c | 1 + cogl/cogl-debug.c | 1 + cogl/cogl-display.c | 6 - cogl/cogl-display.h | 14 + cogl/cogl-framebuffer.c | 26 +- cogl/cogl-framebuffer.h | 14 + cogl/cogl-index-buffer.c | 8 - cogl/cogl-indices.h | 14 + cogl/cogl-journal-private.h | 3 + cogl/cogl-journal.c | 2 +- cogl/cogl-matrix-stack.h | 3 + cogl/cogl-meta-texture.c | 2 +- cogl/cogl-object-private.h | 6 - cogl/cogl-onscreen-template.c | 6 - cogl/cogl-onscreen-template.h | 14 + cogl/cogl-onscreen.c | 6 +- cogl/cogl-onscreen.h | 14 + cogl/cogl-path-functions.h | 430 ++++++++++++++++++ cogl/cogl-path.c | 43 +- cogl/cogl-path.h | 390 +--------------- cogl/cogl-pipeline-debug.c | 6 + cogl/cogl-pipeline-fragend-arbfp.c | 2 +- cogl/cogl-pipeline-fragend-glsl.c | 3 +- cogl/cogl-pipeline-layer-state.c | 3 +- cogl/cogl-pipeline-progend-glsl.c | 1 + cogl/cogl-pipeline-state.c | 6 +- cogl/cogl-pipeline.c | 6 - cogl/cogl-point-in-poly.c | 1 + cogl/cogl-primitives.c | 3 +- cogl/cogl-program-private.h | 2 - cogl/cogl-program.c | 6 +- cogl/cogl-quaternion.c | 15 +- cogl/cogl-quaternion.h | 18 + cogl/cogl-renderer.c | 19 +- cogl/cogl-shader-private.h | 2 - cogl/cogl-shader.c | 8 +- cogl/cogl-sub-texture.c | 3 +- cogl/cogl-swap-chain.c | 6 - cogl/cogl-swap-chain.h | 3 + cogl/cogl-texture-2d-sliced.h | 14 + cogl/cogl-texture-3d.c | 6 - cogl/cogl-vertex-buffer-private.h | 6 - cogl/cogl-vertex-buffer.c | 20 +- cogl/cogl.c | 9 - cogl/cogl.h | 1 - cogl/cogl2-clip-state.h | 53 --- cogl/driver/gles/cogl-gles.c | 1 + cogl/winsys/cogl-winsys-egl-kms.c | 1 + .../cogl-winsys-glx-private.h} | 18 +- cogl/winsys/cogl-winsys-glx.c | 1 + cogl/winsys/cogl-winsys-sdl-private.h | 30 ++ cogl/winsys/cogl-winsys-sdl.c | 1 + cogl/winsys/cogl-winsys-stub.c | 1 + cogl/winsys/cogl-winsys-wgl-private.h | 30 ++ cogl/winsys/cogl-winsys-wgl.c | 1 + configure.ac | 2 +- .../cogl-2.0-experimental-sections.txt | 11 - examples/cogland.c | 2 +- tests/conform/test-utils.h | 6 + 67 files changed, 738 insertions(+), 627 deletions(-) create mode 100644 cogl/cogl-path-functions.h delete mode 100644 cogl/cogl2-clip-state.h rename cogl/{cogl2-clip-state.c => winsys/cogl-winsys-glx-private.h} (69%) create mode 100644 cogl/winsys/cogl-winsys-sdl-private.h create mode 100644 cogl/winsys/cogl-winsys-wgl-private.h diff --git a/cogl-pango/cogl-pango-render.c b/cogl-pango/cogl-pango-render.c index 3f87b5278..dccaa15c2 100644 --- a/cogl-pango/cogl-pango-render.c +++ b/cogl-pango/cogl-pango-render.c @@ -94,7 +94,7 @@ typedef struct float x1, y1, x2, y2; } CoglPangoRendererSliceCbData; -void +static void cogl_pango_renderer_slice_cb (CoglTexture *texture, const float *slice_coords, const float *virtual_coords, diff --git a/cogl/Makefile.am b/cogl/Makefile.am index 6ba17608b..68f208927 100644 --- a/cogl/Makefile.am +++ b/cogl/Makefile.am @@ -67,6 +67,7 @@ cogl_1_public_h = \ $(srcdir)/cogl-offscreen.h \ $(srcdir)/cogl-primitives.h \ $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-path-functions.h \ $(srcdir)/cogl-shader.h \ $(srcdir)/cogl-texture.h \ $(srcdir)/cogl-types.h \ @@ -89,7 +90,6 @@ cogl_experimental_h = \ $(srcdir)/cogl-pipeline-layer-state.h \ $(srcdir)/cogl-snippet.h \ $(srcdir)/cogl2-path.h \ - $(srcdir)/cogl2-clip-state.h \ $(srcdir)/cogl-index-buffer.h \ $(srcdir)/cogl-attribute-buffer.h \ $(srcdir)/cogl-indices.h \ @@ -219,8 +219,6 @@ cogl_sources_c = \ $(srcdir)/cogl-clip-state-private.h \ $(srcdir)/cogl-clip-state.h \ $(srcdir)/cogl-clip-state.c \ - $(srcdir)/cogl2-clip-state.h \ - $(srcdir)/cogl2-clip-state.c \ $(srcdir)/cogl-feature-private.h \ $(srcdir)/cogl-feature-private.c \ $(srcdir)/cogl-fixed.c \ @@ -382,6 +380,7 @@ cogl_sources_c += \ $(srcdir)/cogl-glx-renderer-private.h \ $(srcdir)/cogl-glx-display-private.h \ $(srcdir)/winsys/cogl-winsys-glx-feature-functions.h \ + $(srcdir)/winsys/cogl-winsys-glx-private.h \ $(srcdir)/winsys/cogl-winsys-glx.c endif if SUPPORT_WGL @@ -390,6 +389,7 @@ cogl_experimental_h += \ cogl_sources_c += \ $(srcdir)/cogl-win32-renderer.c \ + $(srcdir)/winsys/cogl-winsys-wgl-private.h \ $(srcdir)/winsys/cogl-winsys-wgl.c \ $(srcdir)/winsys/cogl-winsys-wgl-feature-functions.h endif @@ -435,6 +435,7 @@ cogl_sources_c += \ endif if SUPPORT_SDL cogl_sources_c += \ + $(srcdir)/winsys/cogl-winsys-sdl-private.h \ $(srcdir)/winsys/cogl-winsys-sdl.c endif diff --git a/cogl/cogl-atlas-texture-private.h b/cogl/cogl-atlas-texture-private.h index 541cd3db6..4387affe1 100644 --- a/cogl/cogl-atlas-texture-private.h +++ b/cogl/cogl-atlas-texture-private.h @@ -74,4 +74,7 @@ void _cogl_atlas_texture_remove_reorganize_callback (GHookFunc callback, void *user_data); +gboolean +_cogl_is_atlas_texture (void *object); + #endif /* __COGL_ATLAS_TEXTURE_H */ diff --git a/cogl/cogl-atlas.h b/cogl/cogl-atlas.h index 7790cecc7..95c4c11db 100644 --- a/cogl/cogl-atlas.h +++ b/cogl/cogl-atlas.h @@ -94,4 +94,7 @@ _cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas, GHookFunc post_callback, void *user_data); +gboolean +_cogl_is_atlas (void *object); + #endif /* __COGL_ATLAS_H */ diff --git a/cogl/cogl-blend-string.c b/cogl/cogl-blend-string.c index bcdbd15df..50d32f2fd 100644 --- a/cogl/cogl-blend-string.c +++ b/cogl/cogl-blend-string.c @@ -950,6 +950,10 @@ struct _TestString CoglBlendStringContext context; }; +/* FIXME: this should probably be moved to a unit test */ +int +_cogl_blend_string_test (void); + int _cogl_blend_string_test (void) { diff --git a/cogl/cogl-clip-stack.c b/cogl/cogl-clip-stack.c index 358c199c7..ef648931c 100644 --- a/cogl/cogl-clip-stack.c +++ b/cogl/cogl-clip-stack.c @@ -422,7 +422,7 @@ paint_primitive_silhouette (void *user_data) COGL_DRAW_SKIP_LEGACY_STATE); } -void +static void add_stencil_clip_primitive (CoglFramebuffer *framebuffer, CoglPrimitive *primitive, float bounds_x1, diff --git a/cogl/cogl-clip-state.c b/cogl/cogl-clip-state.c index 649fbf31e..ca34d783b 100644 --- a/cogl/cogl-clip-state.c +++ b/cogl/cogl-clip-state.c @@ -38,12 +38,8 @@ #include "cogl-journal-private.h" #include "cogl-util.h" #include "cogl-matrix-private.h" - -#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API -#include -#else -#include -#endif +#include "cogl-clip-state.h" +#include "cogl1-context.h" void cogl_clip_push_window_rectangle (int x_offset, @@ -92,7 +88,8 @@ void cogl_clip_push_from_path_preserve (void) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); - cogl2_clip_push_from_path (ctx->current_path); + cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), + ctx->current_path); } #undef cogl_clip_push_from_path @@ -101,7 +98,7 @@ cogl_clip_push_from_path (void) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); - cogl2_clip_push_from_path (ctx->current_path); + cogl_clip_push_from_path_preserve (); cogl_object_unref (ctx->current_path); ctx->current_path = cogl2_path_new (); diff --git a/cogl/cogl-color.c b/cogl/cogl-color.c index 9a78e53c0..9359f444f 100644 --- a/cogl/cogl-color.c +++ b/cogl/cogl-color.c @@ -30,6 +30,7 @@ #include "cogl-util.h" #include "cogl-color.h" #include "cogl-fixed.h" +#include "cogl-color-private.h" CoglColor * cogl_color_new (void) diff --git a/cogl/cogl-config.c b/cogl/cogl-config.c index 8f0082ec2..4678ce49a 100644 --- a/cogl/cogl-config.c +++ b/cogl/cogl-config.c @@ -29,6 +29,7 @@ #endif #include "cogl-debug.h" +#include "cogl-config-private.h" #include diff --git a/cogl/cogl-debug.c b/cogl/cogl-debug.c index bdbb1ff51..d838caebe 100644 --- a/cogl/cogl-debug.c +++ b/cogl/cogl-debug.c @@ -30,6 +30,7 @@ #include "cogl-private.h" #include "cogl-debug.h" +#include "cogl1-context.h" /* XXX: If you add a debug option, please also add an option * definition to cogl-debug-options.h. This will enable us - for diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c index 651277f42..4818bda6f 100644 --- a/cogl/cogl-display.c +++ b/cogl/cogl-display.c @@ -42,12 +42,6 @@ static void _cogl_display_free (CoglDisplay *display); COGL_OBJECT_DEFINE (Display, display); -GQuark -cogl_display_error_quark (void) -{ - return g_quark_from_static_string ("cogl-display-error-quark"); -} - static const CoglWinsysVtable * _cogl_display_get_winsys (CoglDisplay *display) { diff --git a/cogl/cogl-display.h b/cogl/cogl-display.h index d0b7e4b0f..d4d473592 100644 --- a/cogl/cogl-display.h +++ b/cogl/cogl-display.h @@ -189,6 +189,20 @@ cogl_wayland_display_set_compositor_display (CoglDisplay *display, struct wl_display *wayland_display); #endif +/** + * cogl_is_display: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglDisplay. + * + * Return value: %TRUE if the object references a #CoglDisplay + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +gboolean +cogl_is_display (void *object); + G_END_DECLS #endif /* __COGL_DISPLAY_H__ */ diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index 999eccc3b..f18abf1da 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -142,7 +142,7 @@ cogl_framebuffer_error_quark (void) } gboolean -_cogl_is_framebuffer (void *object) +cogl_is_framebuffer (void *object) { CoglObject *obj = object; @@ -1177,8 +1177,8 @@ _cogl_set_framebuffers (CoglFramebuffer *draw_buffer, CoglFramebuffer *current_draw_buffer; CoglFramebuffer *current_read_buffer; - _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (draw_buffer)); - _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (read_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (draw_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (read_buffer)); current_draw_buffer = cogl_get_draw_framebuffer (); current_read_buffer = _cogl_get_read_framebuffer (); @@ -1244,8 +1244,8 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer, CoglContext *ctx; CoglFramebuffer *old_draw_buffer, *old_read_buffer; - _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (draw_buffer)); - _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (read_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (draw_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_framebuffer (read_buffer)); ctx = draw_buffer->context; _COGL_RETURN_IF_FAIL (ctx != NULL); @@ -1956,7 +1956,7 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int height; _COGL_RETURN_VAL_IF_FAIL (source == COGL_READ_PIXELS_COLOR_BUFFER, FALSE); - _COGL_RETURN_VAL_IF_FAIL (_cogl_is_framebuffer (framebuffer), FALSE); + _COGL_RETURN_VAL_IF_FAIL (cogl_is_framebuffer (framebuffer), FALSE); ctx = cogl_framebuffer_get_context (framebuffer); @@ -3139,13 +3139,13 @@ cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer, } void -cogl_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglVerticesMode mode, - int first_vertex, - int n_vertices, - CoglIndices *indices, - ...) +cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + ...) { va_list ap; int n_attributes; diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h index 0dfdc48ed..b3144266d 100644 --- a/cogl/cogl-framebuffer.h +++ b/cogl/cogl-framebuffer.h @@ -1311,6 +1311,20 @@ typedef enum { /*< prefix=COGL_FRAMEBUFFER_ERROR >*/ COGL_FRAMEBUFFER_ERROR_ALLOCATE } CoglFramebufferError; +/** + * cogl_is_framebuffer: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglFramebuffer. + * + * Return value: %TRUE if the object references a #CoglFramebuffer + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +gboolean +cogl_is_framebuffer (void *object); + G_END_DECLS #endif /* __COGL_FRAMEBUFFER_H */ diff --git a/cogl/cogl-index-buffer.c b/cogl/cogl-index-buffer.c index 7a6b196c6..557d770e3 100644 --- a/cogl/cogl-index-buffer.c +++ b/cogl/cogl-index-buffer.c @@ -73,14 +73,6 @@ _cogl_index_buffer_free (CoglIndexBuffer *indices) g_slice_free (CoglIndexBuffer, indices); } -gboolean -cogl_index_buffer_allocate (CoglIndexBuffer *indices, - GError *error) -{ - /* TODO */ - return TRUE; -} - /* XXX: do we want a convenience function like this as an alternative * to using cogl_buffer_set_data? The advantage of this is that we can * track meta data such as the indices type and max_index_value for a diff --git a/cogl/cogl-indices.h b/cogl/cogl-indices.h index 010edd3f5..23cc91158 100644 --- a/cogl/cogl-indices.h +++ b/cogl/cogl-indices.h @@ -126,6 +126,20 @@ cogl_indices_set_offset (CoglIndices *indices, CoglIndices * cogl_get_rectangle_indices (CoglContext *context, int n_rectangles); +/** + * cogl_is_indices: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglIndices. + * + * Return value: %TRUE if the object references a #CoglIndices + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +gboolean +cogl_is_indices (void *object); + G_END_DECLS #endif /* __COGL_INDICES_H__ */ diff --git a/cogl/cogl-journal-private.h b/cogl/cogl-journal-private.h index bd0f64800..6e9764a4e 100644 --- a/cogl/cogl-journal-private.h +++ b/cogl/cogl-journal-private.h @@ -109,4 +109,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal, CoglBitmap *bitmap, gboolean *found_intersection); +gboolean +_cogl_is_journal (void *object); + #endif /* __COGL_JOURNAL_PRIVATE_H */ diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c index 0be94f599..b8191c0d5 100644 --- a/cogl/cogl-journal.c +++ b/cogl/cogl-journal.c @@ -123,7 +123,7 @@ typedef gboolean (*CoglJournalBatchTest) (CoglJournalEntry *entry0, static void _cogl_journal_free (CoglJournal *journal); -COGL_OBJECT_DEFINE (Journal, journal); +COGL_OBJECT_INTERNAL_DEFINE (Journal, journal); static void _cogl_journal_free (CoglJournal *journal) diff --git a/cogl/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h index 834e5abeb..7a1417ec6 100644 --- a/cogl/cogl-matrix-stack.h +++ b/cogl/cogl-matrix-stack.h @@ -147,4 +147,7 @@ _cogl_matrix_stack_check_and_update_cache (CoglMatrixStack *stack, void _cogl_matrix_stack_destroy_cache (CoglMatrixStackCache *cache); +gboolean +_cogl_is_matrix_stack (void *object); + #endif /* __COGL_MATRIX_STACK_H */ diff --git a/cogl/cogl-meta-texture.c b/cogl/cogl-meta-texture.c index 6aa462678..f77a6c64d 100644 --- a/cogl/cogl-meta-texture.c +++ b/cogl/cogl-meta-texture.c @@ -136,7 +136,7 @@ setup_padded_spans (CoglSpan *spans, * together callbacks corresponding to the same underlying slice * together. */ -void +static void create_grid_and_repeat_cb (CoglTexture *slice_texture, const float *slice_texture_coords, const float *meta_coords, diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h index d7c3412b5..be1e709d8 100644 --- a/cogl/cogl-object-private.h +++ b/cogl/cogl-object-private.h @@ -182,12 +182,6 @@ _cogl_##type_name##_object_new (Cogl##TypeName *new_obj) \ _cogl_object_##type_name##_inc (); \ _COGL_OBJECT_DEBUG_NEW (TypeName, obj); \ return new_obj; \ -} \ - \ -Cogl##TypeName * \ -_cogl_##type_name##_pointer_from_handle (CoglHandle handle) \ -{ \ - return handle; \ } #define COGL_OBJECT_DEFINE_WITH_CODE(TypeName, type_name, code) \ diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c index 4969a6eb3..6aa1d103d 100644 --- a/cogl/cogl-onscreen-template.c +++ b/cogl/cogl-onscreen-template.c @@ -39,12 +39,6 @@ static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_templat COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template); -GQuark -cogl_onscreen_template_error_quark (void) -{ - return g_quark_from_static_string ("cogl-onscreen-template-error-quark"); -} - static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template) { diff --git a/cogl/cogl-onscreen-template.h b/cogl/cogl-onscreen-template.h index 0d1f9a4d7..64d9b74cc 100644 --- a/cogl/cogl-onscreen-template.h +++ b/cogl/cogl-onscreen-template.h @@ -88,6 +88,20 @@ cogl_onscreen_template_set_swap_throttled ( CoglOnscreenTemplate *onscreen_template, gboolean throttled); +/** + * cogl_is_onscreen_template: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglOnscreenTemplate. + * + * Return value: %TRUE if the object references a #CoglOnscreenTemplate + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +gboolean +cogl_is_onscreen_template (void *object); + G_END_DECLS #endif /* __COGL_ONSCREEN_TEMPLATE_H__ */ diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c index 4247de699..9a1d58368 100644 --- a/cogl/cogl-onscreen.c +++ b/cogl/cogl-onscreen.c @@ -35,9 +35,9 @@ static void _cogl_onscreen_free (CoglOnscreen *onscreen); -COGL_OBJECT_INTERNAL_DEFINE_WITH_CODE (Onscreen, onscreen, - _cogl_onscreen_class.virt_unref = - _cogl_framebuffer_unref); +COGL_OBJECT_DEFINE_WITH_CODE (Onscreen, onscreen, + _cogl_onscreen_class.virt_unref = + _cogl_framebuffer_unref); static void _cogl_onscreen_init_from_template (CoglOnscreen *onscreen, diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h index 66206bacb..9d150b251 100644 --- a/cogl/cogl-onscreen.h +++ b/cogl/cogl-onscreen.h @@ -380,6 +380,20 @@ void cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen, unsigned int id); +/** + * cogl_is_onscreen: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglOnscreen. + * + * Return value: %TRUE if the object references a #CoglOnscreen + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +gboolean +cogl_is_onscreen (void *object); + G_END_DECLS #endif /* __COGL_ONSCREEN_H */ diff --git a/cogl/cogl-path-functions.h b/cogl/cogl-path-functions.h new file mode 100644 index 000000000..2566fe18d --- /dev/null +++ b/cogl/cogl-path-functions.h @@ -0,0 +1,430 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2012 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PATH_FUNCTIONS_H__ +#define __COGL_PATH_FUNCTIONS_H__ + +/* The functions are declared separately because cogl-path.c needs to + get the function declarations from the old 1.0 API without + colliding with the enum declarations from the 2.0 API */ + +#include + +G_BEGIN_DECLS + +/** + * cogl_is_path: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing path object. + * + * Return value: %TRUE if the handle references a #CoglPath, + * %FALSE otherwise + */ +gboolean +cogl_is_path (CoglHandle handle); + +/** + * cogl_path_set_fill_rule: + * @fill_rule: The new fill rule. + * + * Sets the fill rule of the current path to @fill_rule. This will + * affect how the path is filled when cogl_path_fill() is later + * called. Note that the fill rule state is attached to the path so + * calling cogl_get_path() will preserve the fill rule and calling + * cogl_path_new() will reset the fill rule back to the default. + * + * Since: 1.4 + */ +void +cogl_path_set_fill_rule (CoglPathFillRule fill_rule); + +/** + * cogl_path_get_fill_rule: + * + * Retrieves the fill rule set using cogl_path_set_fill_rule(). + * + * Return value: the fill rule that is used for the current path. + * + * Since: 1.4 + */ +CoglPathFillRule +cogl_path_get_fill_rule (void); + +/** + * cogl_path_fill: + * + * Fills the interior of the constructed shape using the current + * drawing color. The current path is then cleared. To use the path + * again, call cogl_path_fill_preserve() instead. + * + * The interior of the shape is determined using the fill rule of the + * path. See %CoglPathFillRule for details. + **/ +void +cogl_path_fill (void); + +/** + * cogl_path_fill_preserve: + * + * Fills the interior of the constructed shape using the current + * drawing color and preserves the path to be used again. See + * cogl_path_fill() for a description what is considered the interior + * of the shape. + * + * Since: 1.0 + **/ +void +cogl_path_fill_preserve (void); + +/** + * cogl_path_stroke: + * + * Strokes the constructed shape using the current drawing color and a + * width of 1 pixel (regardless of the current transformation + * matrix). To current path is then cleared. To use the path again, + * call cogl_path_stroke_preserve() instead. + **/ +void +cogl_path_stroke (void); + +/** + * cogl_path_stroke_preserve: + * + * Strokes the constructed shape using the current drawing color and + * preserves the path to be used again. + * + * Since: 1.0 + **/ +void +cogl_path_stroke_preserve (void); + +/** + * cogl_path_new: + * + * Clears the current path and starts a new one. Creating a new path + * also resets the fill rule to the default which is + * %COGL_PATH_FILL_RULE_EVEN_ODD. + * + * Since: 1.0 + */ +void +cogl_path_new (void); + +/** + * cogl_path_move_to: + * @x: X coordinate of the pen location to move to. + * @y: Y coordinate of the pen location to move to. + * + * Moves the pen to the given location. If there is an existing path + * this will start a new disjoint subpath. + **/ +void +cogl_path_move_to (float x, + float y); + + +/** + * cogl_path_rel_move_to: + * @x: X offset from the current pen location to move the pen to. + * @y: Y offset from the current pen location to move the pen to. + * + * Moves the pen to the given offset relative to the current pen + * location. If there is an existing path this will start a new + * disjoint subpath. + **/ +void +cogl_path_rel_move_to (float x, + float y); + +/** + * cogl_path_line_to: + * @x: X coordinate of the end line vertex + * @y: Y coordinate of the end line vertex + * + * Adds a straight line segment to the current path that ends at the + * given coordinates. + **/ +void +cogl_path_line_to (float x, + float y); + +/** + * cogl_path_rel_line_to: + * @x: X offset from the current pen location of the end line vertex + * @y: Y offset from the current pen location of the end line vertex + * + * Adds a straight line segment to the current path that ends at the + * given coordinates relative to the current pen location. + **/ +void +cogl_path_rel_line_to (float x, + float y); + + +/** + * cogl_path_arc: + * @center_x: X coordinate of the elliptical arc center + * @center_y: Y coordinate of the elliptical arc center + * @radius_x: X radius of the elliptical arc + * @radius_y: Y radius of the elliptical arc + * @angle_1: Angle in degrees at which the arc begin + * @angle_2: Angle in degrees at which the arc ends + * + * Adds an elliptical arc segment to the current path. A straight line + * segment will link the current pen location with the first vertex + * of the arc. If you perform a move_to to the arcs start just before + * drawing it you create a free standing arc. + * + * The angles are measured in degrees where 0° is in the direction of + * the positive X axis and 90° is in the direction of the positive Y + * axis. The angle of the arc begins at @angle_1 and heads towards + * @angle_2 (so if @angle_2 is less than @angle_1 it will decrease, + * otherwise it will increase). + **/ +void +cogl_path_arc (float center_x, + float center_y, + float radius_x, + float radius_y, + float angle_1, + float angle_2); + +/** + * cogl_path_curve_to: + * @x_1: X coordinate of the second bezier control point + * @y_1: Y coordinate of the second bezier control point + * @x_2: X coordinate of the third bezier control point + * @y_2: Y coordinate of the third bezier control point + * @x_3: X coordinate of the fourth bezier control point + * @y_3: Y coordinate of the fourth bezier control point + * + * Adds a cubic bezier curve segment to the current path with the given + * second, third and fourth control points and using current pen location + * as the first control point. + **/ +void +cogl_path_curve_to (float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3); + +/** + * cogl_path_rel_curve_to: + * @x_1: X coordinate of the second bezier control point + * @y_1: Y coordinate of the second bezier control point + * @x_2: X coordinate of the third bezier control point + * @y_2: Y coordinate of the third bezier control point + * @x_3: X coordinate of the fourth bezier control point + * @y_3: Y coordinate of the fourth bezier control point + * + * Adds a cubic bezier curve segment to the current path with the given + * second, third and fourth control points and using current pen location + * as the first control point. The given coordinates are relative to the + * current pen location. + */ +void +cogl_path_rel_curve_to (float x_1, + float y_1, + float x_2, + float y_2, + float x_3, + float y_3); + +/** + * cogl_path_close: + * + * Closes the path being constructed by adding a straight line segment + * to it that ends at the first vertex of the path. + **/ +void +cogl_path_close (void); + +/** + * cogl_path_line: + * @x_1: X coordinate of the start line vertex + * @y_1: Y coordinate of the start line vertex + * @x_2: X coordinate of the end line vertex + * @y_2: Y coordinate of the end line vertex + * + * Constructs a straight line shape starting and ending at the given + * coordinates. If there is an existing path this will start a new + * disjoint sub-path. + **/ +void +cogl_path_line (float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_path_polyline: + * @coords: (in) (array) (transfer none): A pointer to the first element of an + * array of fixed-point values that specify the vertex coordinates. + * @num_points: The total number of vertices. + * + * Constructs a series of straight line segments, starting from the + * first given vertex coordinate. If there is an existing path this + * will start a new disjoint sub-path. Each subsequent segment starts + * where the previous one ended and ends at the next given vertex + * coordinate. + * + * The coords array must contain 2 * num_points values. The first value + * represents the X coordinate of the first vertex, the second value + * represents the Y coordinate of the first vertex, continuing in the same + * fashion for the rest of the vertices. (num_points - 1) segments will + * be constructed. + **/ +void +cogl_path_polyline (const float *coords, + int num_points); + + +/** + * cogl_path_polygon: + * @coords: (in) (array) (transfer none): A pointer to the first element of + * an array of fixed-point values that specify the vertex coordinates. + * @num_points: The total number of vertices. + * + * Constructs a polygonal shape of the given number of vertices. If + * there is an existing path this will start a new disjoint sub-path. + * + * The coords array must contain 2 * num_points values. The first value + * represents the X coordinate of the first vertex, the second value + * represents the Y coordinate of the first vertex, continuing in the same + * fashion for the rest of the vertices. + **/ +void +cogl_path_polygon (const float *coords, + int num_points); + + +/** + * cogl_path_rectangle: + * @x_1: X coordinate of the top-left corner. + * @y_1: Y coordinate of the top-left corner. + * @x_2: X coordinate of the bottom-right corner. + * @y_2: Y coordinate of the bottom-right corner. + * + * Constructs a rectangular shape at the given coordinates. If there + * is an existing path this will start a new disjoint sub-path. + **/ +void +cogl_path_rectangle (float x_1, + float y_1, + float x_2, + float y_2); + +/** + * cogl_path_ellipse: + * @center_x: X coordinate of the ellipse center + * @center_y: Y coordinate of the ellipse center + * @radius_x: X radius of the ellipse + * @radius_y: Y radius of the ellipse + * + * Constructs an ellipse shape. If there is an existing path this will + * start a new disjoint sub-path. + **/ +void +cogl_path_ellipse (float center_x, + float center_y, + float radius_x, + float radius_y); + +/** + * cogl_path_round_rectangle: + * @x_1: X coordinate of the top-left corner. + * @y_1: Y coordinate of the top-left corner. + * @x_2: X coordinate of the bottom-right corner. + * @y_2: Y coordinate of the bottom-right corner. + * @radius: Radius of the corner arcs. + * @arc_step: Angle increment resolution for subdivision of + * the corner arcs. + * + * Constructs a rectangular shape with rounded corners. If there is an + * existing path this will start a new disjoint sub-path. + **/ +void +cogl_path_round_rectangle (float x_1, + float y_1, + float x_2, + float y_2, + float radius, + float arc_step); + +/** + * cogl_get_path: (skip) + * + * Gets a pointer to the current path. The path can later be used + * again by calling cogl_path_set(). Note that the path isn't copied + * so if you later call any functions to add to the path it will + * affect the returned object too. No reference is taken on the path + * so if you want to retain it you should take your own reference with + * cogl_object_ref(). + * + * Return value: a pointer to the current path. + * + * Since: 1.4 + */ +CoglPath * +cogl_get_path (void); + +/** + * cogl_set_path: (skip) + * @path: A #CoglPath object + * + * Replaces the current path with @path. A reference is taken on the + * object so if you no longer need the path you should unref with + * cogl_object_unref(). + * + * Since: 1.4 + */ +void +cogl_set_path (CoglPath *path); + +/** + * cogl_path_copy: (skip) + * @path: A #CoglPath object + * + * Returns a new copy of the path in @path. The new path has a + * reference count of 1 so you should unref it with + * cogl_object_unref() if you no longer need it. + * + * Internally the path will share the data until one of the paths is + * modified so copying paths should be relatively cheap. + * + * Return value: (transfer full): a copy of the path in @path. + */ +CoglPath * +cogl_path_copy (CoglPath *path); + +G_END_DECLS + +#endif /* __COGL_PATH_FUNCTIONS_H__ */ + diff --git a/cogl/cogl-path.c b/cogl/cogl-path.c index 62d20f523..0eaed99d8 100644 --- a/cogl/cogl-path.c +++ b/cogl/cogl-path.c @@ -36,6 +36,29 @@ #include #undef cogl_path_set_fill_rule +#undef cogl_path_get_fill_rule +#undef cogl_path_fill +#undef cogl_path_fill_preserve +#undef cogl_path_stroke +#undef cogl_path_stroke_preserve +#undef cogl_path_move_to +#undef cogl_path_rel_move_to +#undef cogl_path_line_to +#undef cogl_path_rel_line_to +#undef cogl_path_close +#undef cogl_path_new +#undef cogl_path_line +#undef cogl_path_polyline +#undef cogl_path_polygon +#undef cogl_path_rectangle +#undef cogl_path_arc +#undef cogl_path_ellipse +#undef cogl_path_round_rectangle +#undef cogl_path_curve_to +#undef cogl_path_rel_curve_to + +#include "cogl-path-functions.h" + void cogl_path_set_fill_rule (CoglPathFillRule fill_rule) { @@ -44,7 +67,6 @@ cogl_path_set_fill_rule (CoglPathFillRule fill_rule) cogl2_path_set_fill_rule (ctx->current_path, fill_rule); } -#undef cogl_path_get_fill_rule CoglPathFillRule cogl_path_get_fill_rule (void) { @@ -53,7 +75,6 @@ cogl_path_get_fill_rule (void) return cogl2_path_get_fill_rule (ctx->current_path); } -#undef cogl_path_fill void cogl_path_fill (void) { @@ -65,7 +86,6 @@ cogl_path_fill (void) ctx->current_path = cogl2_path_new (); } -#undef cogl_path_fill_preserve void cogl_path_fill_preserve (void) { @@ -74,7 +94,6 @@ cogl_path_fill_preserve (void) cogl2_path_fill (ctx->current_path); } -#undef cogl_path_stroke void cogl_path_stroke (void) { @@ -86,7 +105,6 @@ cogl_path_stroke (void) ctx->current_path = cogl2_path_new (); } -#undef cogl_path_stroke_preserve void cogl_path_stroke_preserve (void) { @@ -95,7 +113,6 @@ cogl_path_stroke_preserve (void) cogl2_path_stroke (ctx->current_path); } -#undef cogl_path_move_to void cogl_path_move_to (float x, float y) @@ -105,7 +122,6 @@ cogl_path_move_to (float x, cogl2_path_move_to (ctx->current_path, x, y); } -#undef cogl_path_rel_move_to void cogl_path_rel_move_to (float x, float y) @@ -115,7 +131,6 @@ cogl_path_rel_move_to (float x, cogl2_path_rel_move_to (ctx->current_path, x, y); } -#undef cogl_path_line_to void cogl_path_line_to (float x, float y) @@ -125,7 +140,6 @@ cogl_path_line_to (float x, cogl2_path_line_to (ctx->current_path, x, y); } -#undef cogl_path_rel_line_to void cogl_path_rel_line_to (float x, float y) @@ -135,7 +149,6 @@ cogl_path_rel_line_to (float x, cogl2_path_rel_line_to (ctx->current_path, x, y); } -#undef cogl_path_close void cogl_path_close (void) { @@ -144,7 +157,6 @@ cogl_path_close (void) cogl2_path_close (ctx->current_path); } -#undef cogl_path_new void cogl_path_new (void) { @@ -154,7 +166,6 @@ cogl_path_new (void) ctx->current_path = cogl2_path_new (); } -#undef cogl_path_line void cogl_path_line (float x_1, float y_1, @@ -166,7 +177,6 @@ cogl_path_line (float x_1, cogl2_path_line (ctx->current_path, x_1, y_1, x_2, y_2); } -#undef cogl_path_polyline void cogl_path_polyline (const float *coords, int num_points) @@ -176,7 +186,6 @@ cogl_path_polyline (const float *coords, cogl2_path_polyline (ctx->current_path, coords, num_points); } -#undef cogl_path_polygon void cogl_path_polygon (const float *coords, int num_points) @@ -186,7 +195,6 @@ cogl_path_polygon (const float *coords, cogl2_path_polygon (ctx->current_path, coords, num_points); } -#undef cogl_path_rectangle void cogl_path_rectangle (float x_1, float y_1, @@ -198,7 +206,6 @@ cogl_path_rectangle (float x_1, cogl2_path_rectangle (ctx->current_path, x_1, y_1, x_2, y_2); } -#undef cogl_path_arc void cogl_path_arc (float center_x, float center_y, @@ -218,7 +225,6 @@ cogl_path_arc (float center_x, angle_2); } -#undef cogl_path_ellipse void cogl_path_ellipse (float center_x, float center_y, @@ -234,7 +240,6 @@ cogl_path_ellipse (float center_x, radius_y); } -#undef cogl_path_round_rectangle void cogl_path_round_rectangle (float x_1, float y_1, @@ -249,7 +254,6 @@ cogl_path_round_rectangle (float x_1, x_1, y_1, x_2, y_2, radius, arc_step); } -#undef cogl_path_curve_to void cogl_path_curve_to (float x_1, float y_1, @@ -264,7 +268,6 @@ cogl_path_curve_to (float x_1, x_1, y_2, x_2, y_2, x_3, y_3); } -#undef cogl_path_rel_curve_to void cogl_path_rel_curve_to (float x_1, float y_1, diff --git a/cogl/cogl-path.h b/cogl/cogl-path.h index 30df7ef01..c3d0d4501 100644 --- a/cogl/cogl-path.h +++ b/cogl/cogl-path.h @@ -97,395 +97,9 @@ typedef enum { COGL_PATH_FILL_RULE_EVEN_ODD } CoglPathFillRule; -/** - * cogl_is_path: - * @handle: A CoglHandle - * - * Gets whether the given handle references an existing path object. - * - * Return value: %TRUE if the handle references a #CoglPath, - * %FALSE otherwise - */ -gboolean -cogl_is_path (CoglHandle handle); - -/** - * cogl_path_set_fill_rule: - * @fill_rule: The new fill rule. - * - * Sets the fill rule of the current path to @fill_rule. This will - * affect how the path is filled when cogl_path_fill() is later - * called. Note that the fill rule state is attached to the path so - * calling cogl_get_path() will preserve the fill rule and calling - * cogl_path_new() will reset the fill rule back to the default. - * - * Since: 1.4 - */ -void -cogl_path_set_fill_rule (CoglPathFillRule fill_rule); - -/** - * cogl_path_get_fill_rule: - * - * Retrieves the fill rule set using cogl_path_set_fill_rule(). - * - * Return value: the fill rule that is used for the current path. - * - * Since: 1.4 - */ -CoglPathFillRule -cogl_path_get_fill_rule (void); - -/** - * cogl_path_fill: - * - * Fills the interior of the constructed shape using the current - * drawing color. The current path is then cleared. To use the path - * again, call cogl_path_fill_preserve() instead. - * - * The interior of the shape is determined using the fill rule of the - * path. See %CoglPathFillRule for details. - **/ -void -cogl_path_fill (void); - -/** - * cogl_path_fill_preserve: - * - * Fills the interior of the constructed shape using the current - * drawing color and preserves the path to be used again. See - * cogl_path_fill() for a description what is considered the interior - * of the shape. - * - * Since: 1.0 - **/ -void -cogl_path_fill_preserve (void); - -/** - * cogl_path_stroke: - * - * Strokes the constructed shape using the current drawing color and a - * width of 1 pixel (regardless of the current transformation - * matrix). To current path is then cleared. To use the path again, - * call cogl_path_stroke_preserve() instead. - **/ -void -cogl_path_stroke (void); - -/** - * cogl_path_stroke_preserve: - * - * Strokes the constructed shape using the current drawing color and - * preserves the path to be used again. - * - * Since: 1.0 - **/ -void -cogl_path_stroke_preserve (void); - -/** - * cogl_path_new: - * - * Clears the current path and starts a new one. Creating a new path - * also resets the fill rule to the default which is - * %COGL_PATH_FILL_RULE_EVEN_ODD. - * - * Since: 1.0 - */ -void -cogl_path_new (void); - -/** - * cogl_path_move_to: - * @x: X coordinate of the pen location to move to. - * @y: Y coordinate of the pen location to move to. - * - * Moves the pen to the given location. If there is an existing path - * this will start a new disjoint subpath. - **/ -void -cogl_path_move_to (float x, - float y); - - -/** - * cogl_path_rel_move_to: - * @x: X offset from the current pen location to move the pen to. - * @y: Y offset from the current pen location to move the pen to. - * - * Moves the pen to the given offset relative to the current pen - * location. If there is an existing path this will start a new - * disjoint subpath. - **/ -void -cogl_path_rel_move_to (float x, - float y); - -/** - * cogl_path_line_to: - * @x: X coordinate of the end line vertex - * @y: Y coordinate of the end line vertex - * - * Adds a straight line segment to the current path that ends at the - * given coordinates. - **/ -void -cogl_path_line_to (float x, - float y); - -/** - * cogl_path_rel_line_to: - * @x: X offset from the current pen location of the end line vertex - * @y: Y offset from the current pen location of the end line vertex - * - * Adds a straight line segment to the current path that ends at the - * given coordinates relative to the current pen location. - **/ -void -cogl_path_rel_line_to (float x, - float y); - - -/** - * cogl_path_arc: - * @center_x: X coordinate of the elliptical arc center - * @center_y: Y coordinate of the elliptical arc center - * @radius_x: X radius of the elliptical arc - * @radius_y: Y radius of the elliptical arc - * @angle_1: Angle in degrees at which the arc begin - * @angle_2: Angle in degrees at which the arc ends - * - * Adds an elliptical arc segment to the current path. A straight line - * segment will link the current pen location with the first vertex - * of the arc. If you perform a move_to to the arcs start just before - * drawing it you create a free standing arc. - * - * The angles are measured in degrees where 0° is in the direction of - * the positive X axis and 90° is in the direction of the positive Y - * axis. The angle of the arc begins at @angle_1 and heads towards - * @angle_2 (so if @angle_2 is less than @angle_1 it will decrease, - * otherwise it will increase). - **/ -void -cogl_path_arc (float center_x, - float center_y, - float radius_x, - float radius_y, - float angle_1, - float angle_2); - -/** - * cogl_path_curve_to: - * @x_1: X coordinate of the second bezier control point - * @y_1: Y coordinate of the second bezier control point - * @x_2: X coordinate of the third bezier control point - * @y_2: Y coordinate of the third bezier control point - * @x_3: X coordinate of the fourth bezier control point - * @y_3: Y coordinate of the fourth bezier control point - * - * Adds a cubic bezier curve segment to the current path with the given - * second, third and fourth control points and using current pen location - * as the first control point. - **/ -void -cogl_path_curve_to (float x_1, - float y_1, - float x_2, - float y_2, - float x_3, - float y_3); - -/** - * cogl_path_rel_curve_to: - * @x_1: X coordinate of the second bezier control point - * @y_1: Y coordinate of the second bezier control point - * @x_2: X coordinate of the third bezier control point - * @y_2: Y coordinate of the third bezier control point - * @x_3: X coordinate of the fourth bezier control point - * @y_3: Y coordinate of the fourth bezier control point - * - * Adds a cubic bezier curve segment to the current path with the given - * second, third and fourth control points and using current pen location - * as the first control point. The given coordinates are relative to the - * current pen location. - */ -void -cogl_path_rel_curve_to (float x_1, - float y_1, - float x_2, - float y_2, - float x_3, - float y_3); - -/** - * cogl_path_close: - * - * Closes the path being constructed by adding a straight line segment - * to it that ends at the first vertex of the path. - **/ -void -cogl_path_close (void); - -/** - * cogl_path_line: - * @x_1: X coordinate of the start line vertex - * @y_1: Y coordinate of the start line vertex - * @x_2: X coordinate of the end line vertex - * @y_2: Y coordinate of the end line vertex - * - * Constructs a straight line shape starting and ending at the given - * coordinates. If there is an existing path this will start a new - * disjoint sub-path. - **/ -void -cogl_path_line (float x_1, - float y_1, - float x_2, - float y_2); - -/** - * cogl_path_polyline: - * @coords: (in) (array) (transfer none): A pointer to the first element of an - * array of fixed-point values that specify the vertex coordinates. - * @num_points: The total number of vertices. - * - * Constructs a series of straight line segments, starting from the - * first given vertex coordinate. If there is an existing path this - * will start a new disjoint sub-path. Each subsequent segment starts - * where the previous one ended and ends at the next given vertex - * coordinate. - * - * The coords array must contain 2 * num_points values. The first value - * represents the X coordinate of the first vertex, the second value - * represents the Y coordinate of the first vertex, continuing in the same - * fashion for the rest of the vertices. (num_points - 1) segments will - * be constructed. - **/ -void -cogl_path_polyline (const float *coords, - int num_points); - - -/** - * cogl_path_polygon: - * @coords: (in) (array) (transfer none): A pointer to the first element of - * an array of fixed-point values that specify the vertex coordinates. - * @num_points: The total number of vertices. - * - * Constructs a polygonal shape of the given number of vertices. If - * there is an existing path this will start a new disjoint sub-path. - * - * The coords array must contain 2 * num_points values. The first value - * represents the X coordinate of the first vertex, the second value - * represents the Y coordinate of the first vertex, continuing in the same - * fashion for the rest of the vertices. - **/ -void -cogl_path_polygon (const float *coords, - int num_points); - - -/** - * cogl_path_rectangle: - * @x_1: X coordinate of the top-left corner. - * @y_1: Y coordinate of the top-left corner. - * @x_2: X coordinate of the bottom-right corner. - * @y_2: Y coordinate of the bottom-right corner. - * - * Constructs a rectangular shape at the given coordinates. If there - * is an existing path this will start a new disjoint sub-path. - **/ -void -cogl_path_rectangle (float x_1, - float y_1, - float x_2, - float y_2); - -/** - * cogl_path_ellipse: - * @center_x: X coordinate of the ellipse center - * @center_y: Y coordinate of the ellipse center - * @radius_x: X radius of the ellipse - * @radius_y: Y radius of the ellipse - * - * Constructs an ellipse shape. If there is an existing path this will - * start a new disjoint sub-path. - **/ -void -cogl_path_ellipse (float center_x, - float center_y, - float radius_x, - float radius_y); - -/** - * cogl_path_round_rectangle: - * @x_1: X coordinate of the top-left corner. - * @y_1: Y coordinate of the top-left corner. - * @x_2: X coordinate of the bottom-right corner. - * @y_2: Y coordinate of the bottom-right corner. - * @radius: Radius of the corner arcs. - * @arc_step: Angle increment resolution for subdivision of - * the corner arcs. - * - * Constructs a rectangular shape with rounded corners. If there is an - * existing path this will start a new disjoint sub-path. - **/ -void -cogl_path_round_rectangle (float x_1, - float y_1, - float x_2, - float y_2, - float radius, - float arc_step); - -/** - * cogl_get_path: (skip) - * - * Gets a pointer to the current path. The path can later be used - * again by calling cogl_path_set(). Note that the path isn't copied - * so if you later call any functions to add to the path it will - * affect the returned object too. No reference is taken on the path - * so if you want to retain it you should take your own reference with - * cogl_object_ref(). - * - * Return value: a pointer to the current path. - * - * Since: 1.4 - */ -CoglPath * -cogl_get_path (void); - -/** - * cogl_set_path: (skip) - * @path: A #CoglPath object - * - * Replaces the current path with @path. A reference is taken on the - * object so if you no longer need the path you should unref with - * cogl_object_unref(). - * - * Since: 1.4 - */ -void -cogl_set_path (CoglPath *path); - -/** - * cogl_path_copy: (skip) - * @path: A #CoglPath object - * - * Returns a new copy of the path in @path. The new path has a - * reference count of 1 so you should unref it with - * cogl_object_unref() if you no longer need it. - * - * Internally the path will share the data until one of the paths is - * modified so copying paths should be relatively cheap. - * - * Return value: (transfer full): a copy of the path in @path. - */ -CoglPath * -cogl_path_copy (CoglPath *path); - G_END_DECLS +#include "cogl-path-functions.h" + #endif /* __COGL_PATH_H__ */ diff --git a/cogl/cogl-pipeline-debug.c b/cogl/cogl-pipeline-debug.c index c9ca8e20d..00d03c661 100644 --- a/cogl/cogl-pipeline-debug.c +++ b/cogl/cogl-pipeline-debug.c @@ -244,6 +244,12 @@ dump_pipeline_cb (CoglNode *node, void *user_data) return TRUE; } +/* This function is just here to be called from GDB so we don't really + want to put a declaration in a header and we just add it here to + avoid a warning */ +void +_cogl_debug_dump_pipelines_dot_file (const char *filename); + void _cogl_debug_dump_pipelines_dot_file (const char *filename) { diff --git a/cogl/cogl-pipeline-fragend-arbfp.c b/cogl/cogl-pipeline-fragend-arbfp.c index 5031fc315..2b5806384 100644 --- a/cogl/cogl-pipeline-fragend-arbfp.c +++ b/cogl/cogl-pipeline-fragend-arbfp.c @@ -792,7 +792,7 @@ _cogl_pipeline_fragend_arbfp_add_layer (CoglPipeline *pipeline, return TRUE; } -gboolean +static gboolean _cogl_pipeline_fragend_arbfp_passthrough (CoglPipeline *pipeline) { CoglPipelineShaderState *shader_state = get_shader_state (pipeline); diff --git a/cogl/cogl-pipeline-fragend-glsl.c b/cogl/cogl-pipeline-fragend-glsl.c index 1cc36cb93..1f4472219 100644 --- a/cogl/cogl-pipeline-fragend-glsl.c +++ b/cogl/cogl-pipeline-fragend-glsl.c @@ -47,6 +47,7 @@ #include "cogl-shader-private.h" #include "cogl-program-private.h" #include "cogl-pipeline-cache.h" +#include "cogl-pipeline-fragend-glsl-private.h" #include @@ -998,7 +999,7 @@ add_alpha_test_snippet (CoglPipeline *pipeline, #endif /* HAVE_COGL_GLES2 */ -gboolean +static gboolean _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline, unsigned long pipelines_difference) { diff --git a/cogl/cogl-pipeline-layer-state.c b/cogl/cogl-pipeline-layer-state.c index 4540dc67c..785d1e46b 100644 --- a/cogl/cogl-pipeline-layer-state.c +++ b/cogl/cogl-pipeline-layer-state.c @@ -36,6 +36,7 @@ #include "cogl-matrix.h" #include "cogl-snippet-private.h" #include "cogl-texture-private.h" +#include "cogl-pipeline-layer-state-private.h" #include "string.h" #if 0 @@ -361,7 +362,7 @@ cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline, _cogl_pipeline_set_layer_texture_data (pipeline, layer_index, NULL); } -void +static void _cogl_pipeline_set_layer_wrap_modes (CoglPipeline *pipeline, CoglPipelineLayer *layer, CoglPipelineLayer *authority, diff --git a/cogl/cogl-pipeline-progend-glsl.c b/cogl/cogl-pipeline-progend-glsl.c index 3bb6f797a..6d7cf4305 100644 --- a/cogl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl-pipeline-progend-glsl.c @@ -49,6 +49,7 @@ #include "cogl-pipeline-state-private.h" #include "cogl-attribute-private.h" #include "cogl-framebuffer-private.h" +#include "cogl-pipeline-progend-glsl-private.h" #ifdef HAVE_COGL_GLES2 diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c index a79494a3b..4b18d239f 100644 --- a/cogl/cogl-pipeline-state.c +++ b/cogl/cogl-pipeline-state.c @@ -451,7 +451,7 @@ _cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline) return authority->blend_enable; } -gboolean +static gboolean _cogl_pipeline_blend_enable_equal (CoglPipeline *authority0, CoglPipeline *authority1) { @@ -844,7 +844,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline) return authority->big_state->alpha_state.alpha_func_reference; } -GLenum +static GLenum arg_to_gl_blend_factor (CoglBlendStringArgument *arg) { if (arg->source.is_zero) @@ -914,7 +914,7 @@ arg_to_gl_blend_factor (CoglBlendStringArgument *arg) return GL_ONE; } -void +static void setup_blend_state (CoglBlendStringStatement *statement, GLenum *blend_equation, GLint *blend_src_factor, diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c index 7545855aa..cb708aa5d 100644 --- a/cogl/cogl-pipeline.c +++ b/cogl/cogl-pipeline.c @@ -88,12 +88,6 @@ _cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)]; COGL_OBJECT_DEFINE (Pipeline, pipeline); -GQuark -_cogl_pipeline_error_quark (void) -{ - return g_quark_from_static_string ("cogl-pipeline-error-quark"); -} - /* * This initializes the first pipeline owned by the Cogl context. All * subsequently instantiated pipelines created via the cogl_pipeline_new() diff --git a/cogl/cogl-point-in-poly.c b/cogl/cogl-point-in-poly.c index 87e090eca..71c6882e9 100644 --- a/cogl/cogl-point-in-poly.c +++ b/cogl/cogl-point-in-poly.c @@ -39,6 +39,7 @@ #endif #include "cogl-util.h" +#include "cogl-point-in-poly-private.h" #include diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c index 1519c69d0..d17051d58 100644 --- a/cogl/cogl-primitives.c +++ b/cogl/cogl-primitives.c @@ -39,6 +39,7 @@ #include "cogl-meta-texture.h" #include "cogl-framebuffer-private.h" #include "cogl1-context.h" +#include "cogl-primitives-private.h" #include #include @@ -899,7 +900,7 @@ typedef struct _AppendTexCoordsState float *vertices_out; } AppendTexCoordsState; -gboolean +static gboolean append_tex_coord_attributes_cb (CoglPipeline *pipeline, int layer_index, void *user_data) diff --git a/cogl/cogl-program-private.h b/cogl/cogl-program-private.h index 0474744a7..5c33f61c2 100644 --- a/cogl/cogl-program-private.h +++ b/cogl/cogl-program-private.h @@ -58,8 +58,6 @@ struct _CoglProgramUniform unsigned int dirty : 1; }; -CoglProgram *_cogl_program_pointer_from_handle (CoglHandle handle); - /* Internal function to flush the custom uniforms for the given use program. This assumes the target GL program is already bound. The gl_program still needs to be passed so that CoglProgram can query diff --git a/cogl/cogl-program.c b/cogl/cogl-program.c index d7f324b53..3d265ffd1 100644 --- a/cogl/cogl-program.c +++ b/cogl/cogl-program.c @@ -102,8 +102,8 @@ cogl_program_attach_shader (CoglHandle program_handle, if (!cogl_is_program (program_handle) || !cogl_is_shader (shader_handle)) return; - program = _cogl_program_pointer_from_handle (program_handle); - shader = _cogl_shader_pointer_from_handle (shader_handle); + program = program_handle; + shader = shader_handle; /* Only one shader is allowed if the type is ARBfp */ if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) @@ -158,7 +158,7 @@ cogl_program_get_uniform_location (CoglHandle handle, if (!cogl_is_program (handle)) return -1; - program = _cogl_program_pointer_from_handle (handle); + program = handle; /* We can't just ask the GL program object for the uniform location directly because it will change every time the program is linked diff --git a/cogl/cogl-quaternion.c b/cogl/cogl-quaternion.c index 5a6861101..cfb80310e 100644 --- a/cogl/cogl-quaternion.c +++ b/cogl/cogl-quaternion.c @@ -60,6 +60,12 @@ static CoglQuaternion identity_quaternion = 1.0, 0.0, 0.0, 0.0, }; +/* This function is just here to be called from GDB so we don't really + want to put a declaration in a header and we just add it here to + avoid a warning */ +void +_cogl_quaternion_print (CoglQuaternion *quarternion); + void _cogl_quaternion_print (CoglQuaternion *quaternion) { @@ -240,15 +246,6 @@ cogl_quaternion_init_from_quaternion (CoglQuaternion *quaternion, #define COGL_MATRIX_READ(MATRIX, ROW, COLUMN) \ (((const float *)matrix)[COLUMN * 4 + ROW]) -/** - * cogl_quaternion_init_from_matrix: - * @quaternion: A Cogl Quaternion - * @matrix: A rotation matrix with which to initialize the quaternion - * - * Initializes a quaternion from a rotation matrix. - * - * Since: 1.4 - */ void cogl_quaternion_init_from_matrix (CoglQuaternion *quaternion, const CoglMatrix *matrix) diff --git a/cogl/cogl-quaternion.h b/cogl/cogl-quaternion.h index 874a4613f..eb60bcd04 100644 --- a/cogl/cogl-quaternion.h +++ b/cogl/cogl-quaternion.h @@ -251,6 +251,24 @@ void cogl_quaternion_init_from_euler (CoglQuaternion *quaternion, const CoglEuler *euler); +void +cogl_quaternion_init_from_quaternion (CoglQuaternion *quaternion, + CoglQuaternion *src); + +/** + * cogl_quaternion_init_from_matrix: + * @quaternion: A Cogl Quaternion + * @matrix: A rotation matrix with which to initialize the quaternion + * + * Initializes a quaternion from a rotation matrix. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_quaternion_init_from_matrix (CoglQuaternion *quaternion, + const CoglMatrix *matrix); + /** * cogl_quaternion_equal: * @v1: A #CoglQuaternion diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c index 1c6a28b84..d07a3ca47 100644 --- a/cogl/cogl-renderer.c +++ b/cogl/cogl-renderer.c @@ -62,21 +62,20 @@ #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT #include "cogl-winsys-egl-null-private.h" #endif +#ifdef COGL_HAS_GLX_SUPPORT +#include "cogl-winsys-glx-private.h" +#endif +#ifdef COGL_HAS_WGL_SUPPORT +#include "cogl-winsys-wgl-private.h" +#endif +#ifdef COGL_HAS_SDL_SUPPORT +#include "cogl-winsys-sdl-private.h" +#endif #if COGL_HAS_XLIB_SUPPORT #include "cogl-xlib-renderer.h" #endif -#ifdef COGL_HAS_GLX_SUPPORT -extern const CoglWinsysVtable *_cogl_winsys_glx_get_vtable (void); -#endif -#ifdef COGL_HAS_WGL_SUPPORT -extern const CoglWinsysVtable *_cogl_winsys_wgl_get_vtable (void); -#endif -#ifdef COGL_HAS_SDL_SUPPORT -extern const CoglWinsysVtable *_cogl_winsys_sdl_get_vtable (void); -#endif - typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void); static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] = diff --git a/cogl/cogl-shader-private.h b/cogl/cogl-shader-private.h index 486375d17..6c05b3fb7 100644 --- a/cogl/cogl-shader-private.h +++ b/cogl/cogl-shader-private.h @@ -45,8 +45,6 @@ struct _CoglShader char *source; }; -CoglShader *_cogl_shader_pointer_from_handle (CoglHandle handle); - void _cogl_shader_compile_real (CoglHandle handle, int n_tex_coord_attribs); diff --git a/cogl/cogl-shader.c b/cogl/cogl-shader.c index 9b09b107f..cd8a7eda3 100644 --- a/cogl/cogl-shader.c +++ b/cogl/cogl-shader.c @@ -130,7 +130,7 @@ cogl_shader_source (CoglHandle handle, if (!cogl_is_shader (handle)) return; - shader = _cogl_shader_pointer_from_handle (handle); + shader = handle; #ifdef HAVE_COGL_GL if (strncmp (source, "!!ARBfp1.0", 10) == 0) @@ -399,7 +399,7 @@ cogl_shader_get_info_log (CoglHandle handle) if (!cogl_is_shader (handle)) return NULL; - shader = _cogl_shader_pointer_from_handle (handle); + shader = handle; #ifdef HAVE_COGL_GL if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) @@ -450,7 +450,7 @@ cogl_shader_get_type (CoglHandle handle) return COGL_SHADER_TYPE_VERTEX; } - shader = _cogl_shader_pointer_from_handle (handle); + shader = handle; return shader->type; } @@ -466,7 +466,7 @@ cogl_shader_is_compiled (CoglHandle handle) if (!cogl_is_shader (handle)) return FALSE; - shader = _cogl_shader_pointer_from_handle (handle); + shader = handle; #ifdef HAVE_COGL_GL if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) diff --git a/cogl/cogl-sub-texture.c b/cogl/cogl-sub-texture.c index 396c3b22a..925a87847 100644 --- a/cogl/cogl-sub-texture.c +++ b/cogl/cogl-sub-texture.c @@ -237,8 +237,7 @@ cogl_sub_texture_new (CoglContext *ctx, instead. */ if (cogl_is_sub_texture (next_texture)) { - CoglSubTexture *other_sub_tex = - _cogl_sub_texture_pointer_from_handle (next_texture); + CoglSubTexture *other_sub_tex = COGL_SUB_TEXTURE (next_texture); full_texture = other_sub_tex->full_texture; sub_x += other_sub_tex->sub_x; sub_y += other_sub_tex->sub_y; diff --git a/cogl/cogl-swap-chain.c b/cogl/cogl-swap-chain.c index a487419f2..51609fede 100644 --- a/cogl/cogl-swap-chain.c +++ b/cogl/cogl-swap-chain.c @@ -37,12 +37,6 @@ static void _cogl_swap_chain_free (CoglSwapChain *swap_chain); COGL_OBJECT_DEFINE (SwapChain, swap_chain); -GQuark -cogl_swap_chain_error_quark (void) -{ - return g_quark_from_static_string ("cogl-swap-chain-error-quark"); -} - static void _cogl_swap_chain_free (CoglSwapChain *swap_chain) { diff --git a/cogl/cogl-swap-chain.h b/cogl/cogl-swap-chain.h index 2f3ae587e..042093541 100644 --- a/cogl/cogl-swap-chain.h +++ b/cogl/cogl-swap-chain.h @@ -46,6 +46,9 @@ void cogl_swap_chain_set_length (CoglSwapChain *swap_chain, int length); +gboolean +cogl_is_swap_chain (void *object); + G_END_DECLS #endif /* __COGL_SWAP_CHAIN_H__ */ diff --git a/cogl/cogl-texture-2d-sliced.h b/cogl/cogl-texture-2d-sliced.h index b0e3136aa..b64d0be35 100644 --- a/cogl/cogl-texture-2d-sliced.h +++ b/cogl/cogl-texture-2d-sliced.h @@ -99,4 +99,18 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx, CoglPixelFormat internal_format, GError **error); +/** + * cogl_is_texture_2d_sliced: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a #CoglTexture2dSliced. + * + * Return value: %TRUE if the object references a #CoglTexture2dSliced + * and %FALSE otherwise. + * Since: 1.10 + * Stability: unstable + */ +gboolean +cogl_is_texture_2d_sliced (void *object); + #endif /* __COGL_TEXURE_2D_SLICED_H */ diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c index 956d9b13c..c2066f7b5 100644 --- a/cogl/cogl-texture-3d.c +++ b/cogl/cogl-texture-3d.c @@ -395,12 +395,6 @@ cogl_texture_3d_new_from_data (CoglContext *context, return ret; } -GQuark -cogl_texture_3d_error_quark (void) -{ - return g_quark_from_static_string ("cogl-texture-3d-error-quark"); -} - static int _cogl_texture_3d_get_max_waste (CoglTexture *tex) { diff --git a/cogl/cogl-vertex-buffer-private.h b/cogl/cogl-vertex-buffer-private.h index a7b23c859..a4143d290 100644 --- a/cogl/cogl-vertex-buffer-private.h +++ b/cogl/cogl-vertex-buffer-private.h @@ -154,11 +154,5 @@ typedef struct _CoglVertexBuffer } CoglVertexBuffer; -CoglVertexBuffer * -_cogl_vertex_buffer_pointer_from_handle (CoglHandle handle); - -CoglVertexBufferIndices * -_cogl_vertex_buffer_indices_pointer_from_handle (CoglHandle handle); - #endif /* __COGL_VERTEX_BUFFER_H */ diff --git a/cogl/cogl-vertex-buffer.c b/cogl/cogl-vertex-buffer.c index 017937827..36c89e212 100644 --- a/cogl/cogl-vertex-buffer.c +++ b/cogl/cogl-vertex-buffer.c @@ -144,7 +144,7 @@ cogl_vertex_buffer_get_n_vertices (CoglHandle handle) if (!cogl_is_vertex_buffer (handle)) return 0; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; return buffer->n_vertices; } @@ -451,7 +451,7 @@ cogl_vertex_buffer_add (CoglHandle handle, if (!cogl_is_vertex_buffer (handle)) return; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; buffer->dirty_attributes = TRUE; cogl_attribute_name = canonize_attribute_name (attribute_name); @@ -577,7 +577,7 @@ cogl_vertex_buffer_delete (CoglHandle handle, if (!cogl_is_vertex_buffer (handle)) return; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; buffer->dirty_attributes = TRUE; /* The submit function works by diffing between submitted_attributes @@ -618,7 +618,7 @@ set_attribute_enable (CoglHandle handle, if (!cogl_is_vertex_buffer (handle)) return; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; buffer->dirty_attributes = TRUE; /* NB: If a buffer is currently being edited, then there can be two seperate @@ -1469,7 +1469,7 @@ cogl_vertex_buffer_submit (CoglHandle handle) if (!cogl_is_vertex_buffer (handle)) return; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; cogl_vertex_buffer_submit_real (buffer); } @@ -1647,7 +1647,7 @@ cogl_vertex_buffer_draw (CoglHandle handle, if (!cogl_is_vertex_buffer (handle)) return; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; update_primitive_and_draw (buffer, mode, first, count, NULL); } @@ -1683,8 +1683,7 @@ cogl_vertex_buffer_indices_get_type (CoglHandle indices_handle) if (!cogl_is_vertex_buffer_indices (indices_handle)) return COGL_INDICES_TYPE_UNSIGNED_SHORT; - buffer_indices = - _cogl_vertex_buffer_indices_pointer_from_handle (indices_handle); + buffer_indices = indices_handle; return cogl_indices_get_type (buffer_indices->indices); } @@ -1711,13 +1710,12 @@ cogl_vertex_buffer_draw_elements (CoglHandle handle, if (!cogl_is_vertex_buffer (handle)) return; - buffer = _cogl_vertex_buffer_pointer_from_handle (handle); + buffer = handle; if (!cogl_is_vertex_buffer_indices (indices_handle)) return; - buffer_indices = - _cogl_vertex_buffer_indices_pointer_from_handle (indices_handle); + buffer_indices = indices_handle; update_primitive_and_draw (buffer, mode, indices_offset, count, buffer_indices); diff --git a/cogl/cogl.c b/cogl/cogl.c index bfd7ab5ec..eece03d8b 100644 --- a/cogl/cogl.c +++ b/cogl/cogl.c @@ -561,15 +561,6 @@ cogl_set_projection_matrix (CoglMatrix *matrix) cogl_framebuffer_set_projection_matrix (cogl_get_draw_framebuffer (), matrix); } -CoglClipState * -_cogl_get_clip_state (void) -{ - CoglFramebuffer *framebuffer; - - framebuffer = cogl_get_draw_framebuffer (); - return _cogl_framebuffer_get_clip_state (framebuffer); -} - GQuark _cogl_driver_error_quark (void) { diff --git a/cogl/cogl.h b/cogl/cogl.h index e8b1eeb6a..44778851d 100644 --- a/cogl/cogl.h +++ b/cogl/cogl.h @@ -124,7 +124,6 @@ */ #ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API #include -#include #endif /* diff --git a/cogl/cogl2-clip-state.h b/cogl/cogl2-clip-state.h deleted file mode 100644 index 63b20eeaf..000000000 --- a/cogl/cogl2-clip-state.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2007,2008,2009,2010 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - */ - -#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __COGL2_CLIP_STATE_H -#define __COGL2_CLIP_STATE_H - -#include - -G_BEGIN_DECLS - -#define cogl_clip_push_from_path cogl2_clip_push_from_path -/** - * cogl_clip_push_from_path: - * @path: The path to clip with. - * - * Sets a new clipping area using the silhouette of the specified, - * filled @path. The clipping area is intersected with the previous - * clipping area. To restore the previous clipping area, call - * call cogl_clip_pop(). - * - * Since: 1.8 - * Stability: Unstable - */ -void -cogl_clip_push_from_path (CoglPath *path); - -G_END_DECLS - -#endif /* __COGL2_CLIP_STATE_H */ diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c index 2afdbebde..8087ae0e4 100644 --- a/cogl/driver/gles/cogl-gles.c +++ b/cogl/driver/gles/cogl-gles.c @@ -31,6 +31,7 @@ #include "cogl-context-private.h" #include "cogl-feature-private.h" #include "cogl-renderer-private.h" +#include "cogl-private.h" gboolean _cogl_gles_update_features (CoglContext *context, diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c index 1f42fe589..ecddb4331 100644 --- a/cogl/winsys/cogl-winsys-egl-kms.c +++ b/cogl/winsys/cogl-winsys-egl-kms.c @@ -46,6 +46,7 @@ #include "cogl-renderer-private.h" #include "cogl-framebuffer-private.h" #include "cogl-onscreen-private.h" +#include "cogl-kms-renderer.h" static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; diff --git a/cogl/cogl2-clip-state.c b/cogl/winsys/cogl-winsys-glx-private.h similarity index 69% rename from cogl/cogl2-clip-state.c rename to cogl/winsys/cogl-winsys-glx-private.h index 57f18e262..5844e18af 100644 --- a/cogl/cogl2-clip-state.c +++ b/cogl/winsys/cogl-winsys-glx-private.h @@ -3,7 +3,7 @@ * * An object oriented GL/GLES Abstraction/Utility Layer * - * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * Copyright (C) 2012 Intel Corporation. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,16 +21,10 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#ifndef __COGL_WINSYS_GLX_PRIVATE_H +#define __COGL_WINSYS_GLX_PRIVATE_H -#include "cogl-clip-state-private.h" -#include "cogl-framebuffer-private.h" -#include "cogl-journal-private.h" +const CoglWinsysVtable * +_cogl_winsys_glx_get_vtable (void); -void -cogl2_clip_push_from_path (CoglPath *path) -{ - cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path); -} +#endif /* __COGL_WINSYS_GLX_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c index 765191ba1..79800ac95 100644 --- a/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/winsys/cogl-winsys-glx.c @@ -47,6 +47,7 @@ #include "cogl-swap-chain-private.h" #include "cogl-xlib-renderer.h" #include "cogl-util.h" +#include "cogl-winsys-glx-private.h" #include #include diff --git a/cogl/winsys/cogl-winsys-sdl-private.h b/cogl/winsys/cogl-winsys-sdl-private.h new file mode 100644 index 000000000..2f0066d00 --- /dev/null +++ b/cogl/winsys/cogl-winsys-sdl-private.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +#ifndef __COGL_WINSYS_SDL_PRIVATE_H +#define __COGL_WINSYS_SDL_PRIVATE_H + +const CoglWinsysVtable * +_cogl_winsys_sdl_get_vtable (void); + +#endif /* __COGL_WINSYS_SDL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-sdl.c b/cogl/winsys/cogl-winsys-sdl.c index c71f402f9..deda04520 100644 --- a/cogl/winsys/cogl-winsys-sdl.c +++ b/cogl/winsys/cogl-winsys-sdl.c @@ -36,6 +36,7 @@ #include "cogl-onscreen-template-private.h" #include "cogl-context-private.h" #include "cogl-onscreen-private.h" +#include "cogl-winsys-sdl-private.h" typedef struct _CoglRendererSdl { diff --git a/cogl/winsys/cogl-winsys-stub.c b/cogl/winsys/cogl-winsys-stub.c index 3310cfe0c..1801b66cb 100644 --- a/cogl/winsys/cogl-winsys-stub.c +++ b/cogl/winsys/cogl-winsys-stub.c @@ -34,6 +34,7 @@ #include "cogl-context-private.h" #include "cogl-framebuffer-private.h" #include "cogl-private.h" +#include "cogl-winsys-stub-private.h" #include diff --git a/cogl/winsys/cogl-winsys-wgl-private.h b/cogl/winsys/cogl-winsys-wgl-private.h new file mode 100644 index 000000000..fd41eb4df --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl-private.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +#ifndef __COGL_WINSYS_WGL_PRIVATE_H +#define __COGL_WINSYS_WGL_PRIVATE_H + +const CoglWinsysVtable * +_cogl_winsys_wgl_get_vtable (void); + +#endif /* __COGL_WINSYS_WGL_PRIVATE_H */ diff --git a/cogl/winsys/cogl-winsys-wgl.c b/cogl/winsys/cogl-winsys-wgl.c index 66f9ed13c..198b1d81f 100644 --- a/cogl/winsys/cogl-winsys-wgl.c +++ b/cogl/winsys/cogl-winsys-wgl.c @@ -44,6 +44,7 @@ #include "cogl-private.h" #include "cogl-feature-private.h" #include "cogl-win32-renderer.h" +#include "cogl-winsys-wgl-private.h" typedef struct _CoglRendererWgl { diff --git a/configure.ac b/configure.ac index 57e815daa..6cc7b66dd 100644 --- a/configure.ac +++ b/configure.ac @@ -260,7 +260,7 @@ MAINTAINER_COMPILER_FLAGS="-Wall -Wcast-align -Wuninitialized -Wno-strict-aliasing -Wempty-body -Wformat -Wformat-security -Winit-self -Wdeclaration-after-statement -Wvla - -Wpointer-arith" + -Wpointer-arith -Wmissing-declarations" AS_CASE( [$enable_maintainer_flags], diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt index dbb288b50..1907687ab 100644 --- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt @@ -173,17 +173,6 @@ cogl_poll_dispatch cogl_glib_source_new -
-cogl-clipping -Clipping -cogl_clip_push_rectangle -cogl_clip_push_window_rectangle -cogl_clip_push_from_path -cogl_clip_push_from_path_preserve -cogl_clip_push_primitive -cogl_clip_pop -
-
cogl-index-array Index Arrays diff --git a/examples/cogland.c b/examples/cogland.c index ffcbe479c..766657ebd 100644 --- a/examples/cogland.c +++ b/examples/cogland.c @@ -128,7 +128,7 @@ static GSourceFuncs wayland_event_source_funcs = NULL }; -GSource * +static GSource * wayland_event_source_new (struct wl_event_loop *loop) { WaylandEventSource *source; diff --git a/tests/conform/test-utils.h b/tests/conform/test-utils.h index f4cdb4947..b856e9ebc 100644 --- a/tests/conform/test-utils.h +++ b/tests/conform/test-utils.h @@ -1,6 +1,12 @@ #ifndef _TEST_UTILS_H_ #define _TEST_UTILS_H_ +/* We don't really care about functions that are defined without a + header for the unit tests so we can just disable it here */ +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wmissing-declarations" +#endif + typedef enum _TestRequirement { TEST_REQUIREMENT_GL = 1<<0,