paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/src/font pgfont.cpp,1.1.1.1,1.2 pgfont_impl.c


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/font pgfont.cpp,1.1.1.1,1.2 pgfont_impl.cpp,1.1.1.1,1.2
Date: Mon, 15 Apr 2002 09:31:34 -0400

Update of /cvsroot/paragui/paragui/src/font
In directory subversions:/tmp/cvs-serv21582/src/font

Modified Files:
        pgfont.cpp pgfont_impl.cpp 
Log Message:
imported version 1.0.1



Index: pgfont.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/font/pgfont.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgfont.cpp  15 Apr 2002 13:22:11 -0000      1.1.1.1
--- pgfont.cpp  15 Apr 2002 13:31:31 -0000      1.2
***************
*** 182,232 ****
                        // Get the pixel
                        color = *((DT) (dst_pixels));
  
!                       // get the RGBA values
!                       rv = (color & Rmask) >> Rshift;
!                       r = (rv << Rloss) + (rv >> Rloss8);
!                       gv = (color & Gmask) >> Gshift;
!                       g = (gv << Gloss) + (gv >> Gloss8);
!                       bv = (color & Bmask) >> Bshift;
!                       b = (bv << Bloss) + (bv >> Bloss8);
!                       if(Amask) {
!                               av = (color & Amask) >> Ashift;
!                               a = (av << Aloss) + (av >> Aloss8);
!                       } else
!                               a = SDL_ALPHA_OPAQUE;
! 
!                       //SDL_GetRGBA(color, format, &r, &g, &b, &a);
! 
!                       // calculate new RGBA values
!                       if(v == 255) {
!                               r = cr;
!                               g = cg;
!                               b = cb;
                        }
-                       else {
-                               //r += ((cr - r) * v) / 255;
-                               //g += ((cg - g) * v) / 255;
-                               //b += ((cb - b) * v) / 255;
-                               r += ((cr - r) * v) >> 8;
-                               g += ((cg - g) * v) >> 8;
-                               b += ((cb - b) * v) >> 8;
-                       }
- 
-                       // if the destination pixel is full transparent
-                       // use the pixel shading as alpha
-                       if(a == 0) {
-                               a = v;
-                       }
- 
-                       // get the destination color
-                       color = (r >> Rloss) << Rshift
-                     | (g >> Gloss) << Gshift
-                     | (b >> Bloss) << Bshift
-                     | ((a >> Aloss) << Ashift & Amask);
- 
-                       //color = SDL_MapRGBA(format, r,g,b, a);
- 
-                       // Set the pixel
                        *((DT) (dst_pixels)) = color;
                }
                src_pixels -= xw;
--- 182,256 ----
                        // Get the pixel
                        color = *((DT) (dst_pixels));
+                       if ( Surface->format->BytesPerPixel > 1 ) {
  
!                               // get the RGBA values
!                               rv = (color & Rmask) >> Rshift;
!                               r = (rv << Rloss) + (rv >> Rloss8);
!                               gv = (color & Gmask) >> Gshift;
!                               g = (gv << Gloss) + (gv >> Gloss8);
!                               bv = (color & Bmask) >> Bshift;
!                               b = (bv << Bloss) + (bv >> Bloss8);
!                               if(Amask) {
!                                       av = (color & Amask) >> Ashift;
!                                       a = (av << Aloss) + (av >> Aloss8);
!                               } else
!                                       a = SDL_ALPHA_OPAQUE;
! 
!                               //SDL_GetRGBA(color, format, &r, &g, &b, &a);
! 
!                               // calculate new RGBA values
!                               if(v == 255) {
!                                       r = cr;
!                                       g = cg;
!                                       b = cb;
!                               }
!                               else {
!                                       //r += ((cr - r) * v) / 255;
!                                       //g += ((cg - g) * v) / 255;
!                                       //b += ((cb - b) * v) / 255;
!                                       r += ((cr - r) * v) >> 8;
!                                       g += ((cg - g) * v) >> 8;
!                                       b += ((cb - b) * v) >> 8;
!                               }
! 
!                               // if the destination pixel is full transparent
!                               // use the pixel shading as alpha
!                               if(a == 0) {
!                                       a = v;
!                               }
! 
!                               // get the destination color
!                               color = (r >> Rloss) << Rshift
!                           | (g >> Gloss) << Gshift
!                           | (b >> Bloss) << Bshift
!                           | ((a >> Aloss) << Ashift & Amask);
!                               // Set the pixel
!                       } else {
!                               SDL_GetRGBA(color, format, &r, &g, &b, &a);
! 
!                               // calculate new RGBA values
!                               if(v == 255) {
!                                       r = cr;
!                                       g = cg;
!                                       b = cb;
!                               }
!                               else {
!                                       //r += ((cr - r) * v) / 255;
!                                       //g += ((cg - g) * v) / 255;
!                                       //b += ((cb - b) * v) / 255;
!                                       r += ((cr - r) * v) >> 8;
!                                       g += ((cg - g) * v) >> 8;
!                                       b += ((cb - b) * v) >> 8;
!                               }
! 
!                               // if the destination pixel is full transparent
!                               // use the pixel shading as alpha
!                               if(a == 0) {
!                                       a = v;
!                               }
!                               color = SDL_MapRGBA(format, r,g,b, a);
                        }
                        *((DT) (dst_pixels)) = color;
+ 
                }
                src_pixels -= xw;

Index: pgfont_impl.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/font/pgfont_impl.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** pgfont_impl.cpp     15 Apr 2002 13:22:11 -0000      1.1.1.1
--- pgfont_impl.cpp     15 Apr 2002 13:31:31 -0000      1.2
***************
*** 3,7 ****
  #include "pgfont.h"
  
! typedef struct PG_FontDataInternal {
        SDL_Color color;
        int alpha;
--- 3,7 ----
  #include "pgfont.h"
  
! struct PG_FontDataInternal {
        SDL_Color color;
        int alpha;




reply via email to

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