Skip to content

Commit 2baf38c

Browse files
authored
Fixed Image::GetPixel parameters (#76, fixes #68)
1 parent 67a2531 commit 2baf38c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Source/Image.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,23 @@ Color Image::GetPixel (uint16 x, uint16 y) const
172172

173173
////////////////////////////////////////////////////////////////////////////////
174174

175-
void Image::SetPixel (const Point& point, Color c)
175+
void Image::SetPixel (const Point& point,
176+
const Color& color)
176177
{
177-
return SetPixel (point.X, point.Y, c);
178+
return SetPixel (point.X, point.Y, color);
178179
}
179180

180181
////////////////////////////////////////////////////////////////////////////////
181182

182-
void Image::SetPixel (uint16 x, uint16 y, Color c)
183+
void Image::SetPixel (uint16 x, uint16 y,
184+
const Color& color)
183185
{
184186
// Perform simple boundary check
185187
if (x >= mWidth || y >= mHeight)
186188
return;
187189

188-
// Set color at the specified coordinate
189-
((Color*) mData) [x + (y * mWidth)] = c;
190+
// Set the color at the specified coordinate
191+
((Color*) mData) [x + (y * mWidth)] = color;
190192
}
191193

192194
////////////////////////////////////////////////////////////////////////////////

Source/Image.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ class ROBOT_EXPORT Image
5555
Color GetPixel (const Point& point) const;
5656
Color GetPixel (uint16 x, uint16 y) const;
5757

58-
void SetPixel (const Point& point, Color c);
59-
void SetPixel (uint16 x, uint16 y, Color c);
58+
void SetPixel (const Point& point,
59+
const Color& color);
60+
void SetPixel (uint16 x, uint16 y,
61+
const Color& color);
6062

6163
bool Fill (const Color& color);
6264
bool Fill (uint8 r, uint8 g,

0 commit comments

Comments
 (0)