From 0e0319a73700928c44b848bf7fef60fd6f52582a Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Tue, 21 Jan 2020 18:31:42 +0800 Subject: [PATCH] cleanup --- src/newgal/pixels.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/newgal/pixels.c b/src/newgal/pixels.c index 42d89f7c..4e3b7c0a 100644 --- a/src/newgal/pixels.c +++ b/src/newgal/pixels.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -232,7 +232,7 @@ GAL_PixelFormat *GAL_AllocFormat(int bpp, break; } - /* Calculate some standard bitmasks, if necessary + /* Calculate some standard bitmasks, if necessary * Note: This could conflict with an alpha mask, if given. */ if ( (bpp > 8) && !format->Rmask && !format->Gmask && !format->Bmask ) { @@ -252,6 +252,7 @@ GAL_PixelFormat *GAL_AllocFormat(int bpp, } return(format); } + GAL_PixelFormat *GAL_ReallocFormat(GAL_Surface *surface, int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) { @@ -338,7 +339,7 @@ Uint8 GAL_FindDitheredColor (int bpp, Uint8 r, Uint8 g, Uint8 b) return r | g | b; } -/* +/* * Calculate the pad-aligned scanline width of a surface */ Uint32 GAL_CalculatePitch(GAL_Surface *surface) @@ -372,7 +373,7 @@ Uint8 GAL_FindColor(GAL_Palette *pal, Uint8 r, Uint8 g, Uint8 b) int rd, gd, bd; int i; Uint8 pixel=0; - + smallest = ~0; for ( i=0; incolors; ++i ) { rd = pal->colors[i].r - r; @@ -531,6 +532,7 @@ static Uint8 *Map1to1(GAL_Palette *src, GAL_Palette *dst, int *identical) } return(map); } + /* Map from Palette to BitField */ static Uint8 *Map1toN(GAL_Palette *src, GAL_PixelFormat *dst) { @@ -555,6 +557,7 @@ static Uint8 *Map1toN(GAL_Palette *src, GAL_PixelFormat *dst) } return(map); } + /* Map from BitField to Dithered-Palette to Palette */ static Uint8 *MapNto1(GAL_PixelFormat *src, GAL_Palette *dst, int *identical) { @@ -592,6 +595,7 @@ GAL_BlitMap *GAL_AllocBlitMap(void) /* It's ready to go */ return(map); } + void GAL_InvalidateMap(GAL_BlitMap *map) { if ( ! map ) { @@ -604,6 +608,7 @@ void GAL_InvalidateMap(GAL_BlitMap *map) map->table = NULL; } } + int GAL_MapSurface (GAL_Surface *src, GAL_Surface *dst) { GAL_PixelFormat *srcfmt; @@ -669,8 +674,8 @@ int GAL_MapSurface (GAL_Surface *src, GAL_Surface *dst) /* BitField --> BitField */ if ( #ifdef _MGGAL_S3C6410 - (((src->flags & GAL_HWSURFACE) == GAL_HWSURFACE) && ((dst->flags & GAL_HWSURFACE) == GAL_HWSURFACE)) - || + (((src->flags & GAL_HWSURFACE) == GAL_HWSURFACE) && + ((dst->flags & GAL_HWSURFACE) == GAL_HWSURFACE)) || #endif FORMAT_EQUAL(srcfmt, dstfmt) ) { @@ -687,6 +692,7 @@ int GAL_MapSurface (GAL_Surface *src, GAL_Surface *dst) /* Choose your blitters wisely */ return(GAL_CalculateBlit(src)); } + void GAL_FreeBlitMap(GAL_BlitMap *map) { if ( map ) {