00001 /*************************************************************************** 00002 * Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider, * 00003 * Matthias Hardt, Guido Madaus * 00004 * * 00005 * Copyright (C) 2007-2008 BerLinux Solutions GbR * 00006 * Stefan Schwarzer & Guido Madaus * 00007 * * 00008 * Copyright (C) 2009-2013 BerLinux Solutions GmbH * 00009 * * 00010 * Authors: * 00011 * Stefan Schwarzer <stefan.schwarzer@diskohq.org>, * 00012 * Matthias Hardt <matthias.hardt@diskohq.org>, * 00013 * Jens Schneider <jens.schneider@diskohq.org>, * 00014 * Guido Madaus <guido.madaus@diskohq.org>, * 00015 * Patrick Helterhoff <patrick.helterhoff@diskohq.org>, * 00016 * René Bählkow <rene.baehlkow@diskohq.org> * 00017 * * 00018 * This library is free software; you can redistribute it and/or * 00019 * modify it under the terms of the GNU Lesser General Public * 00020 * License version 2.1 as published by the Free Software Foundation. * 00021 * * 00022 * This library is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00025 * Lesser General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU Lesser General Public * 00028 * License along with this library; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00031 **************************************************************************/ 00032 00033 #include "mmsgui/fb/mmsfbconv.h" 00034 00035 #ifdef __HAVE_PF_RGB24__ 00036 00037 #include "mmstools/mmstools.h" 00038 #include <string.h> 00039 00040 void mmsfb_fillrectangle_rgb24(MMSFBSurfacePlanes *dst_planes, int dst_height, 00041 int dx, int dy, int dw, int dh, MMSFBColor color) { 00042 // first time? 00043 static bool firsttime = true; 00044 if (firsttime) { 00045 printf("DISKO: Using accelerated fill rectangle to RGB24.\n"); 00046 firsttime = false; 00047 } 00048 00049 // get the first destination ptr/pitch 00050 unsigned char *dst = (unsigned char *)dst_planes->ptr; 00051 int dst_pitch = dst_planes->pitch; 00052 00053 // prepare a rgb line 00054 int size = dw * 3; 00055 if (size > dst_pitch) size = dst_pitch; 00056 unsigned char line[2048*3]; 00057 unsigned char *ls = line; 00058 unsigned char *le = line + size; 00059 unsigned char r = color.r; 00060 unsigned char g = color.g; 00061 unsigned char b = color.b; 00062 while (ls < le) { 00063 *ls = b; ls++; 00064 *ls = g; ls++; 00065 *ls = r; ls++; 00066 } 00067 dst+= dx*3 + dy * dst_pitch; 00068 unsigned char *dst_end = dst + dst_pitch * dh; 00069 00070 // copy line buffer directly to the destination 00071 // for all lines 00072 while (dst < dst_end) { 00073 memcpy(dst, line, size); 00074 dst+= dst_pitch; 00075 } 00076 } 00077 00078 #endif