Last change
on this file since 2798 was
2798,
checked in by ldelgass, 12 years ago
|
Add emacs mode magic line in preparation for indentation cleanup
|
-
Property svn:eol-style set to
native
|
File size:
975 bytes
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #include "Image.h" |
---|
3 | #include <memory.h> |
---|
4 | #include <stdlib.h> |
---|
5 | |
---|
6 | Image::Image(const unsigned int width, const unsigned int height, |
---|
7 | const ImageFormat format, const Image::DataType type, void* data ) : |
---|
8 | _width(width), |
---|
9 | _height(height), |
---|
10 | _format(format), |
---|
11 | _dataType(type) |
---|
12 | { |
---|
13 | switch (type) |
---|
14 | { |
---|
15 | case IMG_UNSIGNED_BYTE : |
---|
16 | _dataTypeByteSize = 1; |
---|
17 | break; |
---|
18 | case IMG_FLOAT : |
---|
19 | _dataTypeByteSize = 4; |
---|
20 | break; |
---|
21 | } |
---|
22 | |
---|
23 | //_dataBuffer = aligned_malloc(width * height * comp * _dataTypeByteSize, 16); |
---|
24 | _dataBuffer = malloc(width * height * format * _dataTypeByteSize); |
---|
25 | |
---|
26 | if (data != 0) |
---|
27 | { |
---|
28 | memcpy(_dataBuffer, data, width *height * format * _dataTypeByteSize); |
---|
29 | } |
---|
30 | else |
---|
31 | { |
---|
32 | memset(_dataBuffer, 0, width * height * format * _dataTypeByteSize); |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | Image::~Image() |
---|
38 | { |
---|
39 | //aligend_free(_dataBuffer); |
---|
40 | free(_dataBuffer); |
---|
41 | } |
---|
42 | |
---|
Note: See
TracBrowser
for help on using the repository browser.