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 #define MMSFB_DRAWLINE_BLEND_PIXEL \
00037 if ((x >= clipreg.x1)&&(x <= clipreg.x2)&&(y >= clipreg.y1)&&(y <= clipreg.y2)) { \
00038 register unsigned int DST = dst[x+y*dst_pitch_pix]; \
00039 if (DST==OLDDST) dst[x+y*dst_pitch_pix] = d; else { \
00040 OLDDST = DST; \
00041 register int SA= 0x100 - A; \
00042 unsigned int a = DST >> 24; \
00043 unsigned int r = (DST << 8) >> 24; \
00044 unsigned int g = (DST << 16) >> 24; \
00045 unsigned int b = DST & 0xff; \
00046 a = (SA * a) >> 8; \
00047 r = (SA * r) >> 8; \
00048 g = (SA * g) >> 8; \
00049 b = (SA * b) >> 8; \
00050 a += A; \
00051 r += (SRC << 8) >> 24; \
00052 g += (SRC << 16) >> 24; \
00053 b += SRC & 0xff; \
00054 d = ((a >> 8) ? 0xff000000 : (a << 24)) \
00055 | ((r >> 8) ? 0xff0000 : (r << 16)) \
00056 | ((g >> 8) ? 0xff00 : (g << 8)) \
00057 | ((b >> 8) ? 0xff : b); \
00058 dst[x+y*dst_pitch_pix] = d; } }
00059
00060 void mmsfb_drawline_blend_argb(MMSFBSurfacePlanes *dst_planes, int dst_height,
00061 MMSFBRegion &clipreg, int x1, int y1, int x2, int y2, MMSFBColor &color) {
00062 if (color.a == 0xff) {
00063
00064 mmsfb_drawline_argb(dst_planes, dst_height, clipreg, x1, y1, x2, y2, color);
00065 return;
00066 }
00067
00068
00069 static bool firsttime = true;
00070 if (firsttime) {
00071 printf("DISKO: Using accelerated blend line to ARGB.\n");
00072 firsttime = false;
00073 }
00074
00075
00076 if (!color.a)
00077 return;
00078
00079
00080 unsigned int *dst = (unsigned int *)dst_planes->ptr;
00081 int dst_pitch = dst_planes->pitch;
00082
00083
00084 int dst_pitch_pix = dst_pitch >> 2;
00085 unsigned int OLDDST = 0;
00086 register unsigned int d = 0;
00087
00088
00089 register unsigned int A = color.a;
00090 register unsigned int SRC;
00091 SRC = (A << 24)
00092 | (color.r << 16)
00093 | (color.g << 8)
00094 | color.b;
00095 d = SRC;
00096
00097
00098 MMSFB_DRAWLINE_BRESENHAM(MMSFB_DRAWLINE_BLEND_PIXEL);
00099 }
00100