parent
803665404e
commit
613aa8c579
|
@ -149,7 +149,7 @@ static std::shared_ptr<Pixmap> ReadPngIntoPixmap(png_struct *png_ptr, png_info *
|
|||
pixmap->data = std::vector<uint8_t>(pixmap->stride * pixmap->height);
|
||||
uint8_t **rows = png_get_rows(png_ptr, info_ptr);
|
||||
for(size_t y = 0; y < pixmap->height; y++) {
|
||||
uint8_t *srcRow = flip ? rows[y] : rows[pixmap->height - y - 1];
|
||||
uint8_t *srcRow = flip ? rows[pixmap->height - y - 1] : rows[y];
|
||||
memcpy(&pixmap->data[pixmap->stride * y], srcRow,
|
||||
pixmap->width * pixmap->GetBytesPerPixel());
|
||||
}
|
||||
|
@ -229,9 +229,9 @@ bool Pixmap::WritePng(FILE *f, bool flip) {
|
|||
std::vector<uint8_t *> rows;
|
||||
for(size_t y = 0; y < height; y++) {
|
||||
if(flip) {
|
||||
rows.push_back(&data[stride * y]);
|
||||
} else {
|
||||
rows.push_back(&data[stride * (height - y - 1)]);
|
||||
} else {
|
||||
rows.push_back(&data[stride * y]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ void TextWindow::ScreenBackgroundImage(int link, uint32_t v) {
|
|||
if(GetOpenFile(&bgImageFile, "", PngFileFilter)) {
|
||||
FILE *f = ssfopen(bgImageFile, "rb");
|
||||
if(f) {
|
||||
SS.bgImage.pixmap = Pixmap::ReadPng(f, /*flip=*/true);
|
||||
SS.bgImage.pixmap = Pixmap::ReadPng(f);
|
||||
SS.bgImage.scale = SS.GW.scale;
|
||||
SS.bgImage.origin = SS.GW.offset.ScaledBy(-1);
|
||||
fclose(f);
|
||||
|
|
Loading…
Reference in New Issue