comparison src/graphics.h.in @ 12777:6c1d0f03c331

Avoid redundant calls to set_font of text renderers (Bug #31305)
author Konstantinos Poulios <logari81@gmail.com>
date Mon, 27 Jun 2011 19:54:21 +0200
parents 5cbf660e649d
children 0c86ae6f7c34
comparison
equal deleted inserted replaced
12774:ec6c52496485 12777:6c1d0f03c331
3203 double fx, fy, fz; 3203 double fx, fy, fz;
3204 double xticklen, yticklen, zticklen; 3204 double xticklen, yticklen, zticklen;
3205 double xtickoffset, ytickoffset, ztickoffset; 3205 double xtickoffset, ytickoffset, ztickoffset;
3206 bool x2Dtop, y2Dright, layer2Dtop; 3206 bool x2Dtop, y2Dright, layer2Dtop;
3207 bool xySym, xyzSym, zSign, nearhoriz; 3207 bool xySym, xyzSym, zSign, nearhoriz;
3208
3209 #if HAVE_FREETYPE
3210 // freetype renderer, used for calculation of text (tick labels) size
3211 ft_render text_renderer;
3212 #endif
3208 3213
3209 void set_text_child (handle_property& h, const std::string& who, 3214 void set_text_child (handle_property& h, const std::string& who,
3210 const octave_value& v); 3215 const octave_value& v);
3211 3216
3212 void delete_text_child (handle_property& h); 3217 void delete_text_child (handle_property& h);
3286 radio_property cameratargetmode , "{auto}|manual" 3291 radio_property cameratargetmode , "{auto}|manual"
3287 radio_property cameraupvectormode , "{auto}|manual" 3292 radio_property cameraupvectormode , "{auto}|manual"
3288 radio_property cameraviewanglemode , "{auto}|manual" 3293 radio_property cameraviewanglemode , "{auto}|manual"
3289 array_property currentpoint , Matrix (2, 3, 0.0) 3294 array_property currentpoint , Matrix (2, 3, 0.0)
3290 radio_property drawmode , "{normal}|fast" 3295 radio_property drawmode , "{normal}|fast"
3291 radio_property fontangle , "{normal}|italic|oblique" 3296 radio_property fontangle u , "{normal}|italic|oblique"
3292 string_property fontname , OCTAVE_DEFAULT_FONTNAME 3297 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
3293 double_property fontsize , 10 3298 double_property fontsize u , 10
3294 radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels" 3299 radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels"
3295 radio_property fontweight , "{normal}|light|demi|bold" 3300 radio_property fontweight u , "{normal}|light|demi|bold"
3296 radio_property gridlinestyle , "-|--|{:}|-.|none" 3301 radio_property gridlinestyle , "-|--|{:}|-.|none"
3297 string_array_property linestyleorder , "-" 3302 string_array_property linestyleorder , "-"
3298 double_property linewidth , 0.5 3303 double_property linewidth , 0.5
3299 radio_property minorgridlinestyle , "-|--|{:}|-.|none" 3304 radio_property minorgridlinestyle , "-|--|{:}|-.|none"
3300 array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) 3305 array_property plotboxaspectratio mu , Matrix (1, 3, 1.0)
3410 void update_zticklabelmode (void) 3415 void update_zticklabelmode (void)
3411 { 3416 {
3412 if (zticklabelmode.is ("auto")) 3417 if (zticklabelmode.is ("auto"))
3413 calc_ticklabels (ztick, zticklabel, zscale.is ("log")); 3418 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
3414 } 3419 }
3420
3421 void update_font (void);
3422 void update_fontname (void) { update_font (); }
3423 void update_fontsize (void) { update_font (); }
3424 void update_fontangle (void) { update_font (); }
3425 void update_fontweight (void) { update_font (); }
3415 3426
3416 void sync_positions (const Matrix& linset); 3427 void sync_positions (const Matrix& linset);
3417 void sync_positions (void); 3428 void sync_positions (void);
3418 3429
3419 void update_outerposition (void) 3430 void update_outerposition (void)
3714 3725
3715 Matrix get_data_position (void) const; 3726 Matrix get_data_position (void) const;
3716 Matrix get_extent_matrix (void) const; 3727 Matrix get_extent_matrix (void) const;
3717 const uint8NDArray& get_pixels (void) const { return pixels; } 3728 const uint8NDArray& get_pixels (void) const { return pixels; }
3718 #if HAVE_FREETYPE 3729 #if HAVE_FREETYPE
3719 // freetype render, used for text rendering 3730 // freetype renderer, used for calculation of text size
3720 ft_render renderer; 3731 ft_render renderer;
3721 #endif 3732 #endif
3722 3733
3723 protected: 3734 protected:
3724 void init (void) 3735 void init (void)
3725 { 3736 {
3726 position.add_constraint (dim_vector (1, 2)); 3737 position.add_constraint (dim_vector (1, 2));
3727 position.add_constraint (dim_vector (1, 3)); 3738 position.add_constraint (dim_vector (1, 3));
3728 cached_units = get_units (); 3739 cached_units = get_units ();
3740 update_font ();
3729 } 3741 }
3730 3742
3731 private: 3743 private:
3732 void update_position (void) 3744 void update_position (void)
3733 { 3745 {
3759 void update_positionmode (void) { request_autopos (); } 3771 void update_positionmode (void) { request_autopos (); }
3760 void update_rotationmode (void) { request_autopos (); } 3772 void update_rotationmode (void) { request_autopos (); }
3761 void update_horizontalalignmentmode (void) { request_autopos (); } 3773 void update_horizontalalignmentmode (void) { request_autopos (); }
3762 void update_verticalalignmentmode (void) { request_autopos (); } 3774 void update_verticalalignmentmode (void) { request_autopos (); }
3763 3775
3776 void update_font (void);
3764 void update_string (void) { request_autopos (); update_text_extent (); } 3777 void update_string (void) { request_autopos (); update_text_extent (); }
3765 void update_rotation (void) { update_text_extent (); } 3778 void update_rotation (void) { update_text_extent (); }
3766 void update_color (void) { update_text_extent (); } 3779 void update_color (void) { update_font (); }
3767 void update_fontname (void) { update_text_extent (); } 3780 void update_fontname (void) { update_font (); update_text_extent (); }
3768 void update_fontsize (void) { update_text_extent (); } 3781 void update_fontsize (void) { update_font (); update_text_extent (); }
3769 void update_fontangle (void) { update_text_extent (); } 3782 void update_fontangle (void) { update_font (); update_text_extent (); }
3770 void update_fontweight (void) { update_text_extent (); } 3783 void update_fontweight (void) { update_font (); update_text_extent (); }
3771 void update_interpreter (void) { update_text_extent (); } 3784 void update_interpreter (void) { update_text_extent (); }
3772 void update_horizontalalignment (void) { update_text_extent (); } 3785 void update_horizontalalignment (void) { update_text_extent (); }
3773 void update_verticalalignment (void) { update_text_extent (); } 3786 void update_verticalalignment (void) { update_text_extent (); }
3774 3787
3775 void update_units (void); 3788 void update_units (void);