summaryrefslogtreecommitdiff
path: root/cogl-pango
Commit message (Collapse)AuthorAgeFilesLines
* cogl-pango-pipeline-cache.c: Include forgotten headerChun-wei Fan2014-03-201-0/+1
| | | | | | | | | 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> (cherry picked from commit bb10532f4b11cba169ace6d9e26543fe6f70ad8f)
* This re-licenses Cogl under the MIT licenseRobert Bragg2014-01-1410-132/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on the proposal that was sent to the Cogl mailing list to re-license from the LGPL to the MIT license: 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.
* remove internal_format and redundant error argumentsRobert Bragg2014-01-011-5/+2
| | | | | | | | | | | | | | | | 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>
* texture: make cogl_texture_get_format api privateRobert Bragg2014-01-012-2/+2
| | | | | | | | | | | 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>
* Use COGL_FLAGS_* for the context's private feature flagsNeil Roberts2013-11-281-1/+1
| | | | | | | | | | | | | | | | 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>
* Declare interface types as void and remove cast macrosRobert Bragg2013-11-276-5/+17
| | | | | | | | | | | | | | | | | | 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.
* Add _primitive_draw to replace _framebuffer_draw_primitiveRobert Bragg2013-07-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Expose CoglAtlasTexture apiRobert Bragg2013-07-111-6/+5
| | | | | | | | | | | | | | | | | | | 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>
* Separate out CoglPath api into sub-libraryRobert Bragg2013-06-124-54/+31
| | | | | | | | | | | | | | | | | | | | | | | 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>
* cogl-pango: Add a missing backslash in the MakefileNeil Roberts2013-02-201-1/+1
| | | | | | | | 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>
* build: update to build with automake 1.13Robert Bragg2013-01-211-2/+2
| | | | | | | | | | 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>
* Allow lazy texture storage allocationRobert Bragg2013-01-021-2/+7
| | | | | | | | | | | | | | | | | | | 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>
* texture: expose mipmap level in set region apisRobert Bragg2012-11-271-8/+5
| | | | | | | | | | | | | | | cogl_texture_set_region() and cogl_texture_set_region_from_bitmap() now have a level argument so image data can be uploaded to a specific mipmap level. The prototype for cogl_texture_set_region was also updated to simplify the arguments. The arguments for cogl_texture_set_region_from_bitmap were reordered to be consistent with cogl_texture_set_region with the source related arguments listed first followed by the destination arguments. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* atlas-texture: remove some use of _COGL_GET_CONTEXTRobert Bragg2012-11-273-8/+23
| | | | | | | | | 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>
* Allow propogation of OOM errors to appsRobert Bragg2012-11-262-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fixes for --disable-glibNeil Roberts2012-11-265-10/+10
| | | | | | | | | | | | | | | | | | | | | | 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>
* Remove the last mentions of the cogl_rectangle*() drawing APIDamien Lespiau2012-10-221-2/+2
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Add a GL 3 driverNeil Roberts2012-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Don't take internal references on the contextRobert Bragg2012-09-103-10/+3
| | | | | | | | | | | | | | | | | | | | | | | We want applications to fully control the lifetime of a CoglContext without having to worry that internal resources (such as the default 2d,3d and rectangle textures, or any caches we maintain) could result in circular references that keep the context alive. We also want to avoid making CoglContext into a special kind of object that isn't ref-counted or that can't be used with object apis such as cogl_object_set_user_data. Being able to reliably destroy the context is important on platforms such as Android where you may be required bring-up and tear-down a CoglContext numerous times throughout the applications lifetime. A dissadvantage of this policy is that it is now possible to leave other object such as framebuffers in an inconsistent state if the context is unreferenced and destroyed. The documentation states that all objects that directly or indirectly depend on a context that has been destroyed will be left in an inconsistent state and must not be accessed thereafter. Applications (such as Android applications) that need to cleanly destroy and re-create Cogl resources should make sure to manually unref these dependant objects before destroying the context. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Mass rename CLUTTER_COMPILATION to COGL_COMPILATIONTomeu Vizoso2012-06-201-1/+1
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-pango-fontmap: Use the right unref function for the rendererNeil Roberts2012-06-201-1/+1
| | | | | | | The renderer was being unrefed with cogl_object_unref but it's actually a GObject. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix a typo in the Requires: of cogl-pango2.pcDamien Lespiau2012-06-131-1/+1
| | | | | | | You need to get the COGL_PANGO_PKG_REQUIRES in there, not the cogl ones. pangocairo was missing in the list of requires because of that. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-pango: Updates to no longer require a default contextRobert Bragg2012-05-178-327/+465
| | | | | | | | | | | | | | | 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>
* Fix Visual C++ buildChun-wei Fan2012-05-151-6/+6
| | | | | | | | | | | | | | | | | -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>
* introspection: Fix the names of the pkg-config filesNeil Roberts2012-04-251-1/+1
| | | | | | | The dependent pkg-config files passed as an argument to the scanner when generating the IR file had the wrong names which meant that the scanner would fail on any projects using introspection which depend on Cogl.
* cogl-pango: Fix the name of the cogl-pango library in the pc fileNeil Roberts2012-04-231-1/+1
| | | | | | | | The pc file for cogl-pango was missing a '-' in the name of the library passed in the linker option so any applications trying to use it would not link. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Replace cogl_path_{stroke,fill} with framebuffer APINeil Roberts2012-04-181-1/+2
| | | | | | | | | 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>
* Switch use of primitive glib types to c99 equivalentsRobert Bragg2012-04-189-36/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Removes all remaining use of CoglHandleRobert Bragg2012-04-183-7/+7
| | | | | | | | | | | | 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>
* Add a context member to CoglPathNeil Roberts2012-04-161-1/+3
| | | | | | | 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>
* Start building parallel installable 2.0 api onlyRobert Bragg2012-04-163-41/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | Since we are getting towards a complete Cogl 2.0 api this breaks 1.x api compatibility by no longer building a libcogl.so and instead building a libcogl2.so library. The headers are now installed into an include/cogl2 sub-directory that wont conflict with an installed cogl 1.x package. The cogl-2.0-experimental.pc pkg-config file is now named cogl2.pc and similarly the reference manual has been renamed from cogl-2.0-experimental to cogl2. The examples have not been namespaced and so they are not parallel installable. Since we haven't yet reached the 2.0 api yet the version has been bumped to 1.99.1 All of the conformance tests have been updated so they no longer test the 1.x apis, and since I was going through all the tests I took the opportunity to rename the global ctx and fb variables to test_ctx and test_fb. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-glyph-cache: fix use of uninitialised value.Dave Airlie2012-03-131-0/+2
| | | | | | | | | | 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>
* Add -Wmissing-declarations to maintainer flags and fix problemsNeil Roberts2012-03-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Adds a context arg to cogl_pipeline_new()Robert Bragg2012-02-211-2/+8
| | | | | | | | | 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>
* pango: don't pass COGL_MATERIAL enums to pipeline apiRobert Bragg2012-02-201-1/+1
| | | | | | | | | 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>
* Ensure that the CoglPango GIR is built against the correct libcoglEmmanuele Bassi2012-02-151-1/+1
| | | | | | | 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>
* buffer: explicitly relate buffers to a contextRobert Bragg2012-02-091-2/+3
| | | | | | | | 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>
* framebuffer: Add cogl_framebuffer draw methodsRobert Bragg2012-02-091-1/+3
| | | | | | | | | | | | | | | | | | | | | 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>
* Bug 664827: Autotools changes for Windows .rc filesChun-wei Fan2011-12-151-2/+2
| | | | | This will make autotools fill in the versioning info for the COGL/ COGL-Pango .rc files and distribute the resulting .rc files
* Add Windows Resource Files templatesChun-wei Fan2011-12-151-0/+30
| | | | | | 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.
* VS 2008/2010 project files to build CoglChun-wei Fan2011-11-252-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* cogl-flags: Add some macros to help iterate the bitsNeil Roberts2011-11-161-0/+1
| | | | | | | | | | | 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>
* primitive: Add n_indices arg to _set_indices functionRobert Bragg2011-11-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | 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>
* meta-texture: This publicly exposes CoglMetaTextureRobert Bragg2011-11-011-7/+9
| | | | | | | | | | | | | | | | | 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>
* Add an option to avoid defining G_DISABLE_DEPRECATEDNeil Roberts2011-09-271-1/+0
| | | | | | | | | | | | 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>
* cogl-pipeline/cogl-pango: Added forgotten includesChun-wei Fan2011-09-261-0/+1
| | | | | | | | | 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>
* Add a strong CoglTexture type to replace CoglHandleRobert Bragg2011-09-216-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* build: only have libcogl-pango depend on pangoRobert Bragg2011-08-122-4/+4
| | | | | | | | Only cogl-pango needs a dependency on pangocairo so we are now careful to separate the pangocairo pkg-config flags from the others so we can avoid having libcogl builds refer to them. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-pango-display-list: Use cogl_rectangles_with_texture_coordsNeil Roberts2011-08-111-54/+96
| | | | | | | | | | | | | | | | | Instead of storing four vertices per rectangle in the array for a texture node in the display list, it now only stores two in a format that is acceptable to cogl_rectangles_with_texture_coords. That way it can pass the array directly to that function. That function has the advantage over cogl_rectangle that it doesn't need to validate the pipeline for every quad so it should be slightly faster. When the texture node is being rendered with a CoglPrimitive we now map the buffer and expand the rectangles into 4 vertices as the data is copied. https://bugzilla.gnome.org/show_bug.cgi?id=656303 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-pango-display-list: Use CoglPrimitive instead of CoglVertexBufferNeil Roberts2011-08-111-67/+74
| | | | | | | | | | | When rendering text through a VBO, CoglPangoDisplayList now uses the CoglPrimitive API instead of CoglVertexBuffer. CoglVertexBuffer is just a layer on top of the attribute buffer API anyway so it should be slightly faster. https://bugzilla.gnome.org/show_bug.cgi?id=656303 Reviewed-by: Robert Bragg <robert@linux.intel.com>