Browse Source

Themes: Eliminate some divides.

tags/v1.3.1000
Jonathan Moore Liles 11 years ago
parent
commit
127328b00c
2 changed files with 10 additions and 6 deletions
  1. +6
    -4
      src/Cairo_Theme.cxx
  2. +4
    -2
      src/Fl_Cairo_Graphics_Driver.cxx

+ 6
- 4
src/Cairo_Theme.cxx View File

@@ -34,6 +34,8 @@ bool fl_debug_boxes = false;

static const int DX = 1;

#define BSCALE 0.00392156862f

static void cairo_color(Fl_Color c)
{
cairo_t *cr = Fl::cairo_cc();
@@ -48,7 +50,7 @@ static void cairo_color(Fl_Color c)
Fl::get_color( bc, r, g, b );

cairo_set_source_rgb( cr, r / 255.0, g / 255.0, b / 255.0 );
cairo_set_source_rgb( cr, r * BSCALE, g * BSCALE, b * BSCALE );
}

static void rect_path ( int x, int y, int w, int h, double radius )
@@ -95,9 +97,9 @@ static void draw_rectf(int x, int y, int w, int h, Fl_Color bc, double radius =

Fl::get_color( fl_color(), r, g, b );

float rf = r / 255.0;
float gf = g / 255.0;
float bf = b / 255.0;
float rf = r * BSCALE;
float gf = g * BSCALE;
float bf = b * BSCALE;

cairo_pattern_t *grad = 0;



+ 4
- 2
src/Fl_Cairo_Graphics_Driver.cxx View File

@@ -62,6 +62,8 @@ double fl_hwo = 1.0;
#define VHO(n) ( n + fl_vho )
#define HWO(n) ( n + fl_hwo )

#define BSCALE 0.00392156862f

Fl_Color fl_color_add_alpha ( Fl_Color c, uchar alpha )
{
if ( !( c & 0xFFFFFF00 ) )
@@ -291,7 +293,7 @@ void Fl_Cairo_Graphics_Driver::color ( uchar r, uchar g, uchar b )
if ( ! cr )
return;
cairo_set_source_rgb( cr, r / 255.0f, g / 255.0f, b / 255.0f );
cairo_set_source_rgb( cr, r * BSCALE, g * BSCALE, b * BSCALE );
}

void fl_set_antialias ( int v )
@@ -331,7 +333,7 @@ void Fl_Cairo_Graphics_Driver::color (uchar r, uchar g, uchar b, uchar a )
if ( ! cr )
return;

cairo_set_source_rgba( cr, r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f );
cairo_set_source_rgba( cr, r * BSCALE, g * BSCALE, b * BSCALE, a * BSCALE );
}

void Fl_Cairo_Graphics_Driver::circle( double x, double y, double r )


Loading…
Cancel
Save