From 9f1e7ebf9da6491b53a3833ecda67ca4fe912468 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Sun, 3 Jul 2011 13:55:40 +0300 Subject: [PATCH] Final lodepng reader fix --- coding/lodepng_io.hpp | 16 ++++++++-------- yg/texture.hpp | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/coding/lodepng_io.hpp b/coding/lodepng_io.hpp index 8c0e398783..6211fbad08 100644 --- a/coding/lodepng_io.hpp +++ b/coding/lodepng_io.hpp @@ -120,24 +120,24 @@ inline void lodepng_read_and_convert_view(const char* filename,const View& view, /// \brief Loads the image specified by the given png image file name and color-converts it into the given view. /// Throws std::ios_base::failure if the file is not a valid PNG file, or if its dimensions don't match the ones of the view. template -inline void lodepng_read_and_convert_view(const char* filename,const View& view) { - detail::lodepng_reader_color_convert m(filename,default_color_converter()); +inline void lodepng_read_and_convert_view(ReaderPtr & reader,const View& view) { + detail::lodepng_reader_color_convert m(reader,default_color_converter()); m.apply(view); } /// \ingroup LODEPNG_IO /// \brief Loads the image specified by the given png image file name and color-converts it into the given view. template -inline void lodepng_read_and_convert_view(const std::string& filename,const View& view,CC cc) { - lodepng_read_and_convert_view(filename.c_str(),view,cc); +inline void lodepng_read_and_convert_view(ReaderPtr & reader,const View& view,CC cc) { + lodepng_read_and_convert_view(reader,view,cc); } /// \ingroup LODEPNG_IO /// \brief Loads the image specified by the given png image file name and color-converts it into the given view. -template -inline void lodepng_read_and_convert_view(const std::string& filename,const View& view) { - lodepng_read_and_convert_view(filename.c_str(),view); -} +//template +//inline void lodepng_read_and_convert_view(ReaderPtr & reader,const View& view) { +// lodepng_read_and_convert_view(reader,view); +//} /// \ingroup LODEPNG_IO /// \brief Allocates a new image whose dimensions are determined by the given png image file, loads and color-converts the pixels into it. diff --git a/yg/texture.hpp b/yg/texture.hpp index 0beb336f0d..4c9bed7df2 100644 --- a/yg/texture.hpp +++ b/yg/texture.hpp @@ -176,7 +176,8 @@ namespace yg { lock(); view_t v = view(width(), height()); - gil::lodepng_read_and_convert_view(GetPlatform().ReadPathForFile(fileName).c_str(), v, typename Traits::color_converter()); + ReaderPtr reader = GetPlatform().GetReader(fileName); + gil::lodepng_read_and_convert_view(reader, v, typename Traits::color_converter()); upload(&v(0, 0)); unlock(); }