~darkxst/ubuntu/raring/cogl/lp1163025

« back to all changes in this revision

Viewing changes to cogl/cogl-atlas-texture.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-03-13 19:11:11 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120313191111-3hgk529qkh9m6uk2
Tags: 1.9.8-0ubuntu1
* New upstream release (LP: #941617)
* Updated symbols & library name for soname update
* debian/control.in: Bump minimum glib to 2.28
* debian/patches/02_disable_armv5t_specific_optimization.patch: Disabled

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "config.h"
29
29
#endif
30
30
 
31
 
#include "cogl.h"
32
31
#include "cogl-debug.h"
33
32
#include "cogl-internal.h"
34
33
#include "cogl-util.h"
43
42
#include "cogl-journal-private.h"
44
43
#include "cogl-pipeline-opengl-private.h"
45
44
#include "cogl-atlas.h"
 
45
#include "cogl1-context.h"
 
46
#include "cogl-sub-texture.h"
46
47
 
47
48
#include <stdlib.h>
48
49
 
58
59
{
59
60
  /* Create a subtexture for the given rectangle not including the
60
61
     1-pixel border */
61
 
  return _cogl_sub_texture_new (full_texture,
62
 
                                rectangle->x + 1,
63
 
                                rectangle->y + 1,
64
 
                                rectangle->width - 2,
65
 
                                rectangle->height - 2);
 
62
  _COGL_GET_CONTEXT (ctx, NULL);
 
63
  return cogl_sub_texture_new (ctx,
 
64
                               full_texture,
 
65
                               rectangle->x + 1,
 
66
                               rectangle->y + 1,
 
67
                               rectangle->width - 2,
 
68
                               rectangle->height - 2);
66
69
}
67
70
 
68
71
static void
225
228
                                       float virtual_ty_1,
226
229
                                       float virtual_tx_2,
227
230
                                       float virtual_ty_2,
228
 
                                       CoglTextureSliceCallback callback,
 
231
                                       CoglMetaTextureCallback callback,
229
232
                                       void *user_data)
230
233
{
231
234
  CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
232
235
 
233
236
  /* Forward on to the sub texture */
234
 
  _cogl_texture_foreach_sub_texture_in_region (atlas_tex->sub_texture,
235
 
                                               virtual_tx_1,
236
 
                                               virtual_ty_1,
237
 
                                               virtual_tx_2,
238
 
                                               virtual_ty_2,
239
 
                                               callback,
240
 
                                               user_data);
 
237
  cogl_meta_texture_foreach_in_region (atlas_tex->sub_texture,
 
238
                                       virtual_tx_1,
 
239
                                       virtual_ty_1,
 
240
                                       virtual_tx_2,
 
241
                                       virtual_ty_2,
 
242
                                       COGL_PIPELINE_WRAP_MODE_REPEAT,
 
243
                                       COGL_PIPELINE_WRAP_MODE_REPEAT,
 
244
                                       callback,
 
245
                                       user_data);
241
246
}
242
247
 
243
248
static void
384
389
      /* Notify cogl-pipeline.c that the texture's underlying GL texture
385
390
       * storage is changing so it knows it may need to bind a new texture
386
391
       * if the CoglTexture is reused with the same texture unit. */
387
 
      _cogl_pipeline_texture_storage_change_notify (atlas_tex);
 
392
      _cogl_pipeline_texture_storage_change_notify (COGL_TEXTURE (atlas_tex));
388
393
 
389
394
      /* We need to unref the sub texture after doing the copy because
390
395
         the copy can involve rendering which might cause the texture
523
528
 
524
529
  override_bmp =
525
530
    _cogl_bitmap_new_shared (converted_bmp,
526
 
                             _cogl_bitmap_get_format (converted_bmp) &
 
531
                             cogl_bitmap_get_format (converted_bmp) &
527
532
                             ~COGL_PREMULT_BIT,
528
 
                             _cogl_bitmap_get_width (converted_bmp),
529
 
                             _cogl_bitmap_get_height (converted_bmp),
530
 
                             _cogl_bitmap_get_rowstride (converted_bmp));
 
533
                             cogl_bitmap_get_width (converted_bmp),
 
534
                             cogl_bitmap_get_height (converted_bmp),
 
535
                             cogl_bitmap_get_rowstride (converted_bmp));
531
536
 
532
537
  cogl_object_unref (converted_bmp);
533
538
 
657
662
 
658
663
  /* If we can't use FBOs then it will be too slow to migrate textures
659
664
     and we shouldn't use the atlas */
660
 
  if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
 
665
  if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
661
666
    return COGL_INVALID_HANDLE;
662
667
 
663
668
  COGL_NOTE (ATLAS, "Adding texture of size %ix%i", width, height);
732
737
 
733
738
  _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
734
739
 
735
 
  g_return_val_if_fail (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
 
740
  _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
736
741
 
737
 
  bmp_width = _cogl_bitmap_get_width (bmp);
738
 
  bmp_height = _cogl_bitmap_get_height (bmp);
739
 
  bmp_format = _cogl_bitmap_get_format (bmp);
 
742
  bmp_width = cogl_bitmap_get_width (bmp);
 
743
  bmp_height = cogl_bitmap_get_height (bmp);
 
744
  bmp_format = cogl_bitmap_get_format (bmp);
740
745
 
741
746
  internal_format = _cogl_texture_determine_internal_format (bmp_format,
742
747
                                                             internal_format);
805
810
    g_hook_destroy_link (&ctx->atlas_reorganize_callbacks, hook);
806
811
}
807
812
 
 
813
static CoglTextureType
 
814
_cogl_atlas_texture_get_type (CoglTexture *tex)
 
815
{
 
816
  return COGL_TEXTURE_TYPE_2D;
 
817
}
 
818
 
808
819
static const CoglTextureVtable
809
820
cogl_atlas_texture_vtable =
810
821
  {
825
836
    _cogl_atlas_texture_get_gl_format,
826
837
    _cogl_atlas_texture_get_width,
827
838
    _cogl_atlas_texture_get_height,
 
839
    _cogl_atlas_texture_get_type,
828
840
    NULL /* is_foreign */
829
841
  };