Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
34ce34ed
Commit
34ce34ed
authored
24 years ago
by
Jean-Claude Batista
Committed by
Alexandre Julliard
24 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use SetDIBits instead of StretchDIBits (in ANIMATE_PaintFrame).
parent
07f38445
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/comctl32/animate.c
+19
-182
19 additions, 182 deletions
dlls/comctl32/animate.c
with
19 additions
and
182 deletions
dlls/comctl32/animate.c
+
19
−
182
View file @
34ce34ed
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
* Eric <ekohl@abo.rhein-zeitung.de>
* Eric <ekohl@abo.rhein-zeitung.de>
*
*
* TODO:
* TODO:
* - correct RLE4 decompression
* - check for the 'rec ' list in some AVI files
* - check for the 'rec ' list in some AVI files
* - concurrent access to infoPtr
* - concurrent access to infoPtr
*/
*/
...
@@ -71,7 +70,7 @@ typedef struct
...
@@ -71,7 +70,7 @@ typedef struct
/* tranparency info*/
/* tranparency info*/
COLORREF
transparentColor
;
COLORREF
transparentColor
;
HBRUSH
hbrushBG
;
HBRUSH
hbrushBG
;
HBITMAP
hbmPrevFrame
;
}
ANIMATE_INFO
;
}
ANIMATE_INFO
;
#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0))
#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0))
...
@@ -190,6 +189,11 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
...
@@ -190,6 +189,11 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
HeapFree
(
GetProcessHeap
(),
0
,
infoPtr
->
outdata
);
HeapFree
(
GetProcessHeap
(),
0
,
infoPtr
->
outdata
);
infoPtr
->
outdata
=
NULL
;
infoPtr
->
outdata
=
NULL
;
}
}
if
(
infoPtr
->
hbmPrevFrame
)
{
DeleteObject
(
infoPtr
->
hbmPrevFrame
);
infoPtr
->
hbmPrevFrame
=
0
;
}
infoPtr
->
indata
=
infoPtr
->
outdata
=
NULL
;
infoPtr
->
indata
=
infoPtr
->
outdata
=
NULL
;
infoPtr
->
hWnd
=
0
;
infoPtr
->
hWnd
=
0
;
infoPtr
->
hMMio
=
0
;
infoPtr
->
hMMio
=
0
;
...
@@ -201,123 +205,6 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
...
@@ -201,123 +205,6 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
infoPtr
->
transparentColor
=
ANIMATE_COLOR_NONE
;
infoPtr
->
transparentColor
=
ANIMATE_COLOR_NONE
;
}
}
/***********************************************************************
* ANIMATE_Expand_RLE8
*
* Decompresses an 8-bit compressed frame over previous frame
*
*/
enum
Rle8_EscapeCodes
{
RleEol
=
0
,
/* End of line */
RleEnd
=
1
,
/* End of bitmap */
RleDelta
=
2
/* Delta */
};
static
LRESULT
ANIMATE_Expand_RLE8
(
BYTE
*
pDest
,
int
nWidth
,
int
nHeight
,
BYTE
*
pSource
)
{
int
x
;
/* X-positon on each line. Increases. */
int
line
;
/* Line #. Increases */
BYTE
*
pOut
;
/* current position in destination buffer */
BYTE
length
;
/* The length of a run */
BYTE
color_index
;
/* index for current pixel */
BYTE
escape_code
;
/* See enum Rle8_EscapeCodes.*/
int
bEndOfBitmap
=
0
;
/* image width including byte padding */
int
nStride
=
(((
nWidth
-
1
)
>>
2
)
+
1
)
<<
2
;
if
(
nHeight
<
1
||
nWidth
<
1
||
nStride
<
1
||
!
pSource
||
!
pDest
)
return
FALSE
;
x
=
0
;
line
=
0
;
pOut
=
pDest
;
do
{
length
=
*
pSource
++
;
/*
* If the length byte is not zero (which is the escape value),
* We have a run of length pixels all the same colour. The color
* index is stored next.
*
* If the length byte is zero, we need to read the next byte to
* know what to do.
*/
if
(
length
!=
0
)
{
/*
* [Run-Length] Encoded mode
*/
color_index
=
(
*
pSource
++
);
/* Get the color index. */
while
(
length
--
&&
x
<
nWidth
)
{
*
pOut
++=
color_index
;
x
++
;
}
}
else
{
/*
* Escape codes or absolute sequence
*/
escape_code
=
(
*
pSource
++
);
switch
(
escape_code
)
{
case
RleEol
:
/* =0, end of line */
{
x
=
0
;
line
++
;
pOut
=
pDest
+
nStride
*
line
;
break
;
}
case
RleEnd
:
/* =1, end of bitmap */
{
bEndOfBitmap
=
TRUE
;
line
=
nHeight
;
/* exit from loop. */
break
;
}
case
RleDelta
:
/* =2, a delta */
{
x
+=
(
*
pSource
++
);
line
+=
(
*
pSource
++
);
if
(
line
>=
nHeight
||
x
>=
nWidth
)
{
WARN
(
"Delta out of bounds
\n
"
);
line
=
nHeight
;
}
pOut
=
pDest
+
(
line
*
nStride
)
+
x
;
break
;
}
default:
/* >2, absolute mode */
{
length
=
escape_code
;
while
(
length
--
)
{
color_index
=
(
*
pSource
++
);
if
(
x
<
nWidth
)
{
*
pOut
++=
color_index
;
x
++
;
}
}
if
(
escape_code
&
1
)
pSource
++
;
/* Throw away the pad byte. */
break
;
}
}
/* switch (escape_code) */
}
/* process either an encoded sequence or an escape sequence */
/* We expect to come here more than once per line. */
}
while
(
line
<
nHeight
);
/* Do this until the bitmap is filled */
if
(
!
bEndOfBitmap
)
{
TRACE
(
"Reached end of bitmap without a EndOfBitmap code
\n
"
);
}
return
TRUE
;
}
static
void
ANIMATE_TransparentBlt
(
ANIMATE_INFO
*
infoPtr
,
HDC
hdcDest
,
HDC
hdcSource
)
static
void
ANIMATE_TransparentBlt
(
ANIMATE_INFO
*
infoPtr
,
HDC
hdcDest
,
HDC
hdcSource
)
{
{
HDC
hdcMask
;
HDC
hdcMask
;
...
@@ -356,7 +243,6 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
...
@@ -356,7 +243,6 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
LPBITMAPINFO
pBitmapInfo
=
NULL
;
LPBITMAPINFO
pBitmapInfo
=
NULL
;
HDC
hdcMem
;
HDC
hdcMem
;
HBITMAP
hbmNew
;
HBITMAP
hbmOld
;
HBITMAP
hbmOld
;
int
nOffsetX
=
0
;
int
nOffsetX
=
0
;
...
@@ -368,18 +254,14 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
...
@@ -368,18 +254,14 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
if
(
!
hDC
||
!
infoPtr
->
inbih
)
if
(
!
hDC
||
!
infoPtr
->
inbih
)
return
TRUE
;
return
TRUE
;
if
(
infoPtr
->
hic
||
if
(
infoPtr
->
hic
)
/* put this once correct RLE4 decompression is implemented */
/* infoPtr->inbih->biCompression == BI_RLE4 || */
infoPtr
->
inbih
->
biCompression
==
BI_RLE8
)
{
{
pBitmapData
=
infoPtr
->
outdata
;
pBitmapData
=
infoPtr
->
outdata
;
pBitmapInfo
=
(
LPBITMAPINFO
)
infoPtr
->
outbih
;
pBitmapInfo
=
(
LPBITMAPINFO
)
infoPtr
->
outbih
;
nWidth
=
infoPtr
->
outbih
->
biWidth
;
nWidth
=
infoPtr
->
outbih
->
biWidth
;
nHeight
=
infoPtr
->
outbih
->
biHeight
;
nHeight
=
infoPtr
->
outbih
->
biHeight
;
}
}
else
else
{
{
pBitmapData
=
infoPtr
->
indata
;
pBitmapData
=
infoPtr
->
indata
;
pBitmapInfo
=
(
LPBITMAPINFO
)
infoPtr
->
inbih
;
pBitmapInfo
=
(
LPBITMAPINFO
)
infoPtr
->
inbih
;
...
@@ -388,20 +270,15 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
...
@@ -388,20 +270,15 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
nHeight
=
infoPtr
->
inbih
->
biHeight
;
nHeight
=
infoPtr
->
inbih
->
biHeight
;
}
}
if
(
infoPtr
->
inbih
->
biCompression
==
BI_RLE8
)
if
(
!
infoPtr
->
hbmPrevFrame
)
ANIMATE_Expand_RLE8
(
pBitmapData
,
nWidth
,
nHeight
,
infoPtr
->
indata
);
{
infoPtr
->
hbmPrevFrame
=
CreateCompatibleBitmap
(
hDC
,
nWidth
,
nHeight
);
}
if
(
infoPtr
->
inbih
->
biCompression
==
BI_RLE4
)
SetDIBits
(
hDC
,
infoPtr
->
hbmPrevFrame
,
0
,
nHeight
,
pBitmapData
,
(
LPBITMAPINFO
)
pBitmapInfo
,
DIB_RGB_COLORS
);
FIXME
(
"correct RLE4 decompression not implemented yet (no samples available)
\n
"
);
hdcMem
=
CreateCompatibleDC
(
hDC
);
hdcMem
=
CreateCompatibleDC
(
hDC
);
hbmNew
=
CreateCompatibleBitmap
(
hDC
,
nWidth
,
nHeight
);
hbmOld
=
SelectObject
(
hdcMem
,
infoPtr
->
hbmPrevFrame
);
hbmOld
=
SelectObject
(
hdcMem
,
hbmNew
);
StretchDIBits
(
hdcMem
,
0
,
0
,
infoPtr
->
inbih
->
biWidth
,
infoPtr
->
inbih
->
biHeight
,
0
,
0
,
infoPtr
->
inbih
->
biWidth
,
infoPtr
->
inbih
->
biHeight
,
pBitmapData
,
(
LPBITMAPINFO
)
pBitmapInfo
,
DIB_RGB_COLORS
,
SRCCOPY
);
/*
/*
* we need to get the transparent color even without ACS_TRANSPARENT,
* we need to get the transparent color even without ACS_TRANSPARENT,
...
@@ -434,8 +311,8 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
...
@@ -434,8 +311,8 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
SelectObject
(
hdcFinal
,
hbmOld2
);
SelectObject
(
hdcFinal
,
hbmOld2
);
SelectObject
(
hdcMem
,
hbmFinal
);
SelectObject
(
hdcMem
,
hbmFinal
);
DeleteDC
(
hdcFinal
);
DeleteDC
(
hdcFinal
);
DeleteObject
(
hbmNew
);
DeleteObject
(
infoPtr
->
hbmPrevFrame
);
hbmNew
=
hbmFinal
;
infoPtr
->
hbmPrevFrame
=
hbmFinal
;
}
}
if
(
GetWindowLongA
(
infoPtr
->
hWnd
,
GWL_STYLE
)
&
ACS_CENTER
)
if
(
GetWindowLongA
(
infoPtr
->
hWnd
,
GWL_STYLE
)
&
ACS_CENTER
)
...
@@ -450,7 +327,6 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
...
@@ -450,7 +327,6 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
SelectObject
(
hdcMem
,
hbmOld
);
SelectObject
(
hdcMem
,
hbmOld
);
DeleteDC
(
hdcMem
);
DeleteDC
(
hdcMem
);
DeleteObject
(
hbmNew
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -745,50 +621,10 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
...
@@ -745,50 +621,10 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
DWORD
outSize
;
DWORD
outSize
;
/* check uncompressed AVI */
/* check uncompressed AVI */
if
(
infoPtr
->
ash
.
fccHandler
==
mmioFOURCC
(
'D'
,
'I'
,
'B'
,
' '
))
{
if
((
infoPtr
->
ash
.
fccHandler
==
mmioFOURCC
(
'D'
,
'I'
,
'B'
,
' '
))
||
infoPtr
->
hic
=
0
;
(
infoPtr
->
ash
.
fccHandler
==
mmioFOURCC
(
'R'
,
'L'
,
'E'
,
' '
)))
return
TRUE
;
}
else
if
(
infoPtr
->
ash
.
fccHandler
==
mmioFOURCC
(
'R'
,
'L'
,
'E'
,
' '
))
{
{
int
nStride
=
0
;
int
frameBufferSize
;
int
sizebih
=
sizeof
(
BITMAPINFOHEADER
)
+
infoPtr
->
inbih
->
biClrUsed
*
sizeof
(
RGBQUAD
);
if
(
infoPtr
->
inbih
->
biCompression
==
BI_RLE8
)
nStride
=
((((
infoPtr
->
inbih
->
biWidth
-
1
)
>>
2
)
+
1
)
<<
2
);
else
if
(
infoPtr
->
inbih
->
biCompression
==
BI_RLE4
)
nStride
=
((((
infoPtr
->
inbih
->
biWidth
-
1
)
>>
3
)
+
1
)
<<
2
);
else
{
ERR
(
"Image compression format unknown
\n
"
);
return
FALSE
;
}
frameBufferSize
=
infoPtr
->
inbih
->
biHeight
*
nStride
;
infoPtr
->
hic
=
0
;
infoPtr
->
hic
=
0
;
infoPtr
->
outbih
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizebih
);
if
(
!
infoPtr
->
outbih
)
{
ERR
(
"out of memory!
\n
"
);
return
FALSE
;
}
infoPtr
->
outdata
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
frameBufferSize
);
if
(
!
infoPtr
->
outdata
)
{
HeapFree
(
GetProcessHeap
(),
0
,
infoPtr
->
outbih
);
infoPtr
->
outbih
=
0
;
ERR
(
"out of memory!
\n
"
);
return
FALSE
;
}
/* create a BITMAPINFO header for the uncompressed bitmap */
memcpy
(
infoPtr
->
outbih
,
infoPtr
->
inbih
,
sizebih
);
infoPtr
->
outbih
->
biCompression
=
BI_RGB
;
infoPtr
->
outbih
->
biSizeImage
=
frameBufferSize
;
return
TRUE
;
return
TRUE
;
}
}
...
@@ -935,6 +771,7 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
...
@@ -935,6 +771,7 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
SetWindowLongA
(
hWnd
,
0
,
(
DWORD
)
infoPtr
);
SetWindowLongA
(
hWnd
,
0
,
(
DWORD
)
infoPtr
);
infoPtr
->
hWnd
=
hWnd
;
infoPtr
->
hWnd
=
hWnd
;
infoPtr
->
transparentColor
=
ANIMATE_COLOR_NONE
;
infoPtr
->
transparentColor
=
ANIMATE_COLOR_NONE
;
infoPtr
->
hbmPrevFrame
=
0
;
hModWinmm
=
LoadLibraryA
(
"WINMM"
);
hModWinmm
=
LoadLibraryA
(
"WINMM"
);
infoPtr
->
fnmmioOpenA
=
(
void
*
)
GetProcAddress
(
hModWinmm
,
"mmioOpenA"
);
infoPtr
->
fnmmioOpenA
=
(
void
*
)
GetProcAddress
(
hModWinmm
,
"mmioOpenA"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment