~noskcaj/ubuntu/trusty/cogl/1.16.2

« back to all changes in this revision

Viewing changes to cogl/cogl-attribute-buffer.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha, Jeremy Bicha, Rico Tzschichholz
  • Date: 2013-02-26 16:43:25 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130226164325-t4z9rylpa20v0p6q
Tags: 1.13.4-0ubuntu1
[ Jeremy Bicha ]
* New upstream release
  - soname bump
* debian/control.in:
  - Bump minimum glib to 2.32
  - Drop obsolete breaks/replaces
  - Bump libclutter-1.0-dev breaks for soname transition
* debian/libcogl-dev.install:
  - Add some missing files

[ Rico Tzschichholz ]
* debian/control.in:
  - Build-depend on libxrandr-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
COGL_BUFFER_DEFINE (AttributeBuffer, attribute_buffer);
40
40
 
41
41
CoglAttributeBuffer *
42
 
cogl_attribute_buffer_new (CoglContext *context,
43
 
                           size_t bytes,
44
 
                           const void *data)
 
42
cogl_attribute_buffer_new_with_size (CoglContext *context,
 
43
                                     size_t bytes)
45
44
{
46
 
  CoglAttributeBuffer *array = g_slice_new (CoglAttributeBuffer);
47
 
  CoglBool use_malloc;
48
 
 
49
 
  if (!(context->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS))
50
 
    use_malloc = TRUE;
51
 
  else
52
 
    use_malloc = FALSE;
 
45
  CoglAttributeBuffer *buffer = g_slice_new (CoglAttributeBuffer);
53
46
 
54
47
  /* parent's constructor */
55
 
  _cogl_buffer_initialize (COGL_BUFFER (array),
 
48
  _cogl_buffer_initialize (COGL_BUFFER (buffer),
56
49
                           context,
57
50
                           bytes,
58
 
                           use_malloc,
59
51
                           COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER,
60
52
                           COGL_BUFFER_USAGE_HINT_ATTRIBUTE_BUFFER,
61
53
                           COGL_BUFFER_UPDATE_HINT_STATIC);
62
54
 
63
 
  _cogl_attribute_buffer_object_new (array);
64
 
 
 
55
  return _cogl_attribute_buffer_object_new (buffer);
 
56
}
 
57
 
 
58
CoglAttributeBuffer *
 
59
cogl_attribute_buffer_new (CoglContext *context,
 
60
                           size_t bytes,
 
61
                           const void *data)
 
62
{
 
63
  CoglAttributeBuffer *buffer;
 
64
 
 
65
  buffer = cogl_attribute_buffer_new_with_size (context, bytes);
 
66
 
 
67
  /* Note: to keep the common cases simple this API doesn't throw
 
68
   * CoglErrors, so developers can assume this function never returns
 
69
   * NULL and we will simply abort on error.
 
70
   *
 
71
   * Developers wanting to catch errors can use
 
72
   * cogl_attribute_buffer_new_with_size() and catch errors when later
 
73
   * calling cogl_buffer_set_data() or cogl_buffer_map().
 
74
   */
 
75
 
 
76
  /* XXX: NB: for Cogl 2.0 we don't allow NULL data here but we can't
 
77
   * break the api for 1.x and so we keep the check for now. */
65
78
  if (data)
66
 
    cogl_buffer_set_data (COGL_BUFFER (array),
67
 
                          0,
68
 
                          data,
69
 
                          bytes);
70
 
  return array;
 
79
    _cogl_buffer_set_data (COGL_BUFFER (buffer),
 
80
                           0,
 
81
                           data,
 
82
                           bytes,
 
83
                           NULL);
 
84
 
 
85
  return buffer;
71
86
}
72
87
 
73
88
static void