Commit Graph

66 Commits

Author SHA1 Message Date
Simon McVittie ec3d788e74 cogl-pango-2.0-experimental.pc: Reference correct library name
It's libcogl-pango.so, not libcoglpango.so.

Signed-off-by: Simon McVittie <smcv@debian.org>
2019-09-06 09:10:06 +01:00
Simon McVittie 3fd7741172 gst, pango: Add missing pkg-config dependencies
Adding automated tests for the Debian -dev packages, which link a trivial
program to the pkg-config module under test, revealed that these .pc
files were not self-contained. Add the necessary dependencies for linking
to succeed.

Signed-off-by: Simon McVittie <smcv@debian.org>
2019-09-06 09:08:53 +01:00
Emmanuele Bassi 7c7239eb34 Add fallback for semi-private symbols in Pango
Pango dropped the PANGO_ENABLE_BACKEND and PANGO_ENABLE_ENGINE symbols,
so we need to add our own defines to avoid breaking the build.
2019-07-07 09:31:07 +01:00
Emmanuele Bassi 9ab320cd3d pango: Conditionally use deprecated API
When compiling against a newer version of Pango we can avoid the
deprecation warning.
2015-06-10 15:14:30 +01:00
Lionel Landwerlin 1b2dd815b4 Registers gtypes for all public objects and structs
This adds much more comprehensive support for gobject-introspection
based bindings by registering all objects as fundamental types that
inherit from CoglObject, and all structs as boxed types.

Co-Author: Robert Bragg <robert@linux.intel.com>

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 18:27:12 +00:00
Chun-wei Fan bb10532f4b cogl-pango-pipeline-cache.c: Include forgotten header
The private header is needed as the cogl_texture_get_format API was made
private, so that C4013 (implicit declaration of ...) warnings/errors can
be avoided

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-03-20 18:00:01 +00:00
Robert Bragg a0441778ad This re-licenses Cogl 1.18 under the MIT license
Since the Cogl 1.18 branch is actively maintained in parallel with the
master branch; this is a counter part to commit 1b83ef938f which
re-licensed the master branch to use the MIT license.

This re-licensing is a follow up to the proposal that was sent to the
Cogl mailing list:
http://lists.freedesktop.org/archives/cogl/2013-December/001465.html

Note: there was a copyright assignment policy in place for Clutter (and
therefore Cogl which was part of Clutter at the time) until the 11th of
June 2010 and so we only checked the details after that point (commit
0bbf50f905)

For each file, authors were identified via this Git command:
$ git blame -p -C -C -C20 -M -M10  0bbf50f905..HEAD

We received blanket approvals for re-licensing all Red Hat and Collabora
contributions which reduced how many people needed to be contacted
individually:
- http://lists.freedesktop.org/archives/cogl/2013-December/001470.html
- http://lists.freedesktop.org/archives/cogl/2014-January/001536.html

Individual approval requests were sent to all the other identified authors
who all confirmed the re-license on the Cogl mailinglist:
http://lists.freedesktop.org/archives/cogl/2014-January

As well as updating the copyright header in all sources files, the
COPYING file has been updated to reflect the license change and also
document the other licenses used in Cogl such as the SGI Free Software
License B, version 2.0 and the 3-clause BSD license.

This patch was not simply cherry-picked from master; but the same
methodology was used to check the source files.
2014-02-22 02:02:53 +00:00
Lionel Landwerlin 5fa0ee9569 fix experimental pc files dep on cogl-1.0
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2014-02-20 18:14:43 +00:00
Robert Bragg af7398788a remove internal_format and redundant error arguments
Texture allocation is now consistently handled lazily such that the
internal format can now be controlled using
cogl_texture_set_components() and cogl_texture_set_premultiplied()
before allocating the texture with cogl_texture_allocate(). This means
that the internal_format arguments to texture constructors are now
redundant and since most of the texture constructors now can't ever fail
the error arguments are also redundant. This now means we no longer
use CoglPixelFormat in the public api for describing the internal format
of textures which had been bad solution originally due to how specific
CoglPixelFormat is which is missleading when we don't support such
explicit control over the internal format.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 99a53c82e9)

Note: there are numerous API changes for functions currently marked
as 'unstable' which we don't think are in use by anyone depending on
a stable 1.x api. Compared to the original patch though this avoids
changing the cogl_texture_rectangle_new_with_size() api which we know
is used by Mutter.
2014-01-09 15:49:47 +00:00
Robert Bragg 99cdcc9e3c texture: make cogl_texture_get_format api private
CoglPixelFormat is not a good way of describing the internal
format of a texture because it's too specific given that we don't
actually have exact knowledge of the internal format used by the driver.

This makes cogl_texture_get_format private and in the future we'll
provide a better way of querying the channels and their precision.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit ffde82981f)

Note: Since we can't break API compatibility on the 1.x branch this adds
a cogl/deprecated/cogl-texture-deprecated.c file with a
cogl_texture_get_format() wrapper around the private api. This also
moves the cogl_texture_get_rowstride() and cogl_texture_ref/unref()
functions that were previously deprecated into cogl-texture-deprecated.c
2014-01-09 15:49:35 +00:00
Neil Roberts c5644723f8 Use COGL_FLAGS_* for the context's private feature flags
Previously the private feature flags were stored in an enum and we
already had 31 flags. Adding the 32nd flag would presumably make it
add -2³¹ as one of the values which might cause problems. To avoid
this we'll just use an fixed-size array of longs and use indices for
the enum values like we do for the public features.

A slight complication with this is in the CoglDriverDescription where
we were previously using a static intialised value to describe the set
of features that the driver supports. We can't easily do this with the
flags array so instead the features are stored in a fixed-size array
of indices.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit d94cb984e3)

Conflicts:
	cogl/cogl-context-private.h
	cogl/cogl-context.c
	cogl/cogl-private.h
	cogl/cogl-renderer.c
	cogl/driver/gl/cogl-pipeline-opengl.c
	cogl/driver/gl/gl/cogl-driver-gl.c
	cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c
	cogl/driver/gl/gles/cogl-driver-gles.c
	cogl/driver/nop/cogl-driver-nop.c
2013-11-28 18:12:22 +00:00
Robert Bragg 6436cd073d Declare interface types as void and remove cast macros
This declares the interface types CoglFramebuffer, CoglBuffer,
CoglTexture, CoglMetaTexture and CoglPrimitiveTexture as void when
including the public cogl.h header so that users don't have to use lots
of C type casts between instance types and interface types.

This also removes all of the COGL_XYZ() type cast macros since they do
nothing more than compile time type casting but it's less readable if
you haven't seen that coding pattern before.

Unlike with gobject based apis that use per-type macros for casting and
performing runtime type checking we instead prefer to do our runtime
type checking internally within the front-end public apis when objects
are passed into Cogl. This greatly reduces the verbosity for users of
the api and may help reduce the chance of excessive runtime type
checking that can sometimes be a problem.

(cherry picked from commit 248a76f5ea)

Since we can't break the 1.x api this version of the patch actually
defines compatible NOP macros within deprecated/cogl-type-casts.h
2013-11-27 19:33:44 +00:00
Chun-wei Fan 98340c44ba Fix the Windows Resource Files
The autotools variables to substitute for versioning in 1.16 is wrong, so we
have incorrect versioning info during a release as the variables are for
Cogl-2.x.  Fix this so we can have the correct versioning info for the
Cogl/Cogl-Pango DLLs during a release.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2013-08-30 12:04:36 +01:00
Jasper St. Pierre 99352e1149 Fix introspection issues 2013-08-20 19:18:40 -04:00
Chun-wei Fan aa878ddca6 Fix the placement of deprecation macros
The deprecation macros, which expand to __declspec (deprecated) on Visual
Studio, is expected to be before the return type of the function which
is annotated by them, and having the deprecation macros there is also
accepted by GCC as well.

This will fix the builds of all applications/libraries using Cogl under
Visual Studio,

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-08-19 22:44:45 +01:00
Robert Bragg 7365c3aa77 Separate out CoglPath api into sub-library
This splits out the cogl_path_ api into a separate cogl-path sub-library
like cogl-pango and cogl-gst. This enables developers to build Cogl with
this sub-library disabled if they don't need it which can be useful when
its important to keep the size of an application and its dependencies
down to a minimum. The functions cogl_framebuffer_{fill,stroke}_path
have been renamed to cogl_path_{fill,stroke}.

There were a few places in core cogl and cogl-gst that referenced the
CoglPath api and these have been decoupled by using the CoglPrimitive
api instead. In the case of cogl_framebuffer_push_path_clip() the core
clip stack no longer accepts path clips directly but it's now possible
to get a CoglPrimitive for the fill of a path and so the implementation
of cogl_framebuffer_push_path_clip() now lives in cogl-path and works as
a shim that first gets a CoglPrimitive and uses
cogl_framebuffer_push_primitive_clip instead.

We may want to consider renaming cogl_framebuffer_push_path_clip to
put it in the cogl_path_ namespace.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 8aadfd8292)

So as to avoid breaking the 1.x API or even the ABI since we are quite
late in the 1.16 development cycle the patch was modified to build
cogl-path as a noinst_LTLIBRARY before building cogl and link the code
directly into libcogl.so as it was previously. This way we can wait
until the start of the 1.18 cycle before splitting the code into a
separate libcogl-path.so.

This also adds shims for cogl_framebuffer_fill/stroke_path() to avoid
breaking the 1.x API/ABI.
2013-08-19 22:44:35 +01:00
Robert Bragg e9f721216e Add _primitive_draw to replace _framebuffer_draw_primitive
When splitting out the CoglPath api we saw that we would be left with
inconsistent drawing apis if the drawing apis in core Cogl were lumped
into the cogl_framebuffer_ api considering other Cogl sub-libraries or
that others will want to create higher level drawing apis outside of
Cogl but can't use the same namespace.

So that we can aim for a more consistent style this adds a
cogl_primitive_draw() api, comparable to cogl_path_fill() or
cogl_pango_show_layout() that's intended to replace
cogl_framebuffer_draw_primitive()

Note: the attribute and rectangle drawing apis are still in the
cogl_framebuffer_ namespace and this might potentially change but in
these cases there is no single object representing the thing being drawn
so it seems a more reasonable they they live in the framebuffer
namespace for now.

Note: the cogl_framebuffer_draw_primitive() api isn't removed by this
patch so it can more conveniently be cherry picked to the 1.16 branch so
we can mark it deprecated for a short while. Even though it's marked as
experimental api we know that there are people using the api so we'd
like to give them a chance to switch to the new api.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 418912b93f)

Conflicts:
	cogl-pango/cogl-pango-display-list.c
	cogl/Makefile.am
	cogl/cogl-framebuffer.c
	cogl/cogl-pipeline-layer-state.h
	cogl/cogl2-path.c
	cogl/driver/gl/cogl-clip-stack-gl.c
2013-07-29 18:31:36 +01:00
Robert Bragg fc5d1a8a68 Expose CoglAtlasTexture api
This exposes the CoglAtlasTexture api, making the following public:
cogl_atlas_texture_new_with_size
cogl_atlas_texture_new_from_file
cogl_atlas_texture_new_from_data
cogl_atlas_texture_new_from_bitmap

The plan is to remove auto-texture apis like cogl_texture_new_from_file
since they are a bit too magic, but that means we need an explicit way
for users to allocate texture that will go in the atlas.

Although the _new_from_file() api is arguably redundant since you can
use _bitmap_new_from_file() followed by _atlas_texture_new_from_bitmap()
we don't want to loose any of the convenience that
cogl_texture_new_from_file() had.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit fe515e6063)

Conflicts:
	cogl/Makefile.am
2013-07-29 16:38:53 +01:00
Robert Bragg afbb13e1a4 Add compiler deprecation warnings
This adds compiler symbol deprecation declarations for old Cogl APIs so
that users can easily see via compiler warning when they are using these
symbols, and also see a hint for what the apis should be replaced with.

So that users of Cogl can manage when to show these warnings this
introduces a scheme borrowed from glib whereby you can declare what
version of the Cogl api you are using:

COGL_VERSION_MIN_REQUIRED can be defined to indicate the oldest Cogl api
that the application wants to use. Cogl will only warn about
deprecations for symbols that were deprecated earlier than this required
version. If this is left undefined then by default Cogl will warn about
all deprecations.

COGL_VERSION_MAX_ALLOWED can be defined to indicate the newest api
that the application uses. If the application uses symbols newer than
this then Cogl will give a warning about that.

This patch removes the need to maintain the COGL_DISABLE_DEPRECATED
guards around deprecated symbols.

This patch fixes a few uses of deprecated symbols in the examples/

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2013-04-24 22:23:50 +01:00
Neil Roberts d63dfba113 cogl-pango: Add a missing backslash in the Makefile
There was a missing backslash in the LDFLAGS for libcogl-pango2. This
was stopping it having the right library version information and the
library would have the wrong filename.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit cf3d2b3de8)
2013-02-20 14:55:44 +00:00
Jasper St. Pierre 1ea8ee5932 cogl-pango: Fix some doc/introspection comments
https://bugzilla.gnome.org/show_bug.cgi?id=693360
2013-02-07 15:52:39 -05:00
Robert Bragg 50005a9364 build: update to build with automake 1.13
This make autogen.sh look for automake-1.13 and also updates all
Makefile.am files to no longer use the INCLUDES variable which automake
1.13 warns is deprecated by AM_CPPFLAGS.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5de5569e96)
2013-01-22 18:00:05 +00:00
Robert Bragg 73e8a6d7ce Allow lazy texture storage allocation
Consistent with how we lazily allocate framebuffers this patch allows us
to instantiate textures but still specify constraints and requirements
before allocating storage so that we can be sure to allocate the most
appropriate/efficient storage.

This adds a cogl_texture_allocate() function that is analogous to
cogl_framebuffer_allocate() which can optionally be called to explicitly
allocate storage and catch any errors. If this function isn't used
explicitly then Cogl will implicitly ensure textures are allocated
before the storage is needed.

It is generally recommended to rely on lazy storage allocation or at
least perform explicit allocation as late as possible so Cogl can be
fully informed about the best way to allocate storage.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 1fa7c0f10a)

Note: This reverts the cogl_texture_rectangle_new_with_size API change
that dropped the CoglError argument and keeps the semantics of
allocating the texture immediately. This is because Mutter currently
uses this API so we will probably look at updating this later once
we have a corresponding Mutter patch prepared. The other API changes
were kept since they only affected experimental api.
2013-01-22 17:48:17 +00:00
Robert Bragg fa5a9c88fe atlas-texture: remove some use of _COGL_GET_CONTEXT
This removes several uses of _COGL_GET_CONTEXT in cogl-atlas-texture.c.
Notably this involved making CoglPangoGlyphCache track an associated
CoglContext pointer which cogl-pango can pass to
_cogl_atlas_texture_new_with_size().

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit d66afbd075)
2013-01-22 17:48:09 +00:00
Robert Bragg 579db9083d cogl-pango: Updates to no longer require a default context
This updates the Cogl Pango api to no longer require a default context
and also cleans up the public api a bit.

The CoglPangoRenderer type has been made private to be
consistent with other pango backends where the renderer is merely an
implementation detail.

The drawing apis such as cogl_pango_render_layout where made more
consistent with other pango backend apis so we now have replacements
like cogl_pango_show_layout().

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit bba2defe8c)

Note: API changes were reverting in cherry-picking this patch
2013-01-22 17:48:09 +00:00
Robert Bragg f53fb5e2e0 Allow propogation of OOM errors to apps
This allows apps to catch out-of-memory errors when allocating textures.

Textures can be pretty huge at times and so it's quite possible for an
application to try and allocate more memory than is available. It's also
very possible that the application can take some action in response to
reduce memory pressure (such as freeing up texture caches perhaps) so
we shouldn't just automatically abort like we do for trivial heap
allocations.

These public functions now take a CoglError argument so applications can
catch out of memory errors:

cogl_buffer_map
cogl_buffer_map_range
cogl_buffer_set_data
cogl_framebuffer_read_pixels_into_bitmap
cogl_pixel_buffer_new
cogl_texture_new_from_data
cogl_texture_new_from_bitmap

Note: we've been quite conservative with how many apis we let throw OOM
CoglErrors since we don't really want to put a burdon on developers to
be checking for errors with every cogl api call. So long as there is
some lower level api for apps to use that let them catch OOM errors
for everything necessary that's enough and we don't have to make more
convenient apis more awkward to use.

The main focus is on bitmaps and texture allocations since they
can be particularly large and prone to failing.

A new cogl_attribute_buffer_new_with_size() function has been added in
case developers need to catch OOM errors when allocating attribute buffers
whereby they can first use _buffer_new_with_size() (which doesn't take a
CoglError) followed by cogl_buffer_set_data() which will lazily allocate
the buffer storage and report OOM errors.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit f7735e141a)

Note: since we can't break the API for Cogl 1.x then actually the main
purpose of cherry picking this patch is to keep in-line with changes
on the master branch so that we can easily cherry-pick patches.

All the api changes relating stable apis released on the 1.12 branch
have been reverted as part of cherry-picking this patch so this most
just applies all the internal plumbing changes that enable us to
correctly propagate OOM errors.
2013-01-22 17:48:07 +00:00
Neil Roberts 4f6fe6f0e2 Fixes for --disable-glib
This fixes some problems which were stopping --disable-glib from
working properly:

• A lot of the public headers were including glib.h. This shouldn't be
  necessary because the API doesn't expose any glib types. Otherwise
  any apps would require glib in order to get the header.

• The public headers were using G_BEGIN_DECLS. There is now a
  replacement macro called COGL_BEGIN_DECLS which is defined in
  cogl-types.h.

• A similar fix has been done for G_GNUC_NULL_TERMINATED and
  G_GNUC_DEPRECATED.

• The CFLAGS were not including $(builddir)/deps/glib which was
  preventing it finding the generated glibconfig.h when building out
  of tree.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 4138b3141c)
2013-01-22 17:48:05 +00:00
Neil Roberts 2616ae0fa9 Add a GL 3 driver
This adds a new CoglDriver for GL 3 called COGL_DRIVER_GL3. When
requested, the GLX, EGL and SDL2 winsyss will set the necessary
attributes to request a forward-compatible core profile 3.1 context.
That means it will have no deprecated features.

To simplify the explosion of checks for specific combinations of
context->driver, many of these conditionals have now been replaced
with private feature flags that are checked instead. The GL and GLES
drivers now initialise these private feature flags depending on which
driver is used.

The fixed function backends now explicitly check whether the fixed
function private feature is available which means the GL3 driver will
fall back to always using the GLSL progend. Since Rob's latest patches
the GLSL progend no longer uses any fixed function API anyway so it
should just work.

The driver is currently lower priority than COGL_DRIVER_GL so it will
not be used unless it is specificly requested. We may want to change
this priority at some point because apparently Mesa can make some
memory savings if a core profile context is used.

In GL 3, getting the combined extensions string with glGetString is
deprecated so this patch changes it to use glGetStringi to build up an
array of extensions instead. _cogl_context_get_gl_extensions now
returns this array instead of trying to return a const string. The
caller is expected to free the array.

Some issues with this patch:

• GL 3 does not support GL_ALPHA format textures. We should probably
  make this a feature flag or something. Cogl uses this to render text
  which currently just throws a GL error and breaks so it's pretty
  important to do something about this before considering the GL3
  driver to be stable.

• GL 3 doesn't support client side vertex buffers. This probably
  doesn't matter because CoglBuffer won't normally use malloc'd
  buffers if VBOs are available, but it might but worth making
  malloc'd buffers a private feature and forcing it not to use them.

• GL 3 doesn't support the default vertex array object. This patch
  just makes it create and bind a single non-default vertex array
  object which gets used just like the normal default object. Ideally
  it would be good to use vertex array objects properly and attach
  them to a CoglPrimitive to cache the state.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 66c9db9935)
2013-01-22 17:48:01 +00:00
Tomeu Vizoso 93d0de1d9a Mass rename CLUTTER_COMPILATION to COGL_COMPILATION
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit a99512e579)
2012-08-06 14:27:45 +01:00
Chun-wei Fan 23becf67a7 Fix Visual C++ build
-Create a pre-defined cogl/cogl-gl-header.h(.win32) that is to be used on
 any Windows builds, and adapt the MSVC build process to set up and use
 that file.
-Fix up glib-mkenums code generation .bat file that is generated during
 "make"/"make dist", like the autotools-based builds.
-Since cogl/cogl-defines.h now contain versionioning info, and it no longer
 directly includes the GL headers, update the pre-configured
 cogl-defines.h[.win32|.win32_SDL] and use autotools to fill in the
 versioning info during "make"/"make dist".
-Fix up cogl/cogl-pango.rc.in so that they reflect the cogl-2.x versioning
 stuff correctly and versioning info can be filled in correctly during
 "make"/"make dist"

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 7ff42bb1c5)
2012-08-06 14:27:42 +01:00
Neil Roberts 8dd77de009 Replace cogl_path_{stroke,fill} with framebuffer API
The existing functions for stroking and filling a path depend on the
global framebuffer and source stacks. These are now replaced with
cogl_framebuffer_{stroke,fill}_path which get explicitly passed the
framebuffer and pipeline.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 713a8f8160)
2012-08-06 14:27:39 +01:00
Robert Bragg 54735dec84 Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.

Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.

Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.

So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.

Instead of gsize we now use size_t

For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5967dad240)
2012-08-06 14:27:39 +01:00
Robert Bragg 09642a83b5 Removes all remaining use of CoglHandle
Removing CoglHandle has been an on going goal for quite a long time now
and finally this patch removes the last remaining uses of the CoglHandle
type and the cogl_handle_ apis.

Since the big remaining users of CoglHandle were the cogl_program_ and
cogl_shader_ apis which have replaced with the CoglSnippets api this
patch removes both of these apis.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6ed3aaf4be)

  Since the original patch was done after removing deprecated API
  this back ported patch doesn't affect deprecated API and so
  actually this cherry-pick doesn't remove all remaining use of
  CoglHandle as it did for the master branch of Cogl.
2012-08-06 14:27:39 +01:00
Neil Roberts d2a5d6f361 Add a context member to CoglPath
cogl_path_new now takes a CoglContext pointer which it keeps a pointer
to instead of relying on the global context.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit afc63f8211)

  Since we can't change the api on this branch this just applies
  the internal cleanups so we depend less on _COGL_GET_CONTEXT
2012-08-06 14:27:38 +01:00
Dave Airlie 46b1727705 cogl-glyph-cache: fix use of uninitialised value.
While valgrinding gnome-shell I noticed this value was being used
uninitialised as the memory is malloced.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-03-13 13:40:23 +00:00
Neil Roberts 185630085c Add -Wmissing-declarations to maintainer flags and fix problems
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 <robert@linux.intel.com>
2012-03-06 18:45:44 +00:00
Robert Bragg 785e6375eb Adds a context arg to cogl_pipeline_new()
As we move towards Cogl 2.0 we are aiming to remove the need for a
default global CoglContext and so everything should be explicitly
related to a context somehow. CoglPipelines are top level objects and
so this patch adds a context argument to cogl_pipeline_new().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-21 12:38:24 +00:00
Robert Bragg ae78215443 pango: don't pass COGL_MATERIAL enums to pipeline api
This patch fixes a case in cogl-pango-pipeline-cache.c where we were
passing COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE to
cogl_pipelin_set_layer_wrap_mode and instead passes the equivalent
CoglPipelineWrapMode.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:14:12 +00:00
Emmanuele Bassi bc37250841 Ensure that the CoglPango GIR is built against the correct libcogl
If we don't specify the dependency we may end up linking against a stale
libcogl.la, or, worse, a globally installed one.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-15 14:57:31 +00:00
Robert Bragg 3ea6acc072 buffer: explicitly relate buffers to a context
All CoglBuffer constructors now take an explicit CoglContext
constructor. This is part of the on going effort to adapt to Cogl API so
it no longer depends on a global, default context.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 14:28:02 +00:00
Robert Bragg 92c3063014 framebuffer: Add cogl_framebuffer draw methods
This adds cogl_framebuffer_ apis for drawing attributes and primitives
that replace corresponding apis that depend on the default CoglContext.
This is part of the on going effort to adapt the Cogl api so it no
longer depends on a global context variable.

All the new drawing functions also take an explicit pipeline argument
since we are also aiming to avoid being a stateful api like Cairo and
OpenGL. Being stateless makes it easier for orthogonal components to
share access to the GPU. Being stateless should also minimize any
impedance miss-match for those wanting to build higher level stateless
apis on top of Cogl.

Note: none of the legacy, global state options such as
cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
cogl_program_use() are supported by these new drawing apis and if set
will simply be silently ignored.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 13:09:15 +00:00
Chun-wei Fan 330146557d Bug 664827: Autotools changes for Windows .rc files
This will make autotools fill in the versioning info for the COGL/
COGL-Pango .rc files and distribute the resulting .rc files
2011-12-15 20:31:31 +08:00
Chun-wei Fan 090527f32d Add Windows Resource Files templates
This tells people on the versioning info and copyright info of the
COGL/COGL-Pango DLLs.  The versioning values are inserted during the
autogen stage.
2011-12-15 20:31:30 +08:00
Chun-wei Fan 2055f6ba91 VS 2008/2010 project files to build Cogl
These are the VS 2008/2010 project files to build Cogl, with a README.txt
to explain the process involved.

Note that the Cogl and Cogl-Pango projects (and filters for VS2010) are
expanded with the correct source file listings during "make dist", which
is done to simplify maintenance of these project files.

-added preconfigured config.h(.win32.in), which is expanded with the
 correct versioining info during autogen
-added preconfigued cogl/cogl-defines.h.win32
-added symbols files for cogl and cogl-pango
-Have configure.ac expand the config.h.win32.in into config.h.win32
 with the correct versioning info, etc, and to include the Visual C++
 project files for distribution
-Added rules in cogl/Makefile.am to expand the cogl VS 2008/2010 projects
 and filters from the templates with up-to-date source file listings, to
 distribute cogl-enum-types.c, cogl-enum-types.h to ease compilation and
 to avoid depending on PERL on Windows installations.
-Added rules in cogl-pango/Makefile.am to expand the cogl-pango VS2008/
 2010 projects and filters from the templates with up-to-date source file
 listings.
-Added/edited various Makefile.am's in build to distribute the VS2008/2010
 project files and associated items required for the build.
-Update .gitignore. There needs to be a pre-configured
 config.h(.win32) and its template, config.h.win32.in for Visual C++
 builds

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-25 13:12:45 +00:00
Neil Roberts d706991579 cogl-flags: Add some macros to help iterate the bits
This adds some macros to iterate over all the bits set in an array of
flags. The macros are a bit awkward because it tries to avoid using a
callback pointer so that the code is inlined.

cogl_bitmask is now using these macros as well so that the logic can
be shared.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-16 16:32:00 +00:00
Robert Bragg 8cf76ee36b primitive: Add n_indices arg to _set_indices function
When associating indices with a CoglPrimitive you are now forced to
specify the number of indices that should be read when drawing.

It's easy to forget to call cogl_primitive_set_n_vertices() after
associating indices with a primitive (and anyway you can see that someone
could be led to believe Cogl can determine that implicitly somewhow) so
this should avoid a lot of mistakes with using the API.

We'd expect that setting indices and updating the n_vertices property
would go hand in hand 99% of the time anyway so this change should
be more convenient as well as less error prone.

This patch adds some documentation for cogl_primitive_set_indices and
cogl_primitive_get/set_n_vertices. It also tries to clarify how the
CoglPrimitive:n_vertices property is updated and what that property
means in relation to other functions too.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:03 +00:00
Robert Bragg 1d8fd64e1c meta-texture: This publicly exposes CoglMetaTexture
CoglMetaTexture is an interface for dealing with high level textures
that may be comprised of one or more low-level textures internally. The
interface allows the development of primitive drawing APIs that can draw
with high-level textures (such as atlas textures) even though the
GPU doesn't natively understand these texture types.

There is currently just one function that's part of this interface:
cogl_meta_texture_foreach_in_region() which allows an application to
resolve the internal, low-level textures of a high-level texture.
cogl_rectangle() uses this API for example so that it can easily emulate
the _REPEAT wrap mode for textures that the hardware can't natively
handle repeating of.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:01 +00:00
Neil Roberts 5aab8a2310 Add an option to avoid defining G_DISABLE_DEPRECATED
G_DISABLE_DEPRECATED is only intended for developers of Cogl and it
sometimes breaks the build for people just trying to build a
release. This patch adds an option to enable deprecated Glib
features. By default it is enabled for non-git versions of Cogl.

The patch is based on similar code in Clutter except it adds the flags
to COGL_EXTRA_CFLAGS instead of having a separate variable.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-27 10:27:19 +01:00
Chun-wei Fan 98a9428967 cogl-pipeline/cogl-pango: Added forgotten includes
It seems that cogl-context-private.h needs to be included before including
any of the pipeline-related stuff to avoid build errors on C89 compilers.

This is due to the recent cogl-pipeline decoupling, seems like.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-26 15:53:30 +01:00
Robert Bragg 4c3dadd35e Add a strong CoglTexture type to replace CoglHandle
As part of the on going, incremental effort to purge the non type safe
CoglHandle type from the Cogl API this patch tackles most of the
CoglHandle uses relating to textures.

We'd postponed making this change for quite a while because we wanted to
have a clearer understanding of how we wanted to evolve the texture APIs
towards Cogl 2.0 before exposing type safety here which would be
difficult to change later since it would imply breaking APIs.

The basic idea that we are steering towards now is that CoglTexture
can be considered to be the most primitive interface we have for any
object representing a texture. The texture interface would provide
roughly these methods:

  cogl_texture_get_width
  cogl_texture_get_height
  cogl_texture_can_repeat
  cogl_texture_can_mipmap
  cogl_texture_generate_mipmap;
  cogl_texture_get_format
  cogl_texture_set_region
  cogl_texture_get_region

Besides the texture interface we will then start to expose types
corresponding to specific texture types: CoglTexture2D,
CoglTexture3D, CoglTexture2DSliced, CoglSubTexture, CoglAtlasTexture and
CoglTexturePixmapX11.

We will then also expose an interface for the high-level texture types
we have (such as CoglTexture2DSlice, CoglSubTexture and
CoglAtlasTexture) called CoglMetaTexture. CoglMetaTexture is an
additional interface that lets you iterate a virtual region of a meta
texture and get mappings of primitive textures to sub-regions of that
virtual region. Internally we already have this kind of abstraction for
dealing with sliced texture, sub-textures and atlas textures in a
consistent way, so this will just make that abstraction public. The aim
here is to clarify that there is a difference between primitive textures
(CoglTexture2D/3D) and some of the other high-level textures, and also
enable developers to implement primitives that can support meta textures
since they can only be used with the cogl_rectangle API currently.

The thing that's not so clean-cut with this are the texture constructors
we have currently; such as cogl_texture_new_from_file which no longer
make sense when CoglTexture is considered to be an interface.  These
will basically just become convenient factory functions and it's just a
bit unusual that they are within the cogl_texture namespace.  It's worth
noting here that all the texture type APIs will also have their own type
specific constructors so these functions will only be used for the
convenience of being able to create a texture without really wanting to
know the details of what type of texture you need.  Longer term for 2.0
we may come up with replacement names for these factory functions or the
other thing we are considering is designing some asynchronous factory
functions instead since it's so often detrimental to application
performance to be blocked waiting for a texture to be uploaded to the
GPU.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-09-21 15:27:03 +01:00