freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master f2191a8 1/2: [graph] Revise function arguments.


From: Werner Lemberg
Subject: [freetype2-demos] master f2191a8 1/2: [graph] Revise function arguments.
Date: Tue, 23 Nov 2021 23:07:50 -0500 (EST)

branch: master
commit f2191a8b40c52bffc5311d98ec79ca6acf5582ba
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [graph] Revise function arguments.
    
    * graph/gblblit.c (grSetTargetGamma, grSetTargetPenBrush): Input
    surface instead of bitmap as more appropriate.
    * graph/graph.h (grSetTargetGamma, grSetTargetPenBrush): Update
    decarations.
    * graph/grdevice.c, src/ftcommon.c, src/ftdiff.c: Update callers.
---
 graph/gblblit.c  | 17 +++++++----------
 graph/graph.h    | 15 ++++++++-------
 graph/grdevice.c |  2 +-
 src/ftcommon.c   |  8 ++++----
 src/ftdiff.c     |  4 ++--
 5 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/graph/gblblit.c b/graph/gblblit.c
index 45ef7b3..cfad8d1 100644
--- a/graph/gblblit.c
+++ b/graph/gblblit.c
@@ -387,23 +387,20 @@ gblender_blit_init( GBlenderBlit           blit,
 
 
 GBLENDER_APIDEF( void )
-grSetTargetGamma( grBitmap*  target,
-                  double     gamma )
+grSetTargetGamma( grSurface*  surface,
+                  double      gamma )
 {
-  grSurface*  surface = (grSurface*)target;
-
-
   gblender_init( surface->gblender, gamma );
 }
 
 
 GBLENDER_APIDEF( void )
-grSetTargetPenBrush( grBitmap*  target,
-                     int        x,
-                     int        y,
-                     grColor    color )
+grSetTargetPenBrush( grSurface*  surface,
+                     int         x,
+                     int         y,
+                     grColor     color )
 {
-  grSurface*  surface = (grSurface*)target;
+  grBitmap*  target = &surface->bitmap;
 
 
   surface->origin = target->buffer;
diff --git a/graph/graph.h b/graph/graph.h
index 60181ee..ef167c3 100644
--- a/graph/graph.h
+++ b/graph/graph.h
@@ -705,13 +705,14 @@
   *    blit glyphs
   *
   * <Input>
-  *    target     :: handle to target bitmap/surface
+  *    surface    :: handle to target surface
   *    gamma      :: gamma value. <= 0 to select sRGB transfer function
   *
   **********************************************************************/
 
   extern
-  void  grSetTargetGamma( grBitmap*  target, double  gamma_value );
+  void  grSetTargetGamma( grSurface*  surface,
+                          double      gamma_value );
 
 
  /**********************************************************************
@@ -723,17 +724,17 @@
   *    set the pen position and brush color as required for direct mode.
   *
   * <Input>
-  *    target     :: handle to target bitmap/surface
+  *    surface    :: handle to target surface
   *    x, y       :: pen position
   *    color      :: color as defined by grFindColor
   *
   **********************************************************************/
 
   extern
-  void  grSetTargetPenBrush( grBitmap*  target,
-                             int        x,
-                             int        y,
-                             grColor    color );
+  void  grSetTargetPenBrush( grSurface*  surface,
+                             int         x,
+                             int         y,
+                             grColor     color );
 
 /* */
 
diff --git a/graph/grdevice.c b/graph/grdevice.c
index 45d685b..fb99f76 100644
--- a/graph/grdevice.c
+++ b/graph/grdevice.c
@@ -152,7 +152,7 @@
       surface = NULL;
     }
     else
-      grSetTargetGamma( (grBitmap*)surface, 1.8 );
+      grSetTargetGamma( surface, 1.8 );
 
     return surface;
   }
diff --git a/src/ftcommon.c b/src/ftcommon.c
index 9662cd5..bea2d2e 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -165,7 +165,7 @@
 
     display->gamma = GAMMA;
 
-    grSetTargetGamma( display->bitmap, display->gamma );
+    grSetTargetGamma( display->surface, display->gamma );
 
     return display;
   }
@@ -200,7 +200,7 @@
         display->gamma  = 2.2;
     }
 
-    grSetTargetGamma( display->bitmap, display->gamma );
+    grSetTargetGamma( display->surface, display->gamma );
   }
 
 
@@ -1981,7 +1981,7 @@
                              FT_Pos             y,
                              grColor            color )
   {
-    grSurface*        surface = (grSurface*)display->surface;
+    grSurface*        surface = display->surface;
     grBitmap*         target = display->bitmap;
     FT_Outline*       outline;
     FT_Raster_Params  params;
@@ -1990,7 +1990,7 @@
     if ( glyph->format != FT_GLYPH_FORMAT_OUTLINE )
       return FT_Err_Ok;
 
-    grSetTargetPenBrush( target, x, y, color );
+    grSetTargetPenBrush( surface, x, y, color );
 
     outline = &((FT_OutlineGlyph)glyph)->outline;
 
diff --git a/src/ftdiff.c b/src/ftdiff.c
index 27431aa..bf9f349 100644
--- a/src/ftdiff.c
+++ b/src/ftdiff.c
@@ -991,7 +991,7 @@
     display->bitmap  = &surface->bitmap;
     display->gamma   = GAMMA;
 
-    grSetTargetGamma( display->bitmap, display->gamma );
+    grSetTargetGamma( display->surface, display->gamma );
 
     display->fore_color = grFindColor( display->bitmap,   0,   0,   0, 255 );
     display->back_color = grFindColor( display->bitmap, 255, 255, 255, 255 );
@@ -1079,7 +1079,7 @@
     else if ( display->gamma < 0.0001 )
       display->gamma = 0.0;
 
-    grSetTargetGamma( display->bitmap, display->gamma );
+    grSetTargetGamma( display->surface, display->gamma );
   }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]