Mercurial > love-experiments
diff src/modules/image/ImageData.cpp @ 1436:59f5284fe9eb
Merged mage-CompressedData into default
| author | Alex Szpakowski <slime73@gmail.com> |
|---|---|
| date | Tue, 09 Apr 2013 23:44:00 -0300 |
| parents | 3242694a254e 377f9dad7a2d |
| children |
line wrap: on
line diff
--- a/src/modules/image/ImageData.cpp Tue Apr 09 18:12:03 2013 -0300 +++ b/src/modules/image/ImageData.cpp Tue Apr 09 23:44:00 2013 -0300 @@ -20,8 +20,6 @@ #include "ImageData.h" -#include <stdio.h> - using love::thread::Lock; namespace love @@ -30,6 +28,7 @@ { ImageData::ImageData() + : data(0) { mutex = thread::newMutex(); } @@ -39,14 +38,19 @@ delete mutex; } +int ImageData::getSize() const +{ + return getWidth()*getHeight()*sizeof(pixel); +} + void *ImageData::getData() const { return data; } -int ImageData::getSize() const +bool ImageData::inside(int x, int y) const { - return getWidth()*getHeight()*sizeof(pixel); + return x >= 0 && x < getWidth() && y >= 0 && y < getHeight(); } int ImageData::getWidth() const @@ -59,11 +63,6 @@ return height; } -bool ImageData::inside(int x, int y) const -{ - return x >= 0 && x < getWidth() && y >= 0 && y < getHeight(); -} - void ImageData::setPixel(int x, int y, pixel c) { if (!inside(x, y))
