46 public: |
46 public: |
47 Pixmap(): data(NULL), w(0), h(0), refdata(true) {}; |
47 Pixmap(): data(NULL), w(0), h(0), refdata(true) {}; |
48 Pixmap(Float *afdata, int aw, int ah): |
48 Pixmap(Float *afdata, int aw, int ah): |
49 fdata(afdata), w(aw), h(ah), refdata(true) {}; |
49 fdata(afdata), w(aw), h(ah), refdata(true) {}; |
50 Pixmap(int aw, int ah): |
50 Pixmap(int aw, int ah): |
51 data(new Colour[aw*ah]), w(aw), h(ah), refdata(false) {}; |
51 w(aw), h(ah), refdata(false) |
52 virtual ~Pixmap() { if (!refdata) delete[] data; }; |
52 { |
|
53 #ifdef NO_SIMD |
|
54 data = new Colour[aw*ah]; |
|
55 #else |
|
56 data = (Colour*)_mm_malloc(aw*ah*sizeof(Colour), 16); |
|
57 #endif |
|
58 }; |
|
59 virtual ~Pixmap() |
|
60 { |
|
61 #ifdef NO_SIMD |
|
62 if (!refdata) delete[] data; |
|
63 #else |
|
64 if (!refdata) _mm_free(data); |
|
65 #endif |
|
66 }; |
53 |
67 |
54 void setData(Float *afdata, int aw, int ah) |
68 void setData(Float *afdata, int aw, int ah) |
55 { fdata = afdata; w = aw; h = ah; }; |
69 { fdata = afdata; w = aw; h = ah; }; |
56 Colour get(int x, int y) { return data[y*w + x]; }; |
70 Colour get(int x, int y) { return data[y*w + x]; }; |
57 const int &getWidth() const { return w; }; |
71 const int &getWidth() const { return w; }; |