Skip to content

Commit

Permalink
Fixed #72
Browse files Browse the repository at this point in the history
  • Loading branch information
gecko0307 committed Jul 20, 2015
1 parent 3ebba8e commit 0a56bd1
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions dlib/image/image.d
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ abstract class SuperImage: Freeable
{
progress = 0.0f;
}

//mixin ManualModeImpl;
//mixin FreeImpl;
}

class Image(PixelFormat fmt): SuperImage
Expand Down Expand Up @@ -180,10 +177,11 @@ class Image(PixelFormat fmt): SuperImage

protected Color4 getPixel(int x, int y)
{
while(x >= width) x = width-1;
while(y >= height) y = height-1;
while(x < 0) x = 0;
while(y < 0) y = 0;
if (x >= width) x = width-1;
else if (x < 0) x = 0;

if (y >= height) y = height-1;
else if (y < 0) y = 0;

auto index = (y * _width + x) * _pixelSize;

Expand Down Expand Up @@ -242,10 +240,8 @@ class Image(PixelFormat fmt): SuperImage

protected Color4 setPixel(Color4 c, int x, int y)
{
while(x >= width) x = width-1;
while(y >= height) y = height-1;
while(x < 0) x = 0;
while(y < 0) y = 0;
if(x >= width || y >= height || x < 0 || y < 0)
return c;

size_t index = (y * _width + x) * _pixelSize;

Expand Down

0 comments on commit 0a56bd1

Please sign in to comment.