120
120
my $inverted = 0; # icicle graph
121
121
my $flamechart = 0; # produce a flame chart (sort by time, do not merge stacks)
122
122
my $negate = 0; # switch differential hues
123
- my $titletext = " " ; # centered heading
123
+ my $titletext = " \000 " ; # centered heading
124
124
my $titledefault = " Flame Graph" ; # overwritten by --title
125
125
my $titleinverted = " Icicle Graph" ; # " "
126
126
my $searchcolor = " rgb(230,0,230)" ; # color for search highlighting
@@ -145,7 +145,8 @@ sub usage {
145
145
# io, wakeup, chain, java, js, perl, red, green, blue,
146
146
# aqua, yellow, purple, orange
147
147
--bgcolors COLOR # set background colors. gradient choices are yellow
148
- # (default), blue, green, grey; flat colors use "#rrggbb"
148
+ # (default), blue, green, grey; flat colors use "#rrggbb";
149
+ # or none to omit a background
149
150
--hash # colors are keyed by function name hash
150
151
--random # colors are randomly generated
151
152
--cp # use consistent palette (palette.map)
@@ -200,11 +201,11 @@ sub usage {
200
201
my %Events ;
201
202
my %nameattr ;
202
203
203
- if ($flamechart && $titletext eq " " ) {
204
+ if ($flamechart && $titletext eq " \000 " ) {
204
205
$titletext = " Flame Chart" ;
205
206
}
206
207
207
- if ($titletext eq " " ) {
208
+ if ($titletext eq " \000 " ) {
208
209
unless ($inverted ) {
209
210
$titletext = $titledefault ;
210
211
} else {
@@ -267,7 +268,7 @@ sub usage {
267
268
$bgcolor1 = " #f8f8f8" ; $bgcolor2 = " #e8e8e8" ;
268
269
} elsif ($bgcolors =~ / ^#......$ / ) {
269
270
$bgcolor1 = $bgcolor2 = $bgcolors ;
270
- } else {
271
+ } elsif ( $bgcolors ne ' none ' ) {
271
272
die " Unrecognized bgcolor option \" $bgcolors \" "
272
273
}
273
274
@@ -431,6 +432,12 @@ sub color {
431
432
my $b = 190 + int (55 * $v2 );
432
433
return " rgb($r ,$g ,$b )" ;
433
434
}
435
+ if (defined $type and $type eq " libgit2" ) {
436
+ my $alpha = sprintf (" %.2f" , 0.2 + (0.8 * (($v1 + $v2 ) / 2)));
437
+ return ($v3 > 0.5) ?
438
+ " rgba(241,80,47,$alpha )" :
439
+ " rgba(55,125,205,$alpha )" ;
440
+ }
434
441
435
442
# multi palettes
436
443
if (defined $type and $type eq " java" ) {
@@ -777,13 +784,21 @@ sub flow {
777
784
$im -> colorAllocate(200, 200, 200),
778
785
);
779
786
$im -> header($imagewidth , $imageheight );
780
- my $inc = <<INC ;
787
+ my $backgroundinc = ' ' ;
788
+
789
+ if ($bgcolors ne ' none' ) {
790
+ $backgroundinc = <<INC ;
781
791
<defs>
782
792
<linearGradient id="background" y1="0" y2="1" x1="0" x2="0" >
783
793
<stop stop-color="$bgcolor1 " offset="5%" />
784
794
<stop stop-color="$bgcolor2 " offset="95%" />
785
795
</linearGradient>
786
796
</defs>
797
+ INC
798
+ }
799
+
800
+ my $inc = <<INC ;
801
+ ${backgroundinc}
787
802
<style type="text/css">
788
803
text { font-family:$fonttype ; font-size:${fontsize} px; fill:$black ; }
789
804
#search, #ignorecase { opacity:0.1; cursor:pointer; }
@@ -1200,7 +1215,7 @@ sub flow {
1200
1215
INC
1201
1216
$im -> include($inc );
1202
1217
$im -> filledRectangle(0, 0, $imagewidth , $imageheight , ' url(#background)' );
1203
- $im -> stringTTF(" title" , int ($imagewidth / 2), $fontsize * 2, $titletext );
1218
+ $im -> stringTTF(" title" , int ($imagewidth / 2), $fontsize * 2, $titletext ) if $titletext ne " " ;
1204
1219
$im -> stringTTF(" subtitle" , int ($imagewidth / 2), $fontsize * 4, $subtitletext ) if $subtitletext ne " " ;
1205
1220
$im -> stringTTF(" details" , $xpad , $imageheight - ($ypad2 / 2), " " );
1206
1221
$im -> stringTTF(" unzoom" , $xpad , $fontsize * 2, " Reset Zoom" , ' class="hide"' );
0 commit comments