winport - fix screenshot, aviout bugs due to 888 colorspace change
This commit is contained in:
parent
918f45e7a4
commit
18f02cb7d3
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2008-2015 DeSmuME team
|
||||
Copyright (C) 2008-2017 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -56,8 +56,14 @@ int NDS_WriteBMP_15bpp(int width, int height, const u16 *data, const char *filen
|
|||
return ok?1:0;
|
||||
}
|
||||
|
||||
int NDS_WritePNG_32bppBuffer(int width, int height, const void* buf, const char *filename)
|
||||
{
|
||||
bool ok = rpng_save_image_argb(filename, (const uint32_t*)buf, width, height, width * 4);
|
||||
return ok ? 1 : 0;
|
||||
}
|
||||
|
||||
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename)
|
||||
{
|
||||
bool ok = rbmp_save_image(filename,buf,width,height,width*4,RBMP_SOURCE_TYPE_ARGB8888);
|
||||
bool ok = rbmp_save_image(filename,buf,width,height,width*4,(rbmp_source_type)(RBMP_SOURCE_TYPE_ARGB8888 | RBMP_SOURCE_TYPE_YFLIPPED));
|
||||
return ok?1:0;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 DeSmuME team
|
||||
Copyright (C) 2015-2017 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,8 +20,12 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
u8* Convert15To24(const u16* src, int width, int height);
|
||||
u8* Convert32To32SwapRB(const void* src, int width, int height);
|
||||
|
||||
int NDS_WritePNG_15bpp(int width, int height, const u16 *data, const char *fname);
|
||||
int NDS_WriteBMP_15bpp(int width, int height, const u16 *data, const char *filename);
|
||||
int NDS_WritePNG_32bppBuffer(int width, int height, const void* buf, const char *filename);
|
||||
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2006-2015 DeSmuME team
|
||||
Copyright (C) 2006-2017 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -310,8 +310,8 @@ static int avi_open(const char* filename, const BITMAPINFOHEADER* pbmih, const W
|
|||
return result;
|
||||
}
|
||||
|
||||
//converts 16bpp to 24bpp and flips
|
||||
static void do_video_conversion(AVIFile* avi, const u16* buffer)
|
||||
//converts 32bpp to 24bpp and flips
|
||||
static void do_video_conversion(AVIFile* avi, const u32* buffer)
|
||||
{
|
||||
int width = avi->prescaleLevel*256;
|
||||
int height = avi->prescaleLevel*384;
|
||||
|
@ -321,10 +321,10 @@ static void do_video_conversion(AVIFile* avi, const u16* buffer)
|
|||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
u32 dst = ColorspaceConvert555To8888Opaque<true>(*buffer++);
|
||||
*outbuf++ = dst & 0xFF;
|
||||
*outbuf++ = (dst >> 8) & 0xFF;
|
||||
u32 dst = *buffer++;
|
||||
*outbuf++ = (dst >> 16) & 0xFF;
|
||||
*outbuf++ = (dst >> 8) & 0xFF;
|
||||
*outbuf++ = dst & 0xFF;
|
||||
}
|
||||
|
||||
outbuf -= width*3*2;
|
||||
|
@ -418,7 +418,7 @@ void DRV_AviVideoUpdate()
|
|||
return;
|
||||
|
||||
const NDSDisplayInfo& dispInfo = GPU->GetDisplayInfo();
|
||||
const u16* buffer = (const u16 *)dispInfo.masterCustomBuffer;
|
||||
const u32* buffer = (const u32 *)dispInfo.masterCustomBuffer;
|
||||
|
||||
//dont do anything if prescale has changed, it's just going to be garbage
|
||||
if(video.prescaleHD != avi_file->prescaleLevel)
|
||||
|
|
|
@ -164,15 +164,22 @@ void HK_QuickScreenShot(int param, bool justPressed)
|
|||
switch(path.imageformat())
|
||||
{
|
||||
case path.PNG:
|
||||
{
|
||||
{
|
||||
strcat(fname, ".png");
|
||||
NDS_WritePNG_15bpp(dispInfo.customWidth, dispInfo.customHeight*2, (const u16*)dispInfo.masterCustomBuffer, fname);
|
||||
u32* swapbuf = (u32*)malloc_alignedCacheLine(dispInfo.customWidth * dispInfo.customHeight * 2 * 4);
|
||||
ColorspaceConvertBuffer888XTo8888Opaque<true, true>((const u32*)dispInfo.masterCustomBuffer, swapbuf, dispInfo.customWidth * dispInfo.customHeight * 2);
|
||||
free_aligned(swapbuf);
|
||||
NDS_WritePNG_32bppBuffer(dispInfo.customWidth, dispInfo.customHeight*2, swapbuf, fname);
|
||||
free_aligned(swapbuf);
|
||||
}
|
||||
break;
|
||||
case path.BMP:
|
||||
{
|
||||
strcat(fname, ".bmp");
|
||||
NDS_WriteBMP_15bpp(dispInfo.customWidth, dispInfo.customHeight *2, (const u16*)dispInfo.masterCustomBuffer, fname);
|
||||
u32* swapbuf = (u32*)malloc_alignedCacheLine(dispInfo.customWidth * dispInfo.customHeight * 2 * 4);
|
||||
ColorspaceConvertBuffer888XTo8888Opaque<true, true>((const u32*)dispInfo.masterCustomBuffer, swapbuf, dispInfo.customWidth * dispInfo.customHeight * 2);
|
||||
NDS_WriteBMP_32bppBuffer(dispInfo.customWidth, dispInfo.customHeight *2, swapbuf, fname);
|
||||
free_aligned(swapbuf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
#include "frontend/modules/osd/agg/agg_osd.h"
|
||||
#include "frontend/modules/osd/agg/aggdraw.h"
|
||||
#include "frontend/modules/osd/agg/agg2d.h"
|
||||
#include "frontend/modules/ImageOut.h"
|
||||
#include "winutil.h"
|
||||
#include "ogl.h"
|
||||
|
||||
|
@ -4224,16 +4225,19 @@ void ScreenshotToClipboard(bool extraInfo)
|
|||
memset(&bmi, 0, sizeof(bmi));
|
||||
bmi.bV4Size = sizeof(bmi);
|
||||
bmi.bV4Planes = 1;
|
||||
bmi.bV4BitCount = 16;
|
||||
bmi.bV4V4Compression = BI_RGB | BI_BITFIELDS;
|
||||
bmi.bV4RedMask = 0x001F;
|
||||
bmi.bV4GreenMask = 0x03E0;
|
||||
bmi.bV4BlueMask = 0x7C00;
|
||||
bmi.bV4BitCount = 32;
|
||||
bmi.bV4V4Compression = BI_RGB;
|
||||
bmi.bV4Width = width;
|
||||
bmi.bV4Height = -height;
|
||||
|
||||
|
||||
u32* swapbuf = (u32*)malloc_alignedCacheLine(width*height*4);
|
||||
ColorspaceConvertBuffer888XTo8888Opaque<true, true>((const u32*)dispInfo.masterCustomBuffer, swapbuf, width * height);
|
||||
|
||||
FillRect(hMemDC, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));
|
||||
SetDIBitsToDevice(hMemDC, 0, 0, width, height, 0, 0, 0, height, dispInfo.masterCustomBuffer, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||
SetDIBitsToDevice(hMemDC, 0, 0, width, height, 0, 0, 0, height, swapbuf, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||
|
||||
free_aligned(swapbuf);
|
||||
|
||||
//center-justify the extra text
|
||||
int xo = (width - 256)/2;
|
||||
|
|
Loading…
Reference in New Issue