Compare commits
5 Commits
cogl-1.22
...
cogl.windo
Author | SHA1 | Date |
---|---|---|
Chun-wei Fan | 4ecff75743 | |
Chun-wei Fan | 0e67927a50 | |
Chun-wei Fan | 11ce620d7f | |
Chun-wei Fan | 1247a92940 | |
Chun-wei Fan | 464ec64ac6 |
|
@ -62,19 +62,25 @@ COGL_BEGIN_DECLS
|
|||
typedef struct _CoglBitmaskImaginaryType *CoglBitmask;
|
||||
|
||||
/* These are internal helper macros */
|
||||
#if defined (G_OS_WIN32) && (GLIB_SIZEOF_VOID_P == 8)
|
||||
# define COGL_PTR_APPEND_SUFFIX(x) x##ULL
|
||||
#else
|
||||
# define COGL_PTR_APPEND_SUFFIX(x) x##UL
|
||||
#endif
|
||||
|
||||
#define _cogl_bitmask_to_number(bitmask) \
|
||||
((unsigned long) (*bitmask))
|
||||
((size_t) (*bitmask))
|
||||
#define _cogl_bitmask_to_bits(bitmask) \
|
||||
(_cogl_bitmask_to_number (bitmask) >> 1UL)
|
||||
(_cogl_bitmask_to_number (bitmask) >> COGL_PTR_APPEND_SUFFIX (1))
|
||||
/* The least significant bit is set to mark that no array has been
|
||||
allocated yet */
|
||||
#define _cogl_bitmask_from_bits(bits) \
|
||||
((void *) ((((unsigned long) (bits)) << 1UL) | 1UL))
|
||||
((void *) ((((size_t) (bits)) << COGL_PTR_APPEND_SUFFIX (1)) | COGL_PTR_APPEND_SUFFIX (1)))
|
||||
|
||||
/* Internal helper macro to determine whether this bitmask has a
|
||||
GArray allocated or whether the pointer is just used directly */
|
||||
#define _cogl_bitmask_has_array(bitmask) \
|
||||
(!(_cogl_bitmask_to_number (bitmask) & 1UL))
|
||||
(!(_cogl_bitmask_to_number (bitmask) & COGL_PTR_APPEND_SUFFIX (1)))
|
||||
|
||||
/* Number of bits we can use before needing to allocate an array */
|
||||
#define COGL_BITMASK_MAX_DIRECT_BITS (sizeof (unsigned long) * 8 - 1)
|
||||
|
@ -173,7 +179,7 @@ _cogl_bitmask_get (const CoglBitmask *bitmask, unsigned int bit_num)
|
|||
else if (bit_num >= COGL_BITMASK_MAX_DIRECT_BITS)
|
||||
return FALSE;
|
||||
else
|
||||
return !!(_cogl_bitmask_to_bits (bitmask) & (1UL << bit_num));
|
||||
return !!(_cogl_bitmask_to_bits (bitmask) & (COGL_PTR_APPEND_SUFFIX (1) << bit_num));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -192,10 +198,10 @@ _cogl_bitmask_set (CoglBitmask *bitmask, unsigned int bit_num, CoglBool value)
|
|||
_cogl_bitmask_set_in_array (bitmask, bit_num, value);
|
||||
else if (value)
|
||||
*bitmask = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (bitmask) |
|
||||
(1UL << bit_num));
|
||||
(COGL_PTR_APPEND_SUFFIX (1) << bit_num));
|
||||
else
|
||||
*bitmask = _cogl_bitmask_from_bits (_cogl_bitmask_to_bits (bitmask) &
|
||||
~(1UL << bit_num));
|
||||
~(COGL_PTR_APPEND_SUFFIX (1) << bit_num));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -304,7 +310,7 @@ _cogl_bitmask_popcount_upto (const CoglBitmask *bitmask,
|
|||
return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask));
|
||||
else
|
||||
return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask) &
|
||||
((1UL << upto) - 1));
|
||||
((COGL_PTR_APPEND_SUFFIX (1) << upto) - 1));
|
||||
}
|
||||
|
||||
COGL_END_DECLS
|
||||
|
|
|
@ -79,12 +79,13 @@ typedef enum {
|
|||
COGL_DEBUG_N_FLAGS
|
||||
} CoglDebugFlags;
|
||||
|
||||
extern GHashTable *_cogl_debug_instances;
|
||||
/* _cogl_debug_flags and _cogl_debug_instances currently needs to exported
|
||||
* outside of the shared library for cogl-pango and cogl-path. The special
|
||||
* COGL_EXPORT macro is needed to get this to work when building with MSVC.
|
||||
*/
|
||||
COGL_EXPORT extern GHashTable *_cogl_debug_instances;
|
||||
#define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
|
||||
|
||||
/* _cogl_debug_flags currently needs to exported outside of the shared
|
||||
library for cogl-pango. The special COGL_EXPORT macro is needed to
|
||||
get this to work when building with MSVC */
|
||||
COGL_EXPORT extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
|
||||
|
||||
#define COGL_DEBUG_ENABLED(flag) \
|
||||
|
|
11
cogl/cogl.c
11
cogl/cogl.c
|
@ -758,8 +758,17 @@ _cogl_init (void)
|
|||
if (initialized == FALSE)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
bindtextdomain (GETTEXT_PACKAGE, COGL_LOCALEDIR);
|
||||
char *localedir = NULL;
|
||||
#ifdef _WIN32
|
||||
char *basedir = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
localedir = g_build_filename (basedir, "share", "locale", NULL);
|
||||
g_free (basedir);
|
||||
#else
|
||||
localedir = g_strdup (COGL_LOCALEDIR);
|
||||
#endif
|
||||
bindtextdomain (GETTEXT_PACKAGE, localedir);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
g_free (localedir);
|
||||
#endif
|
||||
|
||||
#if defined(COGL_HAS_GTYPE_SUPPORT) && !GLIB_CHECK_VERSION (2, 36, 0)
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
#include "cogl-poll-private.h"
|
||||
#include "cogl-sdl.h"
|
||||
|
||||
#ifndef APIENTRY
|
||||
# define APIENTRY
|
||||
#endif
|
||||
|
||||
typedef struct _CoglContextSdl2
|
||||
{
|
||||
SDL_Window *current_window;
|
||||
|
@ -158,7 +162,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
|
|||
CoglError **error)
|
||||
{
|
||||
CoglDisplaySdl2 *sdl_display;
|
||||
const char * (* get_string_func) (GLenum name);
|
||||
const char * (APIENTRY * get_string_func) (GLenum name);
|
||||
const char *gl_version;
|
||||
|
||||
_COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
|
||||
|
|
|
@ -276,6 +276,7 @@ main (int argc, char **argv)
|
|||
while (1)
|
||||
{
|
||||
CoglPollFD *poll_fds;
|
||||
GPollFD gpoll_fds;
|
||||
int n_poll_fds;
|
||||
int64_t timeout;
|
||||
|
||||
|
@ -288,9 +289,18 @@ main (int argc, char **argv)
|
|||
cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx),
|
||||
&poll_fds, &n_poll_fds, &timeout);
|
||||
|
||||
g_poll ((GPollFD *) poll_fds, n_poll_fds,
|
||||
#if !defined G_OS_WIN32 || (GLIB_SIZEOF_VOID_P == 4)
|
||||
gpoll_fds.fd = (int) poll_fds->fd;
|
||||
#else
|
||||
gpoll_fds.fd = (int64_t) poll_fds->fd;
|
||||
#endif
|
||||
gpoll_fds.events = poll_fds->events;
|
||||
gpoll_fds.revents = poll_fds->revents;
|
||||
|
||||
g_poll (&gpoll_fds, n_poll_fds,
|
||||
timeout == -1 ? -1 : timeout / 1000);
|
||||
|
||||
|
||||
cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx),
|
||||
poll_fds, n_poll_fds);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue