Add screenshot to image history list too

This commit is contained in:
twinaphex 2016-07-31 01:20:00 +02:00
parent 5a83139e15
commit 8dfa393e05
3 changed files with 26 additions and 5 deletions

View File

@ -793,13 +793,14 @@ static void check_default_dirs(void)
check_defaults_dir_create_dir(g_defaults.dir.thumbnails); check_defaults_dir_create_dir(g_defaults.dir.thumbnails);
} }
static bool content_push_to_history_playlist( bool content_push_to_history_playlist(
playlist_t *playlist, void *data,
const char *path, const char *path,
const char *core_name, const char *core_name,
const char *core_path) const char *core_path)
{ {
settings_t *settings = config_get_ptr(); playlist_t *playlist = (playlist_t*)data;
settings_t *settings = config_get_ptr();
/* If the history list is not enabled, early return. */ /* If the history list is not enabled, early return. */
if (!settings->history_list_enable) if (!settings->history_list_enable)

View File

@ -44,16 +44,20 @@
#define IMG_EXT "bmp" #define IMG_EXT "bmp"
#endif #endif
#include "../defaults.h"
#include "../general.h" #include "../general.h"
#include "../msg_hash.h" #include "../msg_hash.h"
#include "../gfx/video_driver.h" #include "../gfx/video_driver.h"
#include "../gfx/video_frame.h" #include "../gfx/video_frame.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
#include "tasks_internal.h"
/* Take frame bottom-up. */ /* Take frame bottom-up. */
static bool screenshot_dump( static bool screenshot_dump(
const char *global_name_base, const char *global_name_base,
@ -130,6 +134,13 @@ static bool screenshot_dump(
bmp_type); bmp_type);
#endif #endif
if (ret == true)
{
if (content_push_to_history_playlist(g_defaults.image_history, filename,
"imageviewer", "builtin"))
playlist_write_file(g_defaults.image_history);
}
return ret; return ret;
} }
@ -197,9 +208,12 @@ static bool take_screenshot_raw(const char *global_name_base)
/* Negative pitch is needed as screenshot takes bottom-up, /* Negative pitch is needed as screenshot takes bottom-up,
* but we use top-down. * but we use top-down.
*/ */
return screenshot_dump(global_name_base, screenshot_dir, if (!screenshot_dump(global_name_base, screenshot_dir,
(const uint8_t*)data + (height - 1) * pitch, (const uint8_t*)data + (height - 1) * pitch,
width, height, -pitch, false); width, height, -pitch, false))
return false;
return true;
} }
static bool take_screenshot_choice(const char *global_name_base) static bool take_screenshot_choice(const char *global_name_base)

View File

@ -137,6 +137,12 @@ void task_image_load_free(retro_task_t *task);
void task_file_load_handler(retro_task_t *task); void task_file_load_handler(retro_task_t *task);
bool content_push_to_history_playlist(
void *data,
const char *path,
const char *core_name,
const char *core_path);
/* TODO/FIXME - turn this into actual task */ /* TODO/FIXME - turn this into actual task */
bool take_screenshot(void); bool take_screenshot(void);
bool dump_to_file_desperate(const void *data, bool dump_to_file_desperate(const void *data,