Fossil SCM

Reinstate the timeline arrow foreground color changes that were removed by check-in [7ac88481a69dd], but with fixes to avoid integer overflow.

drh 2018-06-14 13:48 trunk merge
Commit 57a0143b52d5c90f5bba64e10356c4016a35d5d7495de1db260d8e8633a6b4f1
1 file changed +5 -5
+5 -5
--- src/timeline.c
+++ src/timeline.c
@@ -747,11 +747,10 @@
747747
@ </table>
748748
if( fchngQueryInit ) db_finalize(&fchngQuery);
749749
timeline_output_graph_javascript(pGraph, tmFlags, iTableId);
750750
}
751751
752
-#if 0 /* not used */
753752
/*
754753
** Change the RGB background color given in the argument in a foreground
755754
** color with the same hue.
756755
*/
757756
static const char *bg_to_fg(const char *zIn){
@@ -773,16 +772,19 @@
773772
static const unsigned int t = 215;
774773
if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx;
775774
}else{
776775
/* Make the color darker */
777776
static const unsigned int t = 128;
778
- if( mx>t ) for(i=0; i<3; i++) x[i] -= mx - t;
777
+ if( mx>t ){
778
+ for(i=0; i<3; i++){
779
+ x[i] = x[i]>=mx-t ? x[i] - (mx-t) : 0;
780
+ }
781
+ }
779782
}
780783
sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]);
781784
return zRes;
782785
}
783
-#endif /* not used */
784786
785787
/*
786788
** Generate all of the necessary javascript to generate a timeline
787789
** graph.
788790
*/
@@ -880,15 +882,13 @@
880882
cSep = ',';
881883
}
882884
}
883885
if( cSep=='[' ) cgi_printf("[");
884886
cgi_printf("],");
885
-#if 0
886887
if( colorGraph && pRow->zBgClr[0]=='#' ){
887888
cgi_printf("\"fg\":\"%s\",", bg_to_fg(pRow->zBgClr));
888889
}
889
-#endif
890890
/* mi */
891891
cgi_printf("\"mi\":");
892892
cSep = '[';
893893
for(i=0; i<GR_MAX_RAIL; i++){
894894
if( pRow->mergeIn[i] ){
895895
--- src/timeline.c
+++ src/timeline.c
@@ -747,11 +747,10 @@
747 @ </table>
748 if( fchngQueryInit ) db_finalize(&fchngQuery);
749 timeline_output_graph_javascript(pGraph, tmFlags, iTableId);
750 }
751
752 #if 0 /* not used */
753 /*
754 ** Change the RGB background color given in the argument in a foreground
755 ** color with the same hue.
756 */
757 static const char *bg_to_fg(const char *zIn){
@@ -773,16 +772,19 @@
773 static const unsigned int t = 215;
774 if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx;
775 }else{
776 /* Make the color darker */
777 static const unsigned int t = 128;
778 if( mx>t ) for(i=0; i<3; i++) x[i] -= mx - t;
 
 
 
 
779 }
780 sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]);
781 return zRes;
782 }
783 #endif /* not used */
784
785 /*
786 ** Generate all of the necessary javascript to generate a timeline
787 ** graph.
788 */
@@ -880,15 +882,13 @@
880 cSep = ',';
881 }
882 }
883 if( cSep=='[' ) cgi_printf("[");
884 cgi_printf("],");
885 #if 0
886 if( colorGraph && pRow->zBgClr[0]=='#' ){
887 cgi_printf("\"fg\":\"%s\",", bg_to_fg(pRow->zBgClr));
888 }
889 #endif
890 /* mi */
891 cgi_printf("\"mi\":");
892 cSep = '[';
893 for(i=0; i<GR_MAX_RAIL; i++){
894 if( pRow->mergeIn[i] ){
895
--- src/timeline.c
+++ src/timeline.c
@@ -747,11 +747,10 @@
747 @ </table>
748 if( fchngQueryInit ) db_finalize(&fchngQuery);
749 timeline_output_graph_javascript(pGraph, tmFlags, iTableId);
750 }
751
 
752 /*
753 ** Change the RGB background color given in the argument in a foreground
754 ** color with the same hue.
755 */
756 static const char *bg_to_fg(const char *zIn){
@@ -773,16 +772,19 @@
772 static const unsigned int t = 215;
773 if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx;
774 }else{
775 /* Make the color darker */
776 static const unsigned int t = 128;
777 if( mx>t ){
778 for(i=0; i<3; i++){
779 x[i] = x[i]>=mx-t ? x[i] - (mx-t) : 0;
780 }
781 }
782 }
783 sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]);
784 return zRes;
785 }
 
786
787 /*
788 ** Generate all of the necessary javascript to generate a timeline
789 ** graph.
790 */
@@ -880,15 +882,13 @@
882 cSep = ',';
883 }
884 }
885 if( cSep=='[' ) cgi_printf("[");
886 cgi_printf("],");
 
887 if( colorGraph && pRow->zBgClr[0]=='#' ){
888 cgi_printf("\"fg\":\"%s\",", bg_to_fg(pRow->zBgClr));
889 }
 
890 /* mi */
891 cgi_printf("\"mi\":");
892 cSep = '[';
893 for(i=0; i<GR_MAX_RAIL; i++){
894 if( pRow->mergeIn[i] ){
895

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button