Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
567894b0
Commit
567894b0
authored
May 18, 2003
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* first BMP loader for X11 skins : it can only handle 24bbp uncompressed
images, but it works !
parent
3a0e5d28
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
29 deletions
+125
-29
modules/gui/skins/x11/x11_bitmap.cpp
modules/gui/skins/x11/x11_bitmap.cpp
+102
-19
modules/gui/skins/x11/x11_bitmap.h
modules/gui/skins/x11/x11_bitmap.h
+9
-5
modules/gui/skins/x11/x11_run.cpp
modules/gui/skins/x11/x11_run.cpp
+13
-3
modules/gui/skins/x11/x11_window.cpp
modules/gui/skins/x11/x11_window.cpp
+1
-2
No files found.
modules/gui/skins/x11/x11_bitmap.cpp
View file @
567894b0
...
...
@@ -2,7 +2,7 @@
* x11_bitmap.cpp: X11 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_bitmap.cpp,v 1.
2 2003/04/30 21:16:24
asmax Exp $
* $Id: x11_bitmap.cpp,v 1.
3 2003/05/18 11:25:00
asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
...
...
@@ -42,31 +42,50 @@
#include "../os_theme.h"
#include "../src/skin_common.h"
#include <stdio.h>
// macros to read little endian numbers
#define U16( p ) ( ((uint8_t*)(p))[0] | ((uint8_t*)(p))[1] << 8 )
#define U32( p ) ( U16( p ) | ((uint8_t*)(p))[2] << 16 | ((uint8_t*)(p))[3] << 24 )
//---------------------------------------------------------------------------
// X11Bitmap
//---------------------------------------------------------------------------
X11Bitmap
::
X11Bitmap
(
intf_thread_t
*
p_intf
,
string
FileName
,
int
AColor
)
X11Bitmap
::
X11Bitmap
(
intf_thread_t
*
_
p_intf
,
string
FileName
,
int
AColor
)
:
Bitmap
(
p_intf
,
FileName
,
AColor
)
{
p_intf
=
_p_intf
;
// Find the display
display
=
p_intf
->
p_sys
->
display
;
Window
root
=
DefaultRootWindow
(
display
);
int
screen
=
DefaultScreen
(
display
);
int
depth
=
DefaultDepth
(
display
,
screen
);
Screen
*
screenptr
=
DefaultScreenOfDisplay
(
display
);
Visual
*
visual
=
DefaultVisualOfScreen
(
screenptr
);
char
*
data
=
NULL
;
Width
=
0
;
Height
=
0
;
AlphaColor
=
AColor
;
if
(
FileName
!=
""
)
{
data
=
LoadFromFile
(
FileName
,
depth
,
Width
,
Height
);
}
// Create the image
Bmp
=
XCreateImage
(
display
,
visual
,
depth
,
ZPixmap
,
0
,
data
,
Width
,
Height
,
32
,
4
*
Width
);
XInitImage
(
Bmp
);
// Load the bitmap image
int
hotspotX
,
hotspotY
;
int
rc
=
XReadBitmapFile
(
display
,
root
,
FileName
.
c_str
(),
(
unsigned
int
*
)
&
Width
,
(
unsigned
int
*
)
&
Height
,
&
Bmp
,
&
hotspotX
,
&
hotspotY
);
if
(
rc
!=
BitmapSuccess
)
/* if( rc != BitmapSuccess )
{
if( FileName != "" )
msg_Warn( p_intf, "Couldn't load bitmap: %s", FileName.c_str() );
Width = 0;
Height = 0;
}
}
*/
/* else
{
Width = gdk_pixbuf_get_width( Bmp );
...
...
@@ -100,9 +119,10 @@ X11Bitmap::X11Bitmap( intf_thread_t *p_intf, string FileName, int AColor )
}*/
}
//---------------------------------------------------------------------------
X11Bitmap
::
X11Bitmap
(
intf_thread_t
*
p_intf
,
Graphics
*
from
,
int
x
,
int
y
,
X11Bitmap
::
X11Bitmap
(
intf_thread_t
*
_
p_intf
,
Graphics
*
from
,
int
x
,
int
y
,
int
w
,
int
h
,
int
AColor
)
:
Bitmap
(
p_intf
,
from
,
x
,
y
,
w
,
h
,
AColor
)
{
p_intf
=
_p_intf
;
/* Width = w;
Height = h;
AlphaColor = AColor;
...
...
@@ -117,9 +137,10 @@ X11Bitmap::X11Bitmap( intf_thread_t *p_intf, Graphics *from, int x, int y,
BitBlt( bmpDC, 0, 0, Width, Height, fromDC, x, y, SRCCOPY );*/
}
//---------------------------------------------------------------------------
X11Bitmap
::
X11Bitmap
(
intf_thread_t
*
p_intf
,
Bitmap
*
c
)
X11Bitmap
::
X11Bitmap
(
intf_thread_t
*
_
p_intf
,
Bitmap
*
c
)
:
Bitmap
(
p_intf
,
c
)
{
p_intf
=
_p_intf
;
/* HBITMAP HBuf;
// Copy attibutes
...
...
@@ -138,19 +159,15 @@ X11Bitmap::X11Bitmap( intf_thread_t *p_intf, Bitmap *c )
//---------------------------------------------------------------------------
X11Bitmap
::~
X11Bitmap
()
{
X
FreePixmap
(
display
,
Bmp
);
X
DestroyImage
(
Bmp
);
}
//---------------------------------------------------------------------------
void
X11Bitmap
::
DrawBitmap
(
int
x
,
int
y
,
int
w
,
int
h
,
int
xRef
,
int
yRef
,
Graphics
*
dest
)
{
if
(
Bmp
)
{
Drawable
destImg
=
(
(
X11Graphics
*
)
dest
)
->
GetImage
();
GC
destGC
=
(
(
X11Graphics
*
)
dest
)
->
GetGC
();
XCopyArea
(
display
,
Bmp
,
destImg
,
destGC
,
x
,
y
,
w
,
h
,
xRef
,
yRef
);
}
XPutImage
(
display
,
destImg
,
destGC
,
Bmp
,
x
,
y
,
xRef
,
yRef
,
w
,
h
);
}
//---------------------------------------------------------------------------
bool
X11Bitmap
::
Hit
(
int
x
,
int
y
)
...
...
@@ -190,5 +207,71 @@ void X11Bitmap::SetBmpPixel( int x, int y, int color )
// SetPixelV( bmpDC, x, y, color );
}
//---------------------------------------------------------------------------
char
*
X11Bitmap
::
LoadFromFile
(
string
fileName
,
int
depth
,
int
&
width
,
int
&
height
)
{
// BMP header fields
uint32_t
fileSize
;
uint32_t
dataOffset
;
uint32_t
headerSize
;
uint16_t
planes
;
uint16_t
bpp
;
uint32_t
compression
;
uint32_t
dataSize
;
uint32_t
nColors
;
FILE
*
file
=
fopen
(
fileName
.
c_str
(),
"ro"
);
if
(
!
file
)
{
msg_Warn
(
p_intf
,
"Cannot open %s"
,
fileName
.
c_str
()
);
return
NULL
;
}
// Read the headers
char
headers
[
54
];
fread
(
headers
,
54
,
1
,
file
);
fileSize
=
U32
(
headers
+
2
);
dataOffset
=
U32
(
headers
+
10
);
headerSize
=
U32
(
headers
+
14
);
width
=
(
int32_t
)
U32
(
headers
+
18
);
height
=
(
int32_t
)
U32
(
headers
+
22
);
planes
=
U32
(
headers
+
26
);
bpp
=
U32
(
headers
+
28
);
compression
=
U32
(
headers
+
30
);
dataSize
=
U32
(
headers
+
34
);
nColors
=
U32
(
headers
+
50
);
// fprintf(stderr,"image %d %d\n", width, height);
switch
(
bpp
)
{
case
24
:
// 24 bits per pixel
{
// Pad to a 32bit boundary
int
pad
=
((
3
*
width
-
1
)
/
4
)
*
4
+
4
-
3
*
width
;
uint32_t
*
data
=
new
uint32_t
[
height
*
width
];
uint32_t
*
ptr
;
for
(
int
j
=
0
;
j
<
height
;
j
++
)
{
ptr
=
data
+
width
*
(
height
-
j
-
1
);
for
(
int
i
=
0
;
i
<
width
;
i
++
)
{
// Read a pixel
uint32_t
pixel
=
0
;
fread
(
&
pixel
,
3
,
1
,
file
);
*
(
ptr
++
)
=
U32
(
&
pixel
);
}
fseek
(
file
,
pad
,
SEEK_CUR
);
}
return
(
char
*
)
data
;
}
default:
msg_Warn
(
p_intf
,
"%s : %d bbp not supported !"
,
fileName
.
c_str
(),
bpp
);
return
NULL
;
}
}
//---------------------------------------------------------------------------
#endif
modules/gui/skins/x11/x11_bitmap.h
View file @
567894b0
...
...
@@ -2,7 +2,7 @@
* x11_bitmap.h: X11 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_bitmap.h,v 1.
1 2003/04/28 14:32:57
asmax Exp $
* $Id: x11_bitmap.h,v 1.
2 2003/05/18 11:25:00
asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -42,15 +42,16 @@ class Graphics;
class
X11Bitmap
:
public
Bitmap
{
private:
intf_thread_t
*
p_intf
;
Display
*
display
;
Pixmap
Bmp
;
XImage
*
Bmp
;
public:
// Constructors
X11Bitmap
(
intf_thread_t
*
p_intf
,
string
FileName
,
int
AColor
);
X11Bitmap
(
intf_thread_t
*
p_intf
,
Graphics
*
from
,
int
x
,
int
y
,
X11Bitmap
(
intf_thread_t
*
_
p_intf
,
string
FileName
,
int
AColor
);
X11Bitmap
(
intf_thread_t
*
_
p_intf
,
Graphics
*
from
,
int
x
,
int
y
,
int
w
,
int
h
,
int
AColor
);
X11Bitmap
(
intf_thread_t
*
p_intf
,
Bitmap
*
c
);
X11Bitmap
(
intf_thread_t
*
_
p_intf
,
Bitmap
*
c
);
// Destructor
virtual
~
X11Bitmap
();
...
...
@@ -61,6 +62,9 @@ class X11Bitmap : public Bitmap
virtual
int
GetBmpPixel
(
int
x
,
int
y
);
virtual
void
SetBmpPixel
(
int
x
,
int
y
,
int
color
);
protected:
char
*
LoadFromFile
(
string
fileName
,
int
depth
,
int
&
width
,
int
&
height
);
};
//---------------------------------------------------------------------------
...
...
modules/gui/skins/x11/x11_run.cpp
View file @
567894b0
...
...
@@ -2,7 +2,7 @@
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_run.cpp,v 1.
3 2003/05/13 20:36:29
asmax Exp $
* $Id: x11_run.cpp,v 1.
4 2003/05/18 11:25:00
asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -28,7 +28,9 @@
#include <X11/Xlib.h>
//--- WWWINDOWS -------------------------------------------------------------
#ifndef BASIC_SKINS
#include <wx/wx.h>
#endif
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
...
...
@@ -44,7 +46,9 @@
#include "../os_theme.h"
#include "../src/skin_common.h"
#include "../src/vlcproc.h"
#ifndef BASIC_SKINS
#include "../../wxwindows/wxwindows.h"
#endif
// include the icon graphic
#include "share/vlc32x32.xpm"
...
...
@@ -60,6 +64,7 @@ int SkinManage( intf_thread_t *p_intf );
//---------------------------------------------------------------------------
// Local classes declarations.
//---------------------------------------------------------------------------
#ifndef BASIC_SKINS
class
Instance
:
public
wxApp
{
public:
...
...
@@ -72,6 +77,7 @@ public:
private:
intf_thread_t
*
p_intf
;
};
#endif
//---------------------------------------------------------------------------
...
...
@@ -200,6 +206,7 @@ private:
//---------------------------------------------------------------------------
// Implementation of Instance class
//---------------------------------------------------------------------------
#ifndef BASIC_SKINS
Instance
::
Instance
(
)
{
}
...
...
@@ -229,7 +236,7 @@ bool Instance::OnInit()
return
TRUE
;
}
#endif
//---------------------------------------------------------------------------
...
...
@@ -244,7 +251,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
Window
wnd
=
((
XAnyEvent
*
)
event
)
->
window
;
fprintf
(
stderr
,
"event %d %x
\n
"
,
event
->
type
,
wnd
);
//
fprintf(stderr,"event %d %x\n", event->type, wnd);
// Create event to dispatch in windows
// Skin event
...
...
@@ -359,6 +366,9 @@ void OSRun( intf_thread_t *p_intf )
XNextEvent
(
display
,
event
);
ProcessEvent
(
p_intf
,
proc
,
event
);
// kludge: add timer
SkinManage
(
p_intf
);
}
}
...
...
modules/gui/skins/x11/x11_window.cpp
View file @
567894b0
...
...
@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.
2 2003/05/13 20:36:29
asmax Exp $
* $Id: x11_window.cpp,v 1.
3 2003/05/18 11:25:00
asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -289,7 +289,6 @@ void X11Window::RefreshFromImage( int x, int y, int w, int h )
*/
Drawable
drawable
=
((
X11Graphics
*
)
Image
)
->
GetImage
();
fprintf
(
stderr
,
"prout
\n
"
);
XCopyArea
(
display
,
drawable
,
Wnd
,
Gc
,
x
,
y
,
w
,
h
,
x
,
y
);
XSync
(
display
,
0
);
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment