mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-26 13:20:05 +03:00
Fix length/width/height bugs in Pixmap
This commit is contained in:
parent
0d76beb550
commit
8f6f14dcfc
1 changed files with 4 additions and 2 deletions
|
@ -244,7 +244,7 @@ struct Pixmap {
|
|||
|
||||
/// ditto
|
||||
void size(int totalPixels, int width)
|
||||
in (length % width == 0) {
|
||||
in (totalPixels % width == 0) {
|
||||
data.length = totalPixels;
|
||||
this.width = width;
|
||||
}
|
||||
|
@ -253,8 +253,10 @@ struct Pixmap {
|
|||
|
||||
/// Height of the buffer, i.e. the number of lines
|
||||
int height() inout {
|
||||
if (data.length == 0)
|
||||
if (width == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return typeCast!int(data.length / width);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue