00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "mmsgui/fb/mmsfbconv.h"
00034 #include "mmstools/mmstools.h"
00035
00036 void mmsfb_drawstring_blend_rgb32(MMSFBSurfacePlanes *dst_planes, MMSFBFont *font,
00037 MMSFBRegion &clipreg, string &text, int len, int x, int y, MMSFBColor &color) {
00038
00039 static bool firsttime = true;
00040 if (firsttime) {
00041 printf("DISKO: Using blend text RGB32.\n");
00042 firsttime = false;
00043 }
00044
00045
00046 void *dst_ptr = dst_planes->ptr;
00047 int dst_pitch = dst_planes->pitch;
00048
00049
00050 MMSFBSURFACE_BLIT_TEXT_INIT(2);
00051
00052
00053 unsigned int OLDDST = 0;
00054 unsigned int OLDSRC = 0;
00055 register unsigned int d = 0;
00056 register unsigned int SRCPIX = 0xff000000 | (((unsigned int)color.r) << 16) | (((unsigned int)color.g) << 8) | (unsigned int)color.b;
00057 MMSFBFONT_GET_UNICODE_CHAR(text, len) {
00058
00059 MMSFBSURFACE_BLIT_TEXT_LOAD_GLYPH(font, character);
00060
00061
00062 MMSFBSURFACE_BLIT_TEXT_START_RENDER(unsigned int);
00063
00064
00065 while (src < src_end) {
00066 while (src < line_end) {
00067
00068 register unsigned int SRC = *src;
00069
00070
00071 register unsigned int A = SRC;
00072 if (A == 0xff) {
00073
00074 *dst = SRCPIX;
00075 }
00076 else
00077 if (A) {
00078
00079 register unsigned int DST = *dst;
00080
00081 if ((DST==OLDDST)&&(SRC==OLDSRC)) {
00082
00083 *dst = d;
00084 dst++;
00085 src++;
00086 continue;
00087 }
00088 OLDDST = DST;
00089 OLDSRC = SRC;
00090
00091 register unsigned int SA= 0x100 - A;
00092 unsigned int r = (DST << 8) >> 24;
00093 unsigned int g = (DST << 16) >> 24;
00094 unsigned int b = DST & 0xff;
00095
00096
00097 r = (SA * r) >> 8;
00098 g = (SA * g) >> 8;
00099 b = (SA * b) >> 8;
00100
00101
00102 r += (A * color.r) >> 8;
00103 g += (A * color.g) >> 8;
00104 b += (A * color.b) >> 8;
00105 d = 0xff000000
00106 | ((r >> 8) ? 0xff0000 : (r << 16))
00107 | ((g >> 8) ? 0xff00 : (g << 8))
00108 | ((b >> 8) ? 0xff : b);
00109 *dst = d;
00110 }
00111
00112 src++;
00113 dst++;
00114 }
00115 line_end+= src_pitch_pix;
00116 src += src_pitch_pix_diff;
00117 dst += dst_pitch_pix_diff;
00118 }
00119
00120
00121 MMSFBSURFACE_BLIT_TEXT_END_RENDER;
00122 }}
00123 }
00124
00125