From: <ai...@us...> - 2010-10-28 16:26:22
|
Revision: 11282 http://plplot.svn.sourceforge.net/plplot/?rev=11282&view=rev Author: airwin Date: 2010-10-28 16:26:09 +0000 (Thu, 28 Oct 2010) Log Message: ----------- Comment-style upgrade for C drivers. Modified Paths: -------------- trunk/drivers/aqt.c trunk/drivers/cairo.c trunk/drivers/cgm.c trunk/drivers/dg300.c trunk/drivers/gcw.c trunk/drivers/gd.c trunk/drivers/hpgl.c trunk/drivers/impress.c trunk/drivers/linuxvga.c trunk/drivers/ljii.c trunk/drivers/ljiip.c trunk/drivers/mem.c trunk/drivers/ntk.c trunk/drivers/null.c trunk/drivers/pbm.c trunk/drivers/pdf.c trunk/drivers/plmeta.c trunk/drivers/plplotcanvas-hacktext.c trunk/drivers/ps.c trunk/drivers/pstex.c trunk/drivers/svg.c trunk/drivers/tek.c trunk/drivers/test-drv-info.c trunk/drivers/tk.c trunk/drivers/tkwin.c trunk/drivers/wingcc.c trunk/drivers/xfig.c trunk/drivers/xwin.c trunk/scripts/style_source.sh Modified: trunk/drivers/aqt.c =================================================================== --- trunk/drivers/aqt.c 2010-10-27 06:52:54 UTC (rev 11281) +++ trunk/drivers/aqt.c 2010-10-28 16:26:09 UTC (rev 11282) @@ -1,43 +1,43 @@ -/* March 12, 2005 - * - * PLplot driver for AquaTerm and Mac OS X. - * - * Copyright (C) Per Persson - * Copyright (C) 2005 Hazen Babcock - * - * This file is part of PLplot. - * - * PLplot is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Library Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * PLplot is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with PLplot; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ +// March 12, 2005 +// +// PLplot driver for AquaTerm and Mac OS X. +// +// Copyright (C) Per Persson +// Copyright (C) 2005 Hazen Babcock +// +// This file is part of PLplot. +// +// PLplot is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Library Public License as published +// by the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PLplot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with PLplot; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// -/*--------------------------------------------- - * Header files, defines and local variables - * ---------------------------------------------*/ +//--------------------------------------------- +// Header files, defines and local variables +// --------------------------------------------- -/* OS X specific header files */ +// OS X specific header files #import <Foundation/Foundation.h> #import <AquaTerm/AQTAdapter.h> -/* PLplot header files */ +// PLplot header files #include "plplotP.h" #include "drivers.h" -/* constants */ +// constants #define SCALE 0.1 #define AQT_Default_X 720 @@ -46,10 +46,10 @@ #define MAX_STRING_LEN 1000 -/* local variables */ +// local variables -static NSAutoreleasePool *arpool; /* Objective-C autorelease pool */ -static id adapter; /* Adapter object */ +static NSAutoreleasePool *arpool; // Objective-C autorelease pool +static id adapter; // Adapter object PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_aqt = "aqt:AquaTerm (Mac OS X):1:aqt:50:aqt\n"; @@ -62,14 +62,14 @@ static bool hasShear = false; static bool hasAlpha = false; -/* font stuff */ +// font stuff -/* - * AquaTerm font look-up table - * - * The table is initialized with lowest common denominator truetype - * fonts that (I hope) most Macs will have. - */ +// +// AquaTerm font look-up table +// +// The table is initialized with lowest common denominator truetype +// fonts that (I hope) most Macs will have. +// #define AQT_N_FontLookup 30 static FCI_to_FontName_Table AQT_FontLookup[AQT_N_FontLookup] = { @@ -105,29 +105,29 @@ { PL_FCI_MARK | 0x124, (unsigned char *) "LucidaGrande Regular" } }; -/* - * AquaTerm font environment variables - * - * When the driver is initialized it will check to see if - * the user has opted to overide one of the above fonts by - * setting one of the environment variables below. - * - * This list must be in the same order with the same number of - * elements as the above list - * - * These are the same environment variable names as would be used - * on a linux system, but they have a slightly different meaning. - * Since AquaTerm will find the font for us (if it can) given - * just the font name, you should only set the environment - * variable to the font name. You don't need to provide - * a path. If you installed the font using Font Book, AquaTerm - * should not have any trouble finding it. - * - * FIXME: Would it be better to use different environment variable - * names then plfreetype.c? If not, then it probably isn't - * ideal to have two different copies of the same list of - * environment variable names. - */ +// +// AquaTerm font environment variables +// +// When the driver is initialized it will check to see if +// the user has opted to overide one of the above fonts by +// setting one of the environment variables below. +// +// This list must be in the same order with the same number of +// elements as the above list +// +// These are the same environment variable names as would be used +// on a linux system, but they have a slightly different meaning. +// Since AquaTerm will find the font for us (if it can) given +// just the font name, you should only set the environment +// variable to the font name. You don't need to provide +// a path. If you installed the font using Font Book, AquaTerm +// should not have any trouble finding it. +// +// FIXME: Would it be better to use different environment variable +// names then plfreetype.c? If not, then it probably isn't +// ideal to have two different copies of the same list of +// environment variable names. +// const char *aqt_font_env_names[AQT_N_FontLookup] = { "PLPLOT_FREETYPE_SANS_FONT", @@ -162,7 +162,7 @@ "PLPLOT_FREETYPE_SYMBOL_BOLD_OBLIQUE_FONT" }; -/* Debugging extras */ +// Debugging extras static inline void NOOP_( id x, ... ) { @@ -173,13 +173,13 @@ #define LOG NSLog #else #define LOG NOOP_ -#endif /* LOGGING */ +#endif // LOGGING -/*----------------------------------------------- - * function declarations - * -----------------------------------------------*/ +//----------------------------------------------- +// function declarations +// ----------------------------------------------- -/* helper functions */ +// helper functions static void get_cursor( PLStream *, PLGraphicsIn * ); static void proc_str( PLStream *, EscText * ); @@ -187,7 +187,7 @@ static void set_font_and_size( NSMutableAttributedString *, PLUNICODE, PLFLT, int ); static void check_font_environment_variables( void ); -/* PLplot interface functions */ +// PLplot interface functions void plD_dispatch_init_aqt( PLDispatchTable *pdt ); void plD_init_aqt( PLStream * ); @@ -199,11 +199,11 @@ void plD_state_aqt( PLStream *, PLINT ); void plD_esc_aqt( PLStream *, PLINT, void * ); -/*--------------------------------------------------------------------- - * dispatch_init_init() - * - * Initialize device dispatch table - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// dispatch_init_init() +// +// Initialize device dispatch table +// --------------------------------------------------------------------- void plD_dispatch_init_aqt( PLDispatchTable *pdt ) { @@ -223,32 +223,32 @@ pdt->pl_esc = (plD_esc_fp) plD_esc_aqt; } -/*--------------------------------------------------------------------- - * aqt_init() - * - * Initialize device - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// aqt_init() +// +// Initialize device +// --------------------------------------------------------------------- void plD_init_aqt( PLStream *pls ) { - if ( arpool == NULL ) /* Make sure we don't leak mem by allocating every time */ + if ( arpool == NULL ) // Make sure we don't leak mem by allocating every time { arpool = [[NSAutoreleasePool alloc] init]; adapter = [[AQTAdapter alloc] init]; } [adapter setBackgroundColorRed : 0.5 green : 0.5 blue : 0.5]; - pls->termin = 1; /* interactive device */ - pls->dev_flush = 1; /* Handle our own flushes */ - pls->color = 1; /* supports color */ + pls->termin = 1; // interactive device + pls->dev_flush = 1; // Handle our own flushes + pls->color = 1; // supports color pls->width = 1; pls->verbose = 1; pls->bytecnt = 0; pls->debug = 1; - pls->dev_text = 1; /* handles text */ - pls->dev_unicode = 1; /* wants text as unicode */ + pls->dev_text = 1; // handles text + pls->dev_unicode = 1; // wants text as unicode pls->page = 0; - pls->dev_fill0 = 1; /* supports hardware solid fills */ + pls->dev_fill0 = 1; // supports hardware solid fills pls->dev_fill1 = 1; pls->graphx = GRAPHICS_MODE; @@ -256,11 +256,11 @@ if ( !pls->colorset ) pls->color = 1; - /* Set up device parameters */ + // Set up device parameters - plP_setpxl( DPI / 25.4 / SCALE, DPI / 25.4 / SCALE ); /* Pixels/mm. */ + plP_setpxl( DPI / 25.4 / SCALE, DPI / 25.4 / SCALE ); // Pixels/mm. - /* Set the bounds for plotting. default is AQT_Default_X x AQT_Default_Y unless otherwise specified. */ + // Set the bounds for plotting. default is AQT_Default_X x AQT_Default_Y unless otherwise specified. if ( pls->xlength <= 0 || pls->ylength <= 0 ) { @@ -275,12 +275,12 @@ plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / SCALE ), (PLINT) 0, (PLINT) ( pls->ylength / SCALE ) ); } - /* check font environment variables & update font table as necessary */ + // check font environment variables & update font table as necessary check_font_environment_variables(); - /* Check to see if the users version of aquaterm supports sheared labels. */ - /* If it isn't available 3D plots will look a little strange but things should otherwise be okay. */ + // Check to see if the users version of aquaterm supports sheared labels. + // If it isn't available 3D plots will look a little strange but things should otherwise be okay. if ( !didTests ) { @@ -290,11 +290,11 @@ } } -/*---------------------------------------------------------------------- - * aqt_bop() - * - * Set up for the next page. - * ----------------------------------------------------------------------*/ +//---------------------------------------------------------------------- +// aqt_bop() +// +// Set up for the next page. +// ---------------------------------------------------------------------- void plD_bop_aqt( PLStream *pls ) { @@ -319,11 +319,11 @@ pls->page++; } -/*--------------------------------------------------------------------- - * aqt_line() - * - * Draw a line in the current color from (x1,y1) to (x2,y2). - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// aqt_line() +// +// Draw a line in the current color from (x1,y1) to (x2,y2). +// --------------------------------------------------------------------- void plD_line_aqt( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { @@ -331,11 +331,11 @@ [adapter addLineToPoint : NSMakePoint( (float) x2a * SCALE, (float) y2a * SCALE )]; } -/*--------------------------------------------------------------------- - * aqt_polyline() - * - * Draw a polyline in the current color. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// aqt_polyline() +// +// Draw a polyline in the current color. +// --------------------------------------------------------------------- void plD_polyline_aqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { @@ -345,36 +345,36 @@ plD_line_aqt( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } -/*--------------------------------------------------------------------- - * aqt_eop() - * - * End of page - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// aqt_eop() +// +// End of page +// --------------------------------------------------------------------- void plD_eop_aqt( PLStream *pls ) { - [arpool release]; /* prevents a memory leak by freeing everything in */ - /* the auto-release pool when the plot is closed. */ + [arpool release]; // prevents a memory leak by freeing everything in + // the auto-release pool when the plot is closed. arpool = [[NSAutoreleasePool alloc] init]; [adapter renderPlot]; } -/*--------------------------------------------------------------------- - * aqt_tidy() - * - * Close graphics file or otherwise clean up. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// aqt_tidy() +// +// Close graphics file or otherwise clean up. +// --------------------------------------------------------------------- void plD_tidy_aqt( PLStream *pls ) { [adapter closePlot]; } -/*--------------------------------------------------------------------- - * plD_state_aqt() - * - * Handle change in PLStream state (color, pen width, fill attribute, etc). - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_state_aqt() +// +// Handle change in PLStream state (color, pen width, fill attribute, etc). +// --------------------------------------------------------------------- void plD_state_aqt( PLStream *pls, PLINT op ) { @@ -387,7 +387,7 @@ [adapter setLinewidth : (float) pls->width]; break; - case PLSTATE_COLOR0: /* this seems to work, but that isn't to say that it is done right... */ + case PLSTATE_COLOR0: // this seems to work, but that isn't to say that it is done right... if ( hasAlpha ) { [adapter setBackgroundColorRed : (float) ( plsc->cmap0[0].r / 255.0 ) @@ -426,38 +426,38 @@ } } -/*--------------------------------------------------------------------- - * aqt_esc() - * - * Escape function. - * - * Functions: - * - * PLESC_EH Handle pending events - * PLESC_EXPOSE Force an expose - * PLESC_FILL Fill polygon - * PLESC_FLUSH Flush X event buffer - * PLESC_GETC Get coordinates upon mouse click - * PLESC_REDRAW Force a redraw - * PLESC_RESIZE Force a resize - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// aqt_esc() +// +// Escape function. +// +// Functions: +// +// PLESC_EH Handle pending events +// PLESC_EXPOSE Force an expose +// PLESC_FILL Fill polygon +// PLESC_FLUSH Flush X event buffer +// PLESC_GETC Get coordinates upon mouse click +// PLESC_REDRAW Force a redraw +// PLESC_RESIZE Force a resize +// --------------------------------------------------------------------- void plD_esc_aqt( PLStream *pls, PLINT op, void *ptr ) { int i; switch ( op ) { - case PLESC_EXPOSE: /* handle window expose */ + case PLESC_EXPOSE: // handle window expose break; - case PLESC_RESIZE: /* handle window resize */ + case PLESC_RESIZE: // handle window resize break; - case PLESC_REDRAW: /* handle window redraw */ + case PLESC_REDRAW: // handle window redraw break; - case PLESC_TEXT: /* switch to text screen */ + case PLESC_TEXT: // switch to text screen break; - case PLESC_GRAPH: /* switch to graphics screen */ + case PLESC_GRAPH: // switch to graphics screen break; - case PLESC_FILL: /* fill polygon */ + case PLESC_FILL: // fill polygon [adapter moveToVertexPoint : NSMakePoint( pls->dev_x[0] * SCALE, pls->dev_y[0] * SCALE )]; for ( i = 1; i < pls->dev_npts; i++ ) { @@ -465,18 +465,18 @@ } ; break; - case PLESC_DI: /* handle DI command */ + case PLESC_DI: // handle DI command break; - case PLESC_FLUSH: /* flush output */ + case PLESC_FLUSH: // flush output [adapter renderPlot]; break; - case PLESC_EH: /* handle Window events */ + case PLESC_EH: // handle Window events break; - case PLESC_GETC: /* get cursor position */ - [adapter renderPlot]; /* needed to give the user something to click on */ + case PLESC_GETC: // get cursor position + [adapter renderPlot]; // needed to give the user something to click on get_cursor( pls, (PLGraphicsIn*) ptr ); break; - case PLESC_SWIN: /* set window parameters */ + case PLESC_SWIN: // set window parameters break; case PLESC_HAS_TEXT: proc_str( pls, (EscText *) ptr ); @@ -484,11 +484,11 @@ } } -/*--------------------------------------------------------------------- - * get_cursor() - * - * returns the location of the next mouse click - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// get_cursor() +// +// returns the location of the next mouse click +// --------------------------------------------------------------------- void get_cursor( PLStream *pls, PLGraphicsIn *gin ) { @@ -500,7 +500,7 @@ temp = [adapter waitNextEvent]; scanned = sscanf([temp cString], "1:{%d, %d}:%d", &x, &y, &button ); - if ( scanned == 3 ) /* check that we did actually get a reasonable event string */ + if ( scanned == 3 ) // check that we did actually get a reasonable event string { gin->button = button; gin->pX = x; @@ -508,7 +508,7 @@ gin->dX = (PLFLT) x / ( (PLFLT) ( pls->xlength ) ); gin->dY = (PLFLT) y / ( (PLFLT) ( pls->ylength ) ); } - else /* just return zeroes if we did not */ + else // just return zeroes if we did not { printf( "AquaTerm did not return a valid mouse location!\n" ); gin->button = 0; @@ -519,12 +519,12 @@ } } -/*--------------------------------------------------------------------- - * proc_str() - * - * Processes strings for display. The actual parsing of the unicode - * string is handled by the sub-routine create_string. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// proc_str() +// +// Processes strings for display. The actual parsing of the unicode +// string is handled by the sub-routine create_string. +// --------------------------------------------------------------------- void proc_str( PLStream *pls, EscText *args ) { @@ -533,7 +533,7 @@ int i, jst, ref; NSMutableAttributedString *str; - /* check that we got unicode, warning message and return if not */ + // check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { @@ -541,7 +541,7 @@ return; } - /* check that unicode string isn't longer then the max we allow */ + // check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= MAX_STRING_LEN ) { @@ -549,40 +549,40 @@ return; } - /* set the font height - the 1.2 factor was trial and error */ + // set the font height - the 1.2 factor was trial and error - ft_ht = 1.2 * pls->chrht * DPI / 25.4; /* ft_ht in points. ht is in mm */ + ft_ht = 1.2 * pls->chrht * DPI / 25.4; // ft_ht in points. ht is in mm - /* given transform, calculate rotation angle & shear angle */ + // given transform, calculate rotation angle & shear angle plRotationShear( args->xform, &angle, &shear, &stride ); angle *= 180.0 / PI; shear *= -180.0 / PI; - /* text justification, AquaTerm only supports 3 options, so we round appropriately */ + // text justification, AquaTerm only supports 3 options, so we round appropriately if ( args->just < 0.33 ) - jst = AQTAlignLeft; /* left */ + jst = AQTAlignLeft; // left else if ( args->just > 0.66 ) - jst = AQTAlignRight; /* right */ + jst = AQTAlignRight; // right else - jst = AQTAlignCenter; /* center */ + jst = AQTAlignCenter; // center - /* set the baseline of the string */ - /* Middle and Bottom are set to Middle since this seems to be what PLplot expects - * as judged by where it renders the symbols in example 1. */ + // set the baseline of the string + // Middle and Bottom are set to Middle since this seems to be what PLplot expects + // as judged by where it renders the symbols in example 1. - if ( args->base == 2 ) /* Top */ + if ( args->base == 2 ) // Top ref = AQTAlignTop; - else if ( args->base == 1 ) /* Bottom */ + else if ( args->base == 1 ) // Bottom ref = AQTAlignMiddle; else - ref = AQTAlignMiddle; /* Middle */ + ref = AQTAlignMiddle; // Middle - /* create an appropriately formatted, etc... unicode string */ + // create an appropriately formatted, etc... unicode string str = create_string( args->unicode_array, args->unicode_array_len, ft_ht ); - /* display the string */ + // display the string if ( hasAlpha ) { @@ -617,18 +617,18 @@ [str release]; } -/*--------------------------------------------------------------------- - * create_string() - * - * create a NSMutableAttributedString from the plplot ucs4 string - * - * assumptions : - * 1. font changes are unicode >= PL_FCI_MARK - * 2. we'll never have to deal with a string longer then MAX_STRING_LEN characters - * 3. <esc><esc> means we desired <esc> as a character & not actually as <esc> - * 4. there are no two character <esc> sequences... i.e. <esc>fn is now covered by fci - * - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// create_string() +// +// create a NSMutableAttributedString from the plplot ucs4 string +// +// assumptions : +// 1. font changes are unicode >= PL_FCI_MARK +// 2. we'll never have to deal with a string longer then MAX_STRING_LEN characters +// 3. <esc><esc> means we desired <esc> as a character & not actually as <esc> +// 4. there are no two character <esc> sequences... i.e. <esc>fn is now covered by fci +// +// --------------------------------------------------------------------- NSMutableAttributedString * create_string( const PLUNICODE *ucs4, int ucs4_len, PLFLT font_height ) { @@ -645,31 +645,31 @@ updown = 0; - /* initialize the attributed string */ + // initialize the attributed string for ( i = 0; i < MAX_STRING_LEN; i++ ) dummy[i] = 'i'; dummy[MAX_STRING_LEN] = '\0'; str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithCString:dummy]]; - /* get plplot escape character & current font */ + // get plplot escape character & current font plgesc( &plplot_esc ); plgfci( &fci ); - /* set the font for the string based on the current font & size */ + // set the font for the string based on the current font & size set_font_and_size( str, fci, font_height, 0 ); - /* parse plplot ucs4 string */ + // parse plplot ucs4 string cur_loc = 0; i = 0; while ( i < ucs4_len ) { - if ( ucs4[i] < PL_FCI_MARK ) /* not a font change */ + if ( ucs4[i] < PL_FCI_MARK ) // not a font change { - if ( ucs4[i] != (PLUNICODE) plplot_esc ) /* a character to display */ + if ( ucs4[i] != (PLUNICODE) plplot_esc ) // a character to display { ucs4_to_utf8( ucs4[i], utf8 ); [str replaceCharactersInRange : NSMakeRange( cur_loc, 1 ) @@ -690,19 +690,19 @@ } else { - if ( ucs4[i] == (PLUNICODE) 'f' ) /* font change */ + if ( ucs4[i] == (PLUNICODE) 'f' ) // font change { i++; printf( "hmm, unicode string apparently not following fci convention...\n" ); } - if ( ucs4[i] == (PLUNICODE) 'd' ) /* Subscript */ + if ( ucs4[i] == (PLUNICODE) 'd' ) // Subscript { updown--; [str addAttribute : @ "NSSuperScript" value :[NSNumber numberWithInt : updown] range : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; } - if ( ucs4[i] == (PLUNICODE) 'u' ) /* Superscript */ + if ( ucs4[i] == (PLUNICODE) 'u' ) // Superscript { updown++; [str addAttribute : @ "NSSuperScript" @@ -712,25 +712,25 @@ i++; } } - else /* a font change */ + else // a font change { set_font_and_size( str, ucs4[i], font_height, cur_loc ); i++; } } - /* trim string to appropriate final length */ + // trim string to appropriate final length [str deleteCharactersInRange : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; return str; } -/*--------------------------------------------------------------------- - * set_font_and_size - * - * set the font & size of a attributable string object - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// set_font_and_size +// +// set the font & size of a attributable string object +// --------------------------------------------------------------------- void set_font_and_size( NSMutableAttributedString * str, PLUNICODE fci, PLFLT font_height, int cur_loc ) { @@ -738,7 +738,7 @@ font = plP_FCI2FontName( fci, AQT_FontLookup, AQT_N_FontLookup ); - /* check whether that font exists & if not, use standard font instread */ + // check whether that font exists & if not, use standard font instread if ( font == NULL ) { @@ -746,7 +746,7 @@ font = "Helvetica"; } /* font = "FreeSerif"; *//* force the font for debugging purposes */ - /* printf("Font at %d is : %s\n", cur_loc, font); */ + // printf("Font at %d is : %s\n", cur_loc, font); [str addAttribute : @ "AQTFontname" value :[NSString stringWithCString : font] @@ -756,14 +756,14 @@ range : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; } -/*--------------------------------------------------------------------- - * check_font_environment_variables - * - * Checks to see if any font environment variables are defined. - * If a font environment variable is defined, then the appropriate - * element of the default font table is replaced with the font name - * string specified by the environment variable. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// check_font_environment_variables +// +// Checks to see if any font environment variables are defined. +// If a font environment variable is defined, then the appropriate +// element of the default font table is replaced with the font name +// string specified by the environment variable. +// --------------------------------------------------------------------- void check_font_environment_variables( void ) @@ -777,11 +777,11 @@ { if ( ( new_font = getenv( aqt_font_env_names[i] ) ) != NULL ) { - /* If the user is just blindly following the suggestions in - * the plplot examples then we might get a font name with - * a path and extension. We need to remove that since it - * isn't relevant and will only cause trouble. We warn them - * AquaTerm was not expecting a path or extension. */ + // If the user is just blindly following the suggestions in + // the plplot examples then we might get a font name with + // a path and extension. We need to remove that since it + // isn't relevant and will only cause trouble. We warn them + // AquaTerm was not expecting a path or extension. begin = strrchr( new_font, '/' ); end = strrchr( new_font, '.' ); @@ -797,7 +797,7 @@ new_font = begin + 1; } - /* printf("new font : %s\n", new_font); */ + // printf("new font : %s\n", new_font); AQT_FontLookup[i].pfont = (unsigned char*) new_font; } Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2010-10-27 06:52:54 UTC (rev 11281) +++ trunk/drivers/cairo.c 2010-10-28 16:26:09 UTC (rev 11282) @@ -1,31 +1,31 @@ -/* June 2, 2007 - * - * Graphics drivers that are based on the Cairo / Pango Libraries. - * - * Copyright (C) 2008 Hazen Babcock - * Copyright (C) 2009, 2010 Hezekiah M. Carty - * - * This file is part of PLplot. - * - * PLplot is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Library Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * PLplot is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with PLplot; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ +// June 2, 2007 +// +// Graphics drivers that are based on the Cairo / Pango Libraries. +// +// Copyright (C) 2008 Hazen Babcock +// Copyright (C) 2009, 2010 Hezekiah M. Carty +// +// This file is part of PLplot. +// +// PLplot is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Library Public License as published +// by the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PLplot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with PLplot; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// -/*--------------------------------------------------------------------- - * Header files - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// Header files +// --------------------------------------------------------------------- #include <stdio.h> #include <string.h> @@ -34,13 +34,13 @@ #include <cairo.h> #include <pango/pangocairo.h> -/* PLplot header files (must occur before driver-dependent includes) */ +// PLplot header files (must occur before driver-dependent includes) #include "plDevs.h" #include "plplotP.h" #include "drivers.h" -/* Driver-dependent includes */ +// Driver-dependent includes #if defined ( PLD_xcairo ) #include <cairo-xlib.h> #include <X11/X.h> @@ -62,9 +62,9 @@ #include <windows.h> #endif -/*--------------------------------------------------------------------- - * Constants & global (to this file) variables - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// Constants & global (to this file) variables +// --------------------------------------------------------------------- #define DPI 72 #define PLCAIRO_DEFAULT_X 720 @@ -160,10 +160,10 @@ #endif ; -/* - * Structure for passing external drawables to xcairo devices via - * the PLESC_DEVINIT escape function. - */ +// +// Structure for passing external drawables to xcairo devices via +// the PLESC_DEVINIT escape function. +// #if defined ( PLD_xcairo ) typedef struct { @@ -172,10 +172,10 @@ } PLXcairoDrawableInfo; #endif -/*--------------------------------------------------------------------- - * Font style and weight lookup tables (copied - * from the psttf driver). - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// Font style and weight lookup tables (copied +// from the psttf driver). +// --------------------------------------------------------------------- #define NPANGOLOOKUP 5 @@ -212,25 +212,25 @@ }; -/*--------------------------------------------------------------------- - * --------------------------------------------------------------------- - * - * That which is common to all the Cairo Drivers - * - * --------------------------------------------------------------------- - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// --------------------------------------------------------------------- +// +// That which is common to all the Cairo Drivers +// +// --------------------------------------------------------------------- +// --------------------------------------------------------------------- -/*--------------------------------------------------------------------- - * function declarations - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// function declarations +// --------------------------------------------------------------------- -/* General */ +// General PLCairo *stream_and_font_setup( PLStream *, int ); cairo_status_t write_to_stream( void *, unsigned char *, unsigned int ); void set_clip( PLStream *pls ); -/* String processing */ +// String processing static void proc_str( PLStream *, EscText * ); static void text_begin_cairo( PLStream *pls, EscText *args ); @@ -242,7 +242,7 @@ static void close_span_tag( char *, int ); static char *rise_span_tag( int, int ); -/* Graphics */ +// Graphics static void set_current_context( PLStream * ); static void poly_line( PLStream *, short *, short *, PLINT ); @@ -250,13 +250,13 @@ static void gradient( PLStream *pls, short *xa, short *ya, PLINT npts ); static void arc( PLStream *, arc_struct * ); static void rotate_cairo_surface( PLStream *, float, float, float, float, float, float, PLBOOL ); -/* Rasterization of plotted material */ +// Rasterization of plotted material static void start_raster( PLStream* ); static void end_raster( PLStream* ); -/* PLplot interface functions */ +// PLplot interface functions -/* general */ +// general void plD_bop_cairo( PLStream * ); void plD_eop_cairo( PLStream * ); void plD_state_cairo( PLStream *, PLINT ); @@ -265,11 +265,11 @@ void plD_line_cairo( PLStream *, short, short, short, short ); void plD_polyline_cairo( PLStream *, short *, short *, PLINT ); -/*---------------------------------------------------------------------- - * start_raster() - * - * Set up off-screen rasterized rendering - * ----------------------------------------------------------------------*/ +//---------------------------------------------------------------------- +// start_raster() +// +// Set up off-screen rasterized rendering +// ---------------------------------------------------------------------- void start_raster( PLStream *pls ) { @@ -282,41 +282,41 @@ if ( aStream->closed ) return; - /* Do not use the external surface if the user says not to */ + // Do not use the external surface if the user says not to if ( !aStream->rasterize_image ) return; - /* Create an image surface and context for the offscreen rendering */ + // Create an image surface and context for the offscreen rendering aStream->cairoSurface_raster = - /* - * cairo_surface_create_similar( aStream->cairoSurface, - * CAIRO_CONTENT_COLOR, - * pls->xlength, pls->ylength ); - */ + // + // cairo_surface_create_similar( aStream->cairoSurface, + // CAIRO_CONTENT_COLOR, + // pls->xlength, pls->ylength ); + // cairo_image_surface_create( CAIRO_FORMAT_ARGB32, pls->xlength, pls->ylength ); aStream->cairoContext_raster = cairo_create( aStream->cairoSurface_raster ); - /* Disable antialiasing for the raster surface. The output seems to look - * better that way. */ + // Disable antialiasing for the raster surface. The output seems to look + // better that way. cairo_set_antialias( aStream->cairoContext_raster, CAIRO_ANTIALIAS_NONE ); - /* Swap the raster and main plot surfaces and contexts */ + // Swap the raster and main plot surfaces and contexts tmp_sfc = aStream->cairoSurface; tmp_context = aStream->cairoContext; aStream->cairoSurface = aStream->cairoSurface_raster; aStream->cairoContext = aStream->cairoContext_raster; - /* Save the main plot surface and context for when we are finished */ + // Save the main plot surface and context for when we are finished aStream->cairoSurface_raster = tmp_sfc; aStream->cairoContext_raster = tmp_context; } -/*---------------------------------------------------------------------- - * end_raster() - * - * Finish off-screen rasterized rendering and copy the result on to the - * main plot surface. - * ----------------------------------------------------------------------*/ +//---------------------------------------------------------------------- +// end_raster() +// +// Finish off-screen rasterized rendering and copy the result on to the +// main plot surface. +// ---------------------------------------------------------------------- void end_raster( PLStream *pls ) { @@ -329,19 +329,19 @@ if ( aStream->closed ) return; - /* TODO FIXME: This should really only copy the used portion of the - * offscreen pixmap. */ + // TODO FIXME: This should really only copy the used portion of the + // offscreen pixmap. - /* Do not use the external surface if the user says not to */ + // Do not use the external surface if the user says not to if ( !aStream->rasterize_image ) return; - /* Some Cairo devices support delayed device setup (eg: xcairo with - * external drawable and extcairo with an external context). */ + // Some Cairo devices support delayed device setup (eg: xcairo with + // external drawable and extcairo with an external context). if ( aStream->cairoContext == NULL ) plexit( "Can not plot to a Cairo device with no context" ); - /* Restore the main plot surface and context for future plotting */ + // Restore the main plot surface and context for future plotting tmp_sfc = aStream->cairoSurface; tmp_context = aStream->cairoContext; aStream->cairoSurface = aStream->cairoSurface_raster; @@ -349,20 +349,20 @@ aStream->cairoSurface_raster = tmp_sfc; aStream->cairoContext_raster = tmp_context; - /* Blit the raster surface on to the main plot */ + // Blit the raster surface on to the main plot cairo_set_source_surface( aStream->cairoContext, aStream->cairoSurface_raster, 0.0, 0.0 ); cairo_paint( aStream->cairoContext ); - /* Free the now extraneous surface and context */ + // Free the now extraneous surface and context cairo_destroy( aStream->cairoContext_raster ); cairo_surface_destroy( aStream->cairoSurface_raster ); } -/*---------------------------------------------------------------------- - * plD_bop_cairo() - * - * Set up for the next page. - * ----------------------------------------------------------------------*/ +//---------------------------------------------------------------------- +// plD_bop_cairo() +// +// Set up for the next page. +// ---------------------------------------------------------------------- void plD_bop_cairo( PLStream *pls ) { @@ -373,12 +373,12 @@ if ( aStream->closed ) return; - /* Some Cairo devices support delayed device setup (eg: xcairo with - * external drawable and extcairo with an external context). */ + // Some Cairo devices support delayed device setup (eg: xcairo with + // external drawable and extcairo with an external context). if ( aStream->cairoContext == NULL ) return; - /* Fill in the window with the background color. */ + // Fill in the window with the background color. cairo_rectangle( aStream->cairoContext, 0.0, 0.0, pls->xlength, pls->ylength ); if ( (double) pls->cmap0[0].a < 1.0 ) { @@ -393,17 +393,17 @@ cairo_fill( aStream->cairoContext ); } -/*--------------------------------------------------------------------- - * plD_line_cairo() - * - * Draw a line in the current color from (x1,y1) to (x2,y2). - * ----------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_line_cairo() +// +// Draw a line in the current color from (x1,y1) to (x2,y2). +// ---------------------------------------------------------------------- -/*--------------------------------------------------------------------- - * (get|set)_line_properties - * - * (Get|Set) the current Cairo line drawing properties. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// (get|set)_line_properties +// +// (Get|Set) the current Cairo line drawing properties. +// --------------------------------------------------------------------- void get_line_properties( PLCairo *aStream, cairo_line_join_t *join, cairo_line_cap_t *cap ) { *join = cairo_get_line_join( aStream->cairoContext ); @@ -439,11 +439,11 @@ cairo_restore( aStream->cairoContext ); } -/*--------------------------------------------------------------------- - * plD_polyline_cairo() - * - * Draw a polyline in the current color. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_polyline_cairo() +// +// Draw a polyline in the current color. +// --------------------------------------------------------------------- void plD_polyline_cairo( PLStream *pls, short *xa, short *ya, PLINT npts ) { @@ -465,11 +465,11 @@ cairo_restore( aStream->cairoContext ); } -/*--------------------------------------------------------------------- - * plD_eop_cairo() - * - * Generic end of page. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_eop_cairo() +// +// Generic end of page. +// --------------------------------------------------------------------- void plD_eop_cairo( PLStream *pls ) { @@ -483,11 +483,11 @@ cairo_show_page( aStream->cairoContext ); } -/*--------------------------------------------------------------------- - * plD_tidy_cairo() - * - * General: Close graphics file or otherwise clean up. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_tidy_cairo() +// +// General: Close graphics file or otherwise clean up. +// --------------------------------------------------------------------- void plD_tidy_cairo( PLStream *pls ) { @@ -495,31 +495,31 @@ aStream = (PLCairo *) pls->dev; - /* Free the cairo context and surface. */ + // Free the cairo context and surface. cairo_destroy( aStream->cairoContext ); cairo_surface_destroy( aStream->cairoSurface ); plCloseFile( pls ); } -/*--------------------------------------------------------------------- - * plD_state_cairo() - * - * Handle change in PLStream state (color, pen width, fill attribute, etc). - * - * Nothing is done here because these attributes are acquired from - * PLStream for each element that is drawn. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_state_cairo() +// +// Handle change in PLStream state (color, pen width, fill attribute, etc). +// +// Nothing is done here because these attributes are acquired from +// PLStream for each element that is drawn. +// --------------------------------------------------------------------- void plD_state_cairo( PLStream *pls, PLINT op ) { } -/*--------------------------------------------------------------------- - * plD_esc_cairo() - * - * Generic escape function. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// plD_esc_cairo() +// +// Generic escape function. +// --------------------------------------------------------------------- void plD_esc_cairo( PLStream *pls, PLINT op, void *ptr ) { @@ -532,10 +532,10 @@ switch ( op ) { - case PLESC_FILL: /* filled polygon */ + case PLESC_FILL: // filled polygon filled_polygon( pls, pls->dev_x, pls->dev_y, pls->dev_npts ); break; - case PLESC_GRADIENT: /* render a gradient within a polygon. */ + case PLESC_GRADIENT: // render a gradient within a polygon. gradient( pls, pls->dev_x, pls->dev_y, pls->dev_npts ); break; case PLESC_HAS_TEXT: @@ -544,35 +544,35 @@ proc_str( pls, (EscText *) ptr ); } break; - case PLESC_BEGIN_TEXT: /* get ready to get a handle a string of text */ + case PLESC_BEGIN_TEXT: // get ready to get a handle a string of text text_begin_cairo( pls, (EscText *) ptr ); break; - case PLESC_TEXT_CHAR: /* handle a character of text to display */ + case PLESC_TEXT_CHAR: // handle a character of text to display text_char_cairo( pls, (EscText *) ptr ); break; - case PLESC_CONTROL_CHAR: /* handle a control character (super/subscript of fontchange) */ + case PLESC_CONTROL_CHAR: // handle a control character (super/subscript of fontchange) text_esc_cairo( pls, (EscText *) ptr ); break; - case PLESC_END_TEXT: /* finish a string of text */ + case PLESC_END_TEXT: // finish a string of text text_end_cairo( pls, (EscText *) ptr ); break; - case PLESC_START_RASTERIZE: /* Start offscreen/rasterized rendering */ + case PLESC_START_RASTERIZE: // Start offscreen/rasterized rendering start_raster( pls ); break; - case PLESC_END_RASTERIZE: /* End offscreen/rasterized rendering */ + case PLESC_END_RASTERIZE: // End offscreen/rasterized rendering end_raster( pls ); break; - case PLESC_ARC: /* Draw an arc, either filled or outline */ + case PLESC_ARC: // Draw an arc, either filled or outline arc( pls, (arc_struct *) ptr ); break; } } -/*--------------------------------------------------------------------- - * text_begin_cairo() - * - * Begin text. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// text_begin_cairo() +// +// Begin text. +// --------------------------------------------------------------------- void text_begin_cairo( PLStream *pls, EscText *args ) { @@ -590,11 +590,11 @@ open_span_tag( aStream->pangoMarkupString, args->n_fci, aStream->fontSize, 0 ); } -/*--------------------------------------------------------------------- - * text_char_cairo() - * - * Add text. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// text_char_cairo() +// +// Add text. +// --------------------------------------------------------------------- void text_char_cairo( PLStream *pls, EscText *args ) { @@ -602,7 +602,7 @@ PLCairo *aStream; aStream = (PLCairo *) pls->dev; - /* make sure we are not too close to the end of the string */ + // make sure we are not too close to the end of the string if ( strlen( aStream->pangoMarkupString ) < ( MAX_MARKUP_LEN - 50 ) ) { switch ( args->n_char ) @@ -624,11 +624,11 @@ } } -/*--------------------------------------------------------------------- - * text_esc_cairo() - * - * A font change, superscript, subscript, etc... - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// text_esc_cairo() +// +// A font change, superscript, subscript, etc... +// --------------------------------------------------------------------- void text_esc_cairo( PLStream *pls, EscText *args ) { @@ -666,11 +666,11 @@ } } -/*--------------------------------------------------------------------- - * text_end_cairo() - * - * Draw the text and clean up. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// text_end_cairo() +// +// Draw the text and clean up. +// --------------------------------------------------------------------- void text_end_cairo( PLStream *pls, EscText *args ) { @@ -686,22 +686,22 @@ set_current_context( pls ); - /* Close the last span tag. */ + // Close the last span tag. close_span_tag( aStream->pangoMarkupString, aStream->upDown ); - /* Create the Pango text layout so we can figure out how big it is */ + // Create the Pango text layout so we can figure out how big it is layout = pango_cairo_create_layout( aStream->cairoContext ); pango_layout_set_markup( layout, aStream->pangoMarkupString, -1 ); pango_layout_get_pixel_size( layout, &textXExtent, &textYExtent ); - /* If asked, set the string length (in mm) and return */ - if (pls->get_string_length) + // If asked, set the string length (in mm) and return + if ( pls->get_string_length ) { - pls->string_length = (PLFLT)textXExtent * 25.4 / DPI; - return; + pls->string_length = (PLFLT) textXExtent * 25.4 / DPI; + return; } - /* Set font aliasing */ + // Set font aliasing context = pango_layout_get_context( layout ); cairoFontOptions = cairo_font_options_create(); cairo_font_options_set_antialias( cairoFontOptions, aStream->text_anti_aliasing ); @@ -709,25 +709,25 @@ pango_layout_context_changed( layout ); cairo_font_options_destroy( cairoFontOptions ); - /* Save current transform matrix & clipping region */ + // Save current transform matrix & clipping region cairo_save( aStream->cairoContext ); - /* Set up the clipping region if we are doing text clipping */ + // Set up the clipping region if we are doing text clipping if ( aStream->text_clipping ) { set_clip( pls ); } - /* Move to the string reference point */ + // Move to the string reference point cairo_move_to( aStream->cairoContext, aStream->downscale * (double) args->x, aStream->downscale * (double) args->y ); - /* Invert the coordinate system so that the text is drawn right side up */ + // Invert the coordinate system so that the text is drawn right side up cairoTransformMatrix = (cairo_matrix_t *) malloc( sizeof ( cairo_matrix_t ) ); cairo_matrix_init( cairoTransformMatrix, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ); cairo_transform( aStream->cairoContext, cairoTransformMatrix ); - /* Extract rotation angle and shear from the PLplot tranformation matrix. - * Compute sines and cosines of the angles as an optimization. */ + // Extract rotation angle and shear from the PLplot tranformation matrix. + // Compute sines and cosines of the angles as an optimization. plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * PI / 2.0; cos_rot = cos( rotation ); @@ -735,7 +735,7 @@ cos_shear = cos( shear ); sin_shear = sin( shear ); - /* Apply the transform matrix */ + // Apply the transform matrix cairo_matrix_init( cairoTransformMatrix, cos_rot * stride, -sin_rot * stride, @@ -745,27 +745,27 @@ cairo_transform( aStream->cairoContext, cairoTransformMatrix ); free( cairoTransformMatrix ); - /* Move to the text starting point */ + // Move to the text starting point cairo_rel_move_to( aStream->cairoContext, (double) ( -1.0 * args->just * (double) textXExtent ), (double) ( -0.5 * textYExtent ) ); - /* Render the text */ + // Render the text pango_cairo_show_layout( aStream->cairoContext, layout ); - /* Restore the transform matrix to its state prior to the text transform. */ + // Restore the transform matrix to its state prior to the text transform. cairo_restore( aStream->cairoContext ); - /* Free the layout object and the markup string. */ + // Free the layout object and the markup string. g_object_unref( layout ); free( aStream->pangoMarkupString ); } -/*--------------------------------------------------------------------- - * proc_str() - * - * Processes strings for display. - * ---------------------------------------------------------------------*/ +//--------------------------------------------------------------------- +// proc_str() +// +// Processes strings for display. +// --------------------------------------------------------------------- void proc_str( PLStream *pls, EscText *args ) { @@ -783,32 +783,32 @@ set_current_context( pls ); - /* Check that we got unicode, warning message and return if not */ + // Check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to a cairo driver, ignoring\n" ); return; } - /* Check that unicode string isn't longer then the max we allow */ + // Check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= MAX_STRING_LEN ) { printf( "Sorry, the cairo drivers only handles strings of length < %d\n", MAX_STRING_LEN ); return; } - /* Calculate the font size (in pixels) */ + // Calculate the font size (in pixels) fontSize = pls->chrht * DPI / 25.4; - /* Convert the escape characters into the appropriate Pango markup */ + // Convert the escape characters into the appropriate Pango markup textWithPangoMarkup = ucs4_to_pango_markup_format( args->unicode_array, args->unicode_array_len, fontSize ); - /* Create the Pango text layout so we can figure out how big it is */ + // Create the Pango text layout so we can figure out how big it is layout = pango_cairo_create_layout( aStream->cairoContext ); pango_layout_set_markup( layout, textWithPangoMarkup, -1 ); pango_layout_get_pixel_size( layout, &textXExtent, &textYExtent ); - /* Set font aliasing */ + // Set font aliasing context = pango_layout_get_context( layout ); cairoFontOptions = cairo_font_options_create(); cairo_font_options_set_antialias( cairoFontOptions, aStream->text_anti_aliasing ); @@ -816,25 +816,25 @@ pango_layout_context_changed( layout ); cairo_font_options_destroy( cairoFontOptions ); - /* Save current transform matrix & clipping region */ + // Save current transform matrix & clipping region cairo_save( aStream->cairoContext ); - /* Set up the clipping region if we are doing text clipping */ + // Set up the clipping region if we are doing text clipping if ( aStream->text_clipping ) { set_clip( pls ); } - /* Move to the string reference point */ + // Move to the string reference point cairo_move_to( aStream->cairoContext, aStream->downscale * (double) args->x, aStream->downscale * (double) args->y ); - /* Invert the coordinate system so that the text is drawn right side up */ + // Invert the coordinate system so that the text is drawn right side up cairoTransformMatrix = (cairo_matrix_t *) malloc( sizeof ( cairo_matrix_t ) ); cairo_matrix_init( cairoTransformMatrix, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ); cairo_transform( aStream->cairoContext, cairoTransformMatrix ); - /* Extract rotation angle and shear from the PLplot tranformation matrix. - * Compute sines and cosines of the angles as an optimization. */ + // Extract rotation angle and shear from the PLplot tranformation matrix. + // Compute sines and cosines of the angles as an optimization. plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * PI / 2.0; cos_rot = cos( rotation ); @@ -842,7 +842,7 @@ cos_shear = cos( shear ); sin_shear = sin( shear ); - /* Apply the transform matrix */ + // Apply the transform matrix cairo_matrix_init( cairoTransformMatrix, cos_rot * stride, -sin_rot * stride, @@ -852,30 +852,30 @@ cairo_transform( aStream->cairoContext, cairoTransformMatri... [truncated message content] |