dont draw borders past the end of a texture
This commit is contained in:
parent
8d54452b77
commit
70fed8c962
1 changed files with 15 additions and 11 deletions
26
src/Image.cc
26
src/Image.cc
|
@ -822,6 +822,8 @@ void BImage::bevel2(void) {
|
|||
|
||||
|
||||
void BImage::border(const BTexture &texture) {
|
||||
if (width < 2 || height < 2) return;
|
||||
|
||||
register unsigned int i;
|
||||
int r = texture.borderColor().red(),
|
||||
g = texture.borderColor().green(),
|
||||
|
@ -839,17 +841,19 @@ void BImage::border(const BTexture &texture) {
|
|||
*pb++ = b;
|
||||
}
|
||||
|
||||
// left and right lines (pr,pg,pb are already lined up)
|
||||
for (i = 1; i < height - 1; ++i) {
|
||||
*pr = r;
|
||||
*pg = g;
|
||||
*pb = b;
|
||||
pr += width - 1;
|
||||
pg += width - 1;
|
||||
pb += width - 1;
|
||||
*pr++ = r;
|
||||
*pg++ = g;
|
||||
*pb++ = b;
|
||||
if (height > 2) {
|
||||
// left and right lines (pr,pg,pb are already lined up)
|
||||
for (i = 1; i < height - 1; ++i) {
|
||||
*pr = r;
|
||||
*pg = g;
|
||||
*pb = b;
|
||||
pr += width - 1;
|
||||
pg += width - 1;
|
||||
pb += width - 1;
|
||||
*pr++ = r;
|
||||
*pg++ = g;
|
||||
*pb++ = b;
|
||||
}
|
||||
}
|
||||
|
||||
// bottom line (pr,pg,pb are already lined up)
|
||||
|
|
Loading…
Reference in a new issue