Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0aa3ae18
Commit
0aa3ae18
authored
Mar 27, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buildimage: Store large images as raw PNG files in icons.
parent
c9d806a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
buildimage
tools/buildimage
+16
-5
No files found.
tools/buildimage
View file @
0aa3ae18
...
@@ -38,6 +38,7 @@ die "Only BMP and ICO outputs are supported" unless $ext eq "bmp" or $ext eq "ic
...
@@ -38,6 +38,7 @@ die "Only BMP and ICO outputs are supported" unless $ext eq "bmp" or $ext eq "ic
my
$renderedSVGFileName
=
"$svgFileName.png"
;
my
$renderedSVGFileName
=
"$svgFileName.png"
;
my
@pngFiles
;
my
@pngFiles
;
my
@pngFilesRaw
;
# Get the programs from the environment variables
# Get the programs from the environment variables
my
$convert
=
$ENV
{
"CONVERT"
}
||
"convert"
;
my
$convert
=
$ENV
{
"CONVERT"
}
||
"convert"
;
...
@@ -49,6 +50,7 @@ sub cleanup()
...
@@ -49,6 +50,7 @@ sub cleanup()
{
{
unlink
$renderedSVGFileName
;
unlink
$renderedSVGFileName
;
unlink
$_
foreach
(
@pngFiles
);
unlink
$_
foreach
(
@pngFiles
);
unlink
$_
foreach
(
@pngFilesRaw
);
}
}
$SIG
{
"INT"
}
=
"cleanup"
;
$SIG
{
"INT"
}
=
"cleanup"
;
...
@@ -73,6 +75,8 @@ sub svg_element_start
...
@@ -73,6 +75,8 @@ sub svg_element_start
my
$size
=
0
;
my
$size
=
0
;
my
$depth
=
0
;
my
$depth
=
0
;
my
$width
=
0
;
my
$height
=
0
;
if
(
$ext
eq
"ico"
)
{
if
(
$ext
eq
"ico"
)
{
return
unless
$id
=~
/icon:(\d*)-(\d*)/
;
return
unless
$id
=~
/icon:(\d*)-(\d*)/
;
...
@@ -100,8 +104,8 @@ sub svg_element_start
...
@@ -100,8 +104,8 @@ sub svg_element_start
# Extract SVG vector images
# Extract SVG vector images
my
$x
=
$attr
{
'x'
};
my
$x
=
$attr
{
'x'
};
my
$y
=
$attr
{
'y'
};
my
$y
=
$attr
{
'y'
};
my
$width
=
$attr
{
'width'
};
$width
=
$attr
{
'width'
};
my
$height
=
$attr
{
'height'
};
$height
=
$attr
{
'height'
};
if
(
defined
(
$x
)
and
defined
(
$x
))
{
if
(
defined
(
$x
)
and
defined
(
$x
))
{
if
(
$x
=~
/\d*/
and
$y
=~
/\d*/
)
{
if
(
$x
=~
/\d*/
and
$y
=~
/\d*/
)
{
...
@@ -126,7 +130,14 @@ sub svg_element_start
...
@@ -126,7 +130,14 @@ sub svg_element_start
return
;
return
;
}
}
push
(
@pngFiles
,
$pngFileName
);
if
(
$width
>=
128
&&
$height
>=
128
)
{
push
(
@pngFilesRaw
,
$pngFileName
);
}
else
{
push
(
@pngFiles
,
$pngFileName
);
}
}
}
# Render the SVG image
# Render the SVG image
...
@@ -138,7 +149,7 @@ my $parser = new XML::Parser(
...
@@ -138,7 +149,7 @@ my $parser = new XML::Parser(
$parser
->
parsefile
(
"$svgFileName"
);
$parser
->
parsefile
(
"$svgFileName"
);
# If no render directives were found, take the full image as-is
# If no render directives were found, take the full image as-is
unless
(
@pngFiles
)
{
unless
(
@pngFiles
||
@pngFilesRaw
)
{
my
$pngFileName
=
"bmp$renderedSVGFileName"
;
my
$pngFileName
=
"bmp$renderedSVGFileName"
;
copy
(
$renderedSVGFileName
,
$pngFileName
)
or
die
"File could not be copied"
;
copy
(
$renderedSVGFileName
,
$pngFileName
)
or
die
"File could not be copied"
;
push
(
@pngFiles
,
$pngFileName
);
push
(
@pngFiles
,
$pngFileName
);
...
@@ -148,7 +159,7 @@ unless(@pngFiles) {
...
@@ -148,7 +159,7 @@ unless(@pngFiles) {
if
(
$ext
eq
"ico"
)
{
if
(
$ext
eq
"ico"
)
{
# Place images into the ICO
# Place images into the ICO
shell
$icotool
,
"-c"
,
"-o"
,
$outFileName
,
@pngFiles
;
shell
$icotool
,
"-c"
,
"-o"
,
$outFileName
,
@pngFiles
,
map
{
"--raw=$_"
;
}
@pngFilesRaw
;
}
elsif
(
$ext
eq
"bmp"
)
{
}
elsif
(
$ext
eq
"bmp"
)
{
...
...
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