GLImageData.m 515 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1

2 3 4
#import "GLImageData.h"

// TODO: rename to GLImageData
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
5 6

// This structure aims to be used in an immutable way
7
@implementation GLImageData
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
{
  GLubyte *_data;
  int _width;
  int _height;
}

- (instancetype)initWithData: (GLubyte *)data withWidth:(int)width withHeight:(int)height
{
  self = [super init];
  if (self) {
    _data = data;
    _width = width;
    _height = height;
  }
  return self;
}

- (void)dealloc
{
  if (_data) {
    free(_data);
    _data = nil;
    _width = 0;
    _height = 0;
  }
}

@end