GUI: Use Common::FSNode for reading files.

This commit is contained in:
av-dx 2021-05-30 04:08:07 +05:30 committed by Eugene Sandulenko
parent 059deb0e50
commit 2f2c1dae94

View file

@ -39,8 +39,6 @@
#include "image/bmp.h" #include "image/bmp.h"
#include "image/png.h" #include "image/png.h"
#include "backends/fs/posix/posix-fs.h"
namespace GUI { namespace GUI {
Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip) Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip)
@ -1099,8 +1097,8 @@ Graphics::ManagedSurface *loadSurfaceFromFile(Common::String &name) {
if (name.hasSuffix(".png")) { if (name.hasSuffix(".png")) {
#ifdef USE_PNG #ifdef USE_PNG
Image::PNGDecoder decoder; Image::PNGDecoder decoder;
POSIXFilesystemNode posixfs(name); Common::FSNode fileNode(name);
Common::SeekableReadStream * stream = posixfs.createReadStream(); Common::SeekableReadStream * stream = fileNode.createReadStream();
if (stream) { if (stream) {
if (!decoder.loadStream(*stream)) if (!decoder.loadStream(*stream))
warning("Error decoding PNG"); warning("Error decoding PNG");
@ -1151,7 +1149,7 @@ void GridWidget::gridFromGameList(Common::Array<LauncherEntry> *list) {
reloadThumbnails(); reloadThumbnails();
Common::HashMap<Common::String, EntryContainerWidget *> entryById; Common::HashMap<Common::String, EntryContainerWidget *> entryById;
int row = 0, col = 0; int row = 0, col = 0;
int entriesPerRow = 3; int entriesPerRow = 6;
int k = 0; int k = 0;
for (Common::Array<LauncherEntry>::iterator i = list->begin(); i != list->end(); ++i) { for (Common::Array<LauncherEntry>::iterator i = list->begin(); i != list->end(); ++i) {
k = row * entriesPerRow + col; k = row * entriesPerRow + col;