mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-27 21:26:09 +00:00
Start adding jpeg hooks
This commit is contained in:
parent
7b79975516
commit
f86d4d400d
@ -29,6 +29,7 @@
|
||||
#ifdef HAVE_RPNG
|
||||
#include <formats/rpng.h>
|
||||
#endif
|
||||
#include <formats/rjpeg.h>
|
||||
#include <formats/tga.h>
|
||||
|
||||
#include "../general.h"
|
||||
@ -37,7 +38,8 @@ enum video_image_format
|
||||
{
|
||||
IMAGE_FORMAT_NONE = 0,
|
||||
IMAGE_FORMAT_TGA,
|
||||
IMAGE_FORMAT_PNG
|
||||
IMAGE_FORMAT_PNG,
|
||||
IMAGE_FORMAT_JPEG
|
||||
};
|
||||
|
||||
bool video_texture_image_set_color_shifts(
|
||||
@ -225,6 +227,8 @@ static enum video_image_format video_texture_image_get_type(const char *path)
|
||||
return IMAGE_FORMAT_TGA;
|
||||
if (strstr(path, ".png"))
|
||||
return IMAGE_FORMAT_PNG;
|
||||
if (strstr(path, ".jpg") || strstr(path, ".jpeg"))
|
||||
return IMAGE_FORMAT_JPEG;
|
||||
return IMAGE_FORMAT_NONE;
|
||||
}
|
||||
|
||||
@ -273,6 +277,10 @@ bool video_texture_image_load(struct texture_image *out_img,
|
||||
goto success;
|
||||
#endif
|
||||
break;
|
||||
case IMAGE_FORMAT_JPEG:
|
||||
if (rjpeg_image_load(ptr, out_img, file_len))
|
||||
goto success;
|
||||
break;
|
||||
default:
|
||||
case IMAGE_FORMAT_NONE:
|
||||
break;
|
||||
|
@ -867,4 +867,3 @@ error:
|
||||
rjpeg_free(rjpg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
40
libretro-common/include/formats/rjpeg.h
Normal file
40
libretro-common/include/formats/rjpeg.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 2010-2015 The RetroArch team
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (rjpeg.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_FORMAT_RJPEG_H__
|
||||
#define __LIBRETRO_SDK_FORMAT_RJPEG_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
bool rjpeg_image_load(uint8_t *buf, void *data, size_t size);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user