diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-26 21:45:50 -0500 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-26 21:45:50 -0500 |
commit | 0c3f4a3168501cbfa20556ac71683a96d505076c (patch) | |
tree | 557759fa7921faad5c6023a3a001dbdd6127d798 | |
parent | 3d8155e0410235fc06203306ffb5e694c3f76879 (diff) | |
download | phoronix-test-suite-upstream-0c3f4a3168501cbfa20556ac71683a96d505076c.tar.gz phoronix-test-suite-upstream-0c3f4a3168501cbfa20556ac71683a96d505076c.tar.xz phoronix-test-suite-upstream-0c3f4a3168501cbfa20556ac71683a96d505076c.zip |
pts_Graph: Various changes to the graphing object
-rw-r--r-- | TYDAL-CHANGE-LOG | 1 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_software.php | 6 | ||||
-rw-r--r-- | pts-core/objects/pts_BarGraph.php | 4 | ||||
-rw-r--r-- | pts-core/objects/pts_Graph.php | 64 | ||||
-rw-r--r-- | pts-core/objects/pts_LineGraph.php | 4 | ||||
-rw-r--r-- | pts-core/objects/pts_MultiPassFailGraph.php | 4 | ||||
-rw-r--r-- | pts-core/objects/pts_PassFailGraph.php | 4 |
7 files changed, 53 insertions, 34 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG index 1c32936..7b833bd 100644 --- a/TYDAL-CHANGE-LOG +++ b/TYDAL-CHANGE-LOG @@ -7,6 +7,7 @@ Phoronix Test Suite (Git) - pts-core: When rendering graph results, report the PTS version number from the results file, not current PTS_VERSION - pts-core: Add support for detecting and reporting the desktop environment / version in use - tandem_XmlReader: Major performance improvements and optimizations +- pts_Graph: Various changes to the graphing object Phoronix Test Suite 1.6.0 Alpha 1 November 22, 2008 diff --git a/pts-core/functions/pts-functions_system_software.php b/pts-core/functions/pts-functions_system_software.php index 414ca9d..68b7a7d 100644 --- a/pts-core/functions/pts-functions_system_software.php +++ b/pts-core/functions/pts-functions_system_software.php @@ -67,12 +67,14 @@ function sw_os_virtualized_mode() function sw_os_filesystem() { // Determine file-system type - $fs = shell_exec("stat " . TEST_ENV_DIR . " -L -f -c %T 2> /dev/null"); - if(IS_MACOSX) { $fs = read_osx_system_profiler("SPSerialATADataType", "FileSystem"); } + else + { + $fs = shell_exec("stat " . TEST_ENV_DIR . " -L -f -c %T 2> /dev/null"); + } if(empty($fs) || IS_BSD) { diff --git a/pts-core/objects/pts_BarGraph.php b/pts-core/objects/pts_BarGraph.php index 15775f2..8243472 100644 --- a/pts-core/objects/pts_BarGraph.php +++ b/pts-core/objects/pts_BarGraph.php @@ -26,9 +26,9 @@ class pts_BarGraph extends pts_CustomGraph var $identifier_width = -1; var $minimum_identifier_font = 7; - public function __construct($Title, $SubTitle, $YTitle) + public function __construct($title, $sub_title, $y_axis_title) { - parent::__construct($Title, $SubTitle, $YTitle); + parent::__construct($title, $sub_title, $y_axis_title); $this->graph_type = "BAR_GRAPH"; } protected function render_graph_pre_init() diff --git a/pts-core/objects/pts_Graph.php b/pts-core/objects/pts_Graph.php index 99931d9..26e3916 100644 --- a/pts-core/objects/pts_Graph.php +++ b/pts-core/objects/pts_Graph.php @@ -87,11 +87,11 @@ class pts_Graph var $graph_user_identifiers = array(); - public function __construct($Title, $SubTitle, $YTitle) + public function __construct($title, $sub_title, $y_axis_title) { - $this->graph_title = $Title; - $this->graph_sub_title = $SubTitle; - $this->graph_y_title = $YTitle; + $this->graph_title = $title; + $this->graph_sub_title = $sub_title; + $this->graph_y_title = $y_axis_title; $this->update_graph_dimensions(-1, -1, true); @@ -109,9 +109,9 @@ class pts_Graph putenv("GDFONTPATH=" . getcwd()); } } - public function setRenderer($Renderer) + public function setRenderer($renderer) { - if($Renderer == "SVG") + if($renderer == "SVG") { $this->graph_renderer = "SVG"; $this->graph_left_start += 10; @@ -175,13 +175,13 @@ class pts_Graph array_push($this->graph_data_title, $data_title); } } - public function setGraphBackgroundPNG($File) + public function setGraphBackgroundPNG($file) { - $IMG = $this->read_png_image($File); + $img = $this->read_png_image($file); - if($IMG != false) + if($img != false) { - $this->graph_body_image = $IMG; + $this->graph_body_image = $img; } } @@ -228,14 +228,14 @@ class pts_Graph return $maximum; } - protected function return_ttf_string_width($String, $Font, $Size) + protected function return_ttf_string_width($string, $font, $size) { - $dimensions = $this->return_ttf_string_dimensions($String, $Font, $Size); + $dimensions = $this->return_ttf_string_dimensions($string, $font, $size); return $dimensions[0]; } - protected function return_ttf_string_height($String, $Font, $Size) + protected function return_ttf_string_height($string, $font, $size) { - $dimensions = $this->return_ttf_string_dimensions($String, $Font, $Size); + $dimensions = $this->return_ttf_string_dimensions($string, $font, $size); return $dimensions[1]; } protected function find_longest_string($arr_string) @@ -322,9 +322,9 @@ class pts_Graph $this->draw_rectangle($this->graph_image, $this->graph_left_start, $this->graph_top_start, $this->graph_left_end, $this->graph_top_end, $this->graph_color_body); $this->draw_rectangle_border($this->graph_image, $this->graph_left_start, $this->graph_top_start, $this->graph_left_end, $this->graph_top_end, $this->graph_color_notches); - if($this->graph_body_image != false && $this->graph_renderer == "PNG") + if($this->graph_body_image != false) { - imagecopymerge($this->graph_image, $this->graph_body_image, $this->graph_left_start + (($this->graph_left_end - $this->graph_left_start) / 2) - imagesx($this->graph_body_image) / 2, $this->graph_top_start + (($this->graph_top_end - $this->graph_top_start) / 2) - imagesy($this->graph_body_image) / 2, 0, 0, imagesx($this->graph_body_image), imagesy($this->graph_body_image), 95); + $this->image_copy_merge($this->graph_image, $this->graph_body_image, $this->graph_left_start + (($this->graph_left_end - $this->graph_left_start) / 2) - imagesx($this->graph_body_image) / 2, $this->graph_top_start + (($this->graph_top_end - $this->graph_top_start) / 2) - imagesy($this->graph_body_image) / 2); } // Text @@ -565,11 +565,11 @@ class pts_Graph } } } - protected function read_png_image($File) + protected function read_png_image($file) { if($this->graph_renderer == "PNG") { - $img = @imagecreatefrompng($File); + $img = @imagecreatefrompng($file); } else { @@ -589,15 +589,15 @@ class pts_Graph $img_object = null; } } - protected function convert_hex_to_type($Hex) + protected function convert_hex_to_type($hex) { if($this->graph_renderer == "PNG") { - $color = imagecolorallocate($this->graph_image, hexdec(substr($Hex, 1, 2)), hexdec(substr($Hex, 3, 2)), hexdec(substr($Hex, 5, 2))); + $color = imagecolorallocate($this->graph_image, hexdec(substr($hex, 1, 2)), hexdec(substr($hex, 3, 2)), hexdec(substr($hex, 5, 2))); } else if($this->graph_renderer == "SVG") { - $color = $Hex; + $color = $hex; } return $color; @@ -841,16 +841,32 @@ class pts_Graph $img_object .= "<line x1=\"" . round($left_start) . "\" y1=\"" . round($top_start) . "\" x2=\"" . round($from_left) . "\" y2=\"" . round($from_top) . "\" stroke=\"" . $color . "\" stroke-width=\"1px\" />\n"; } } - protected function return_ttf_string_dimensions($String, $Font, $Size, $Big = false) + protected function image_copy_merge(&$img_object, $source_img_object, $to_x, $to_y, $source_x = 0, $source_y = 0, $width = -1, $height = -1) + { + if($this->graph_renderer == "PNG") + { + if($width == -1) + { + $width = imagesx($source_img_object); + } + if($height == -1) + { + $height = imagesy($source_img_object); + } + + imagecopy($img_object, $source_img_object, $to_x, $to_y, $source_x, $source_y, $width, $height); + } + } + protected function return_ttf_string_dimensions($string, $font, $size, $Big = false) { if($this->graph_renderer == "PNG" && function_exists("imagettfbbox")) { - $box_array = imagettfbbox($Size, 0, $Font, $String); + $box_array = imagettfbbox($size, 0, $font, $string); $box_width = $box_array[4] - $box_array[6]; if($Big) { - $box_array = imagettfbbox($Size, 0, $Font, "AZ@![]()@|_"); + $box_array = imagettfbbox($size, 0, $font, "AZ@![]()@|_"); } $box_height = $box_array[1] - $box_array[7]; } diff --git a/pts-core/objects/pts_LineGraph.php b/pts-core/objects/pts_LineGraph.php index 9955009..f9beb4f 100644 --- a/pts-core/objects/pts_LineGraph.php +++ b/pts-core/objects/pts_LineGraph.php @@ -26,9 +26,9 @@ class pts_LineGraph extends pts_CustomGraph var $identifier_width = -1; var $minimum_identifier_font = 7; - public function __construct($Title, $SubTitle, $YTitle) + public function __construct($title, $sub_title, $y_axis_title) { - parent::__construct($Title, $SubTitle, $YTitle); + parent::__construct($title, $sub_title, $y_axis_title); $this->graph_type = "LINE_GRAPH"; $this->graph_show_key = true; $this->graph_background_lines = true; diff --git a/pts-core/objects/pts_MultiPassFailGraph.php b/pts-core/objects/pts_MultiPassFailGraph.php index e123aac..8d0b062 100644 --- a/pts-core/objects/pts_MultiPassFailGraph.php +++ b/pts-core/objects/pts_MultiPassFailGraph.php @@ -23,10 +23,10 @@ class pts_MultiPassFailGraph extends pts_CustomGraph { - public function __construct($Title, $SubTitle, $YTitle) + public function __construct($title, $sub_title, $y_axis_title) { $this->graph_y_title_hide = true; - parent::__construct($Title, $SubTitle, $YTitle, true); + parent::__construct($title, $sub_title, $y_axis_title); $this->graph_type = "MULTI_PASS_FAIL"; $this->graph_value_type = "ABSTRACT"; $this->graph_hide_identifiers = true; diff --git a/pts-core/objects/pts_PassFailGraph.php b/pts-core/objects/pts_PassFailGraph.php index fe2fa1a..31bd5e1 100644 --- a/pts-core/objects/pts_PassFailGraph.php +++ b/pts-core/objects/pts_PassFailGraph.php @@ -23,9 +23,9 @@ class pts_PassFailGraph extends pts_CustomGraph { - public function __construct($Title, $SubTitle, $YTitle) + public function __construct($title, $sub_title, $y_axis_title) { - parent::__construct($Title, $SubTitle, $YTitle); + parent::__construct($title, $sub_title, $y_axis_title); $this->graph_type = "PASS_FAIL"; $this->graph_value_type = "ABSTRACT"; $this->graph_hide_identifiers = true; |