diff options
author | jonasno <jonasno@users.sourceforge.net> | 2010-03-09 15:44:03 +0300 |
---|---|---|
committer | jonasno <jonasno@users.sourceforge.net> | 2010-03-09 15:44:03 +0300 |
commit | 21c0cb78a588672ad4ce69f4d1c5b4cf60ba3ee9 (patch) | |
tree | 353ecce0184d999d473034ebe55d13bec9161a92 /src/subtitles/STS.cpp | |
parent | ad7e6be5c677f58e3cf00e80d6dc5d29aad3cc49 (diff) |
-Updated VSFilterMod from r20 to r25
-Fixed subtitle bug (Ticket #345) Link: http://sourceforge.net/apps/trac/mpc-hc/ticket/345
-Updated build script
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1746 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/STS.cpp')
-rw-r--r-- | src/subtitles/STS.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/subtitles/STS.cpp b/src/subtitles/STS.cpp index c91109791..4f0e1e949 100644 --- a/src/subtitles/STS.cpp +++ b/src/subtitles/STS.cpp @@ -1262,7 +1262,7 @@ static bool LoadFont(CString& font) if(hFont == INVALID_HANDLE_VALUE)
{
TCHAR path[_MAX_PATH];
- GetTempPath(MAX_PATH, path);
+ GetTempPath(_MAX_PATH, path);
DWORD chksum = 0;
for(ptrdiff_t i = 0, j = datalen>>2; i < j; i++)
@@ -2715,7 +2715,7 @@ bool CSimpleTextSubtitle::Open(CTextFile* f, int CharSet, CString name) bool CSimpleTextSubtitle::Open(BYTE* data, int len, int CharSet, CString name)
{
TCHAR path[_MAX_PATH];
- if(!GetTempPath(MAX_PATH, path)) return(false);
+ if(!GetTempPath(_MAX_PATH, path)) return(false);
TCHAR fn[_MAX_PATH];
if(!GetTempFileName(path, _T("vs"), 0, fn)) return(false);
@@ -3329,19 +3329,20 @@ MOD_PNGIMAGE::MOD_PNGIMAGE() alpha = 0xFF;
}
-void png_default_read_edata(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_size_t check; - - if (png_ptr->io_ptr == NULL) +// read embedded graphics
+void png_default_read_edata(png_structp png_ptr, png_bytep data, png_size_t length)
+{
+ png_size_t check;
+
+ if (png_ptr->io_ptr == NULL)
return;
- BYTE* eldata = (BYTE*)png_ptr->io_ptr; - - // read from memory - memcpy(data,eldata,length); - eldata += length; - png_ptr->io_ptr = (png_voidp)eldata; + BYTE* eldata = (BYTE*)png_ptr->io_ptr;
+
+ // read from memory
+ memcpy(data,eldata,length);
+ eldata += length;
+ png_ptr->io_ptr = (png_voidp)eldata;
}
bool MOD_PNGIMAGE::operator == (MOD_PNGIMAGE& png)
@@ -3532,16 +3533,16 @@ void MOD_GRADIENT::clear() subpixy = 0;
}
+#include <math.h>
DWORD MOD_GRADIENT::getmixcolor(int tx, int ty, int i) // too slow T.T
{
DWORD colorb = 0;
tx += xoffset;
- ty += yoffset;
- double x = (double)tx/(double)width;
- double y = (double)ty/(double)height;
// gradient
if(mode[i]==1)
{
+ double x = (double)tx/(double)width;
+ double y = (double)ty/(double)height;
for(int j=0;j<3;j++)
{
colorb |= ((DWORD)(((color[i][0]>>(8*j))&0xff)*(1-x)*y +
@@ -3558,11 +3559,13 @@ DWORD MOD_GRADIENT::getmixcolor(int tx, int ty, int i) // too slow T.T // png background
if(mode[i]==2)
{
-
+ // unwarp
tx += b_images[i].xoffset;
ty += b_images[i].yoffset;
while(tx>b_images[i].width-1) tx-=b_images[i].width;
while(ty>b_images[i].height-1) ty-=b_images[i].height;
+ while(tx<0) tx+=b_images[i].width;
+ while(ty<0) ty+=b_images[i].height;
// now tx and ty are valid array indexes
// rows are inverted last,...,n,...,1,0
bool nlastpixx = (tx>0);
|