Skip to content

Commit

Permalink
LibGfx: Add PPM image file type support
Browse files Browse the repository at this point in the history
  • Loading branch information
asliturk authored and awesomekling committed Jun 22, 2020
1 parent 97aca8f commit 326032b
Show file tree
Hide file tree
Showing 6 changed files with 553 additions and 1 deletion.
1 change: 1 addition & 0 deletions Libraries/LibGfx/Bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <LibGfx/GIFLoader.h>
#include <LibGfx/PBMLoader.h>
#include <LibGfx/PNGLoader.h>
#include <LibGfx/PPMLoader.h>
#include <LibGfx/ICOLoader.h>
#include <LibGfx/ShareableBitmap.h>
#include <fcntl.h>
Expand Down
1 change: 1 addition & 0 deletions Libraries/LibGfx/Bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define ENUMERATE_IMAGE_FORMATS \
__ENUMERATE_IMAGE_FORMAT(pbm, ".pbm") \
__ENUMERATE_IMAGE_FORMAT(png, ".png") \
__ENUMERATE_IMAGE_FORMAT(ppm, ".ppm") \
__ENUMERATE_IMAGE_FORMAT(gif, ".gif") \
__ENUMERATE_IMAGE_FORMAT(bmp, ".bmp") \
__ENUMERATE_IMAGE_FORMAT(ico, ".ico")
Expand Down
1 change: 1 addition & 0 deletions Libraries/LibGfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(SOURCES
Path.cpp
PBMLoader.cpp
PNGLoader.cpp
PPMLoader.cpp
Point.cpp
Rect.cpp
ShareableBitmap.cpp
Expand Down
7 changes: 6 additions & 1 deletion Libraries/LibGfx/ImageDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <LibGfx/ImageDecoder.h>
#include <LibGfx/BMPLoader.h>
#include <LibGfx/GIFLoader.h>
#include <LibGfx/ICOLoader.h>
#include <LibGfx/ImageDecoder.h>
#include <LibGfx/PBMLoader.h>
#include <LibGfx/PNGLoader.h>
#include <LibGfx/PPMLoader.h>

namespace Gfx {

Expand All @@ -51,6 +52,10 @@ ImageDecoder::ImageDecoder(const u8* data, size_t size)
if (m_plugin->sniff())
return;

m_plugin = make<PPMImageDecoderPlugin>(data, size);
if (m_plugin->sniff())
return;

m_plugin = make<ICOImageDecoderPlugin>(data, size);
if (m_plugin->sniff())
return;
Expand Down
Loading

0 comments on commit 326032b

Please sign in to comment.