亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? surface.c

?? linux下的圖形界面開發minigui最新源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/***  $Id: surface.c,v 1.20 2003/09/04 06:02:53 weiym Exp $**  **  Port to MiniGUI by Wei Yongming (2001/10/03).**  Copyright (C) 2001 ~ 2002 Wei Yongming.**  Copyright (C) 2003 Feynman Software.****  SDL - Simple DirectMedia Layer**  Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga*//*** 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 2 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, write to the Free Software** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "common.h"#include "newgal.h"#include "sysvideo.h"#include "blit.h"#include "RLEaccel_c.h"#include "pixels_c.h"#include "memops.h"#include "leaks.h"/* Public routines *//* * Create an empty RGB surface of the appropriate depth */GAL_Surface * GAL_CreateRGBSurface (Uint32 flags,            int width, int height, int depth,            Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask){    GAL_VideoDevice *video = current_video;    GAL_VideoDevice *this  = current_video;    GAL_Surface *screen;    GAL_Surface *surface;    /* Check to see if we desire the surface in video memory */    if ( video ) {        screen = GAL_PublicSurface;    } else {        screen = NULL;    }    if ( screen && ((screen->flags&GAL_HWSURFACE) == GAL_HWSURFACE) ) {        if ( (flags&(GAL_SRCCOLORKEY|GAL_SRCALPHA)) != 0 ) {            flags |= GAL_HWSURFACE;        }        if ( (flags & GAL_SRCCOLORKEY) == GAL_SRCCOLORKEY ) {            if ( ! current_video->info.blit_hw_CC ) {                flags &= ~GAL_HWSURFACE;            }        }        if ( (flags & GAL_SRCALPHA) == GAL_SRCALPHA ) {            if ( ! current_video->info.blit_hw_A ) {                flags &= ~GAL_HWSURFACE;            }        }    } else {        flags &= ~GAL_HWSURFACE;    }    /* Allocate the surface */    surface = (GAL_Surface *)malloc(sizeof(*surface));    if ( surface == NULL ) {        GAL_OutOfMemory();        return(NULL);    }    surface->flags = GAL_SWSURFACE;    if ( (flags & GAL_HWSURFACE) == GAL_HWSURFACE ) {        depth = screen->format->BitsPerPixel;        Rmask = screen->format->Rmask;        Gmask = screen->format->Gmask;        Bmask = screen->format->Bmask;        Amask = screen->format->Amask;    }    surface->format = GAL_AllocFormat(depth, Rmask, Gmask, Bmask, Amask);    if ( surface->format == NULL ) {        free(surface);        return(NULL);    }    if ( Amask ) {        surface->flags |= GAL_SRCALPHA;    }    surface->w = width;    surface->h = height;    surface->pitch = GAL_CalculatePitch(surface);    surface->pixels = NULL;    surface->offset = 0;    surface->hwdata = NULL;    surface->locked = 0;    surface->map = NULL;    surface->format_version = 0;    GAL_SetClipRect(surface, NULL);    /* Get the pixels */    if ( ((flags&GAL_HWSURFACE) == GAL_SWSURFACE) ||                 (video->AllocHWSurface(this, surface) < 0) ) {        if ( surface->w && surface->h ) {            surface->pixels = malloc(surface->h*surface->pitch);            if ( surface->pixels == NULL ) {                GAL_FreeSurface(surface);                GAL_OutOfMemory();                return(NULL);            }            /* This is important for bitmaps */            memset(surface->pixels, 0, surface->h*surface->pitch);        }    }    /* Allocate an empty mapping */    surface->map = GAL_AllocBlitMap();    if ( surface->map == NULL ) {        GAL_FreeSurface(surface);        return(NULL);    }    /* The surface is ready to go */    surface->refcount = 1;#ifdef CHECK_LEAKS    ++surfaces_allocated;#endif    return(surface);}/* * Create an RGB surface from an existing memory buffer */GAL_Surface * GAL_CreateRGBSurfaceFrom (void *pixels,            int width, int height, int depth, int pitch,            Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask){    GAL_Surface *surface;    surface = GAL_CreateRGBSurface(GAL_SWSURFACE, 0, 0, depth,                                   Rmask, Gmask, Bmask, Amask);    if ( surface != NULL ) {        surface->flags |= GAL_PREALLOC;        surface->pixels = pixels;        surface->w = width;        surface->h = height;        surface->pitch = pitch;        GAL_SetClipRect(surface, NULL);    }    return(surface);}/* * Set the color key in a blittable surface */int GAL_SetColorKey (GAL_Surface *surface, Uint32 flag, Uint32 key){    /* Sanity check the flag as it gets passed in */    if ( flag & GAL_SRCCOLORKEY ) {        if ( flag & (GAL_RLEACCEL|GAL_RLEACCELOK) ) {            flag = (GAL_SRCCOLORKEY | GAL_RLEACCELOK);        } else {            flag = GAL_SRCCOLORKEY;        }    } else {        flag = 0;    }    /* Optimize away operations that don't change anything */    if ( (flag == (surface->flags & (GAL_SRCCOLORKEY|GAL_RLEACCELOK))) &&         (key == surface->format->colorkey) ) {        return(0);    }    /* UnRLE surfaces before we change the colorkey */    if ( surface->flags & GAL_RLEACCEL ) {            GAL_UnRLESurface(surface, 1);    }    if ( flag ) {        GAL_VideoDevice *video = current_video;        GAL_VideoDevice *this  = current_video;        surface->flags |= GAL_SRCCOLORKEY;        surface->format->colorkey = key;        if ( (surface->flags & GAL_HWACCEL) == GAL_HWACCEL ) {            if ( (video->SetHWColorKey == NULL) ||                 (video->SetHWColorKey(this, surface, key) < 0) ) {                surface->flags &= ~GAL_HWACCEL;            }        }        if ( flag & GAL_RLEACCELOK ) {            surface->flags |= GAL_RLEACCELOK;        } else {            surface->flags &= ~GAL_RLEACCELOK;        }    } else {        surface->flags &= ~(GAL_SRCCOLORKEY|GAL_RLEACCELOK);        surface->format->colorkey = 0;    }    GAL_InvalidateMap(surface->map);    return(0);}int GAL_SetAlpha (GAL_Surface *surface, Uint32 flag, Uint8 value){    Uint32 oldflags = surface->flags;    Uint32 oldalpha = surface->format->alpha;    /* Sanity check the flag as it gets passed in */    if ( flag & GAL_SRCALPHA ) {        if ( flag & (GAL_RLEACCEL|GAL_RLEACCELOK) ) {            flag = (GAL_SRCALPHA | GAL_RLEACCELOK);        } else {            flag = GAL_SRCALPHA;        }    } else {        flag = 0;    }    /* Optimize away operations that don't change anything */    if ( (flag == (surface->flags & (GAL_SRCALPHA|GAL_RLEACCELOK))) &&         (!flag || value == oldalpha) ) {        return(0);    }    if(!(flag & GAL_RLEACCELOK) && (surface->flags & GAL_RLEACCEL))        GAL_UnRLESurface(surface, 1);    if ( flag ) {        GAL_VideoDevice *video = current_video;        GAL_VideoDevice *this  = current_video;        surface->flags |= GAL_SRCALPHA;        surface->format->alpha = value;        if ( (surface->flags & GAL_HWACCEL) == GAL_HWACCEL ) {            if ( (video->SetHWAlpha == NULL) ||                 (video->SetHWAlpha(this, surface, value) < 0) ) {                surface->flags &= ~GAL_HWACCEL;            }        }        if ( flag & GAL_RLEACCELOK ) {                surface->flags |= GAL_RLEACCELOK;        } else {                surface->flags &= ~GAL_RLEACCELOK;        }    } else {        surface->flags &= ~GAL_SRCALPHA;        surface->format->alpha = GAL_ALPHA_OPAQUE;    }    /*     * The representation for software surfaces is independent of     * per-surface alpha, so no need to invalidate the blit mapping     * if just the alpha value was changed. (If either is 255, we still     * need to invalidate.)     */    if((surface->flags & GAL_HWACCEL) == GAL_HWACCEL       || oldflags != surface->flags       || (((oldalpha + 1) ^ (value + 1)) & 0x100))        GAL_InvalidateMap(surface->map);    return(0);}/* * A function to calculate the intersection of two rectangles: * return true if the rectangles intersect, false otherwise */static __inline__GAL_bool GAL_IntersectRect(const GAL_Rect *A, const GAL_Rect *B, GAL_Rect *intersection){    int Amin, Amax, Bmin, Bmax;    /* Horizontal intersection */    Amin = A->x;    Amax = Amin + A->w;    Bmin = B->x;    Bmax = Bmin + B->w;    if(Bmin > Amin)            Amin = Bmin;    intersection->x = Amin;    if(Bmax < Amax)            Amax = Bmax;    intersection->w = Amax - Amin > 0 ? Amax - Amin : 0;    /* Vertical intersection */    Amin = A->y;    Amax = Amin + A->h;    Bmin = B->y;    Bmax = Bmin + B->h;    if(Bmin > Amin)            Amin = Bmin;    intersection->y = Amin;    if(Bmax < Amax)            Amax = Bmax;    intersection->h = Amax - Amin > 0 ? Amax - Amin : 0;    return (intersection->w && intersection->h);}/* * Set the clipping rectangle for a blittable surface */GAL_bool GAL_SetClipRect(GAL_Surface *surface, GAL_Rect *rect){    GAL_Rect full_rect;    /* Don't do anything if there's no surface to act on */    if ( ! surface ) {        return GAL_FALSE;    }    /* Set up the full surface rectangle */    full_rect.x = 0;    full_rect.y = 0;    full_rect.w = surface->w;    full_rect.h = surface->h;    /* Set the clipping rectangle */    if ( ! rect ) {        surface->clip_rect = full_rect;        return 1;    }    return GAL_IntersectRect(rect, &full_rect, &surface->clip_rect);}void GAL_GetClipRect(GAL_Surface *surface, GAL_Rect *rect){    if ( surface && rect ) {        *rect = surface->clip_rect;    }}/*  * Set up a blit between two surfaces -- split into three parts: * The upper part, GAL_UpperBlit(), performs clipping and rectangle  * verification.  The lower part is a pointer to a low level * accelerated blitting function. * * These parts are separated out and each used internally by this  * library in the optimimum places.  They are exported so that if * you know exactly what you are doing, you can optimize your code * by calling the one(s) you need. */int GAL_LowerBlit (GAL_Surface *src, GAL_Rect *srcrect,                GAL_Surface *dst, GAL_Rect *dstrect){    GAL_blit do_blit;    /* Check to make sure the blit mapping is valid */    if ( (src->map->dst != dst) ||             (src->map->dst->format_version != src->map->format_version) ) {        if ( GAL_MapSurface(src, dst) < 0 ) {            return(-1);        }    }    /* Figure out which blitter to use */    if ( (src->flags & GAL_HWACCEL) == GAL_HWACCEL ) {        do_blit = src->map->hw_blit;    } else {        do_blit = src->map->sw_blit;    }    return(do_blit(src, srcrect, dst, dstrect));}int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,           GAL_Surface *dst, GAL_Rect *dstrect){    GAL_Rect fulldst;    int srcx, srcy, w, h;    /* Make sure the surfaces aren't locked */    if ( ! src || ! dst ) {        GAL_SetError("GAL_UpperBlit: passed a NULL surface");        return(-1);    }    if ( src->locked || dst->locked ) {        GAL_SetError("Surfaces must not be locked during blit");        return(-1);    }    /* If the destination rectangle is NULL, use the entire dest surface */    if ( dstrect == NULL ) {        fulldst.x = fulldst.y = 0;        dstrect = &fulldst;    }    /* clip the source rectangle to the source surface */    if(srcrect) {        int maxw, maxh;            srcx = srcrect->x;        w = srcrect->w;        if(srcx < 0) {            w += srcx;            dstrect->x -= srcx;            srcx = 0;        }        maxw = src->w - srcx;        if(maxw < w)            w = maxw;        srcy = srcrect->y;        h = srcrect->h;        if(srcy < 0) {                h += srcy;            dstrect->y -= srcy;            srcy = 0;        }        maxh = src->h - srcy;        if(maxh < h)            h = maxh;            } else {        srcx = srcy = 0;        w = src->w;        h = src->h;    }    /* clip the destination rectangle against the clip rectangle */    {        GAL_Rect *clip = &dst->clip_rect;        int dx, dy;        dx = clip->x - dstrect->x;        if(dx > 0) {            w -= dx;            dstrect->x += dx;            srcx += dx;        }        dx = dstrect->x + w - clip->x - clip->w;        if(dx > 0)            w -= dx;        dy = clip->y - dstrect->y;        if(dy > 0) {            h -= dy;            dstrect->y += dy;            srcy += dy;        }        dy = dstrect->y + h - clip->y - clip->h;        if(dy > 0)            h -= dy;    }    if(w > 0 && h > 0) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产人久久人人人人爽| 亚洲色欲色欲www在线观看| 久久综合久久综合久久综合| 国产精品乱码人人做人人爱| 亚洲国产中文字幕| 成人av在线网| 日韩欧美亚洲一区二区| 亚洲香肠在线观看| 成人av综合一区| 日韩欧美成人午夜| 亚洲最快最全在线视频| 国产成人av一区二区三区在线观看| 欧洲生活片亚洲生活在线观看| 26uuu色噜噜精品一区二区| 亚洲第一主播视频| a亚洲天堂av| 中文字幕乱码一区二区免费| 青青草97国产精品免费观看| 色综合久久综合网欧美综合网| 久久精品在线观看| 久久国产日韩欧美精品| 欧美丰满高潮xxxx喷水动漫| 亚洲精品欧美在线| 99久久综合国产精品| 久久理论电影网| 黄一区二区三区| 欧美va天堂va视频va在线| 日韩精彩视频在线观看| 欧美日韩国产区一| 亚洲mv大片欧洲mv大片精品| 在线日韩国产精品| 一区二区三区波多野结衣在线观看| av电影天堂一区二区在线| 中文字幕不卡在线播放| 成人一区二区三区视频 | 天使萌一区二区三区免费观看| aaa国产一区| 亚洲另类中文字| 91久久国产最好的精华液| 一区二区在线观看不卡| 欧美三级一区二区| 午夜不卡在线视频| 欧美一级二级三级乱码| 精品一区二区免费在线观看| 精品国产一二三| 成人在线视频一区二区| 亚洲欧美色图小说| 欧美无砖专区一中文字| 男人操女人的视频在线观看欧美| 日韩三区在线观看| 国产精品一二三区在线| 1024成人网| 欧美日韩精品欧美日韩精品一综合| 日韩电影在线一区二区三区| 精品少妇一区二区三区视频免付费 | 日韩欧美一区在线观看| 国产麻豆精品在线| 中文字幕中文字幕在线一区| 欧美网站一区二区| 久久爱另类一区二区小说| 国产精品久久久久aaaa| 欧美性猛交xxxx乱大交退制版 | 中文字幕日本不卡| 欧美另类z0zxhd电影| 激情深爱一区二区| 自拍偷在线精品自拍偷无码专区 | 91麻豆文化传媒在线观看| 亚洲国产精品一区二区尤物区| 欧美一区二区久久| 99麻豆久久久国产精品免费优播| 亚洲国产美国国产综合一区二区| 欧美成人精品福利| 色婷婷久久99综合精品jk白丝| 首页欧美精品中文字幕| 中文字幕欧美国产| 91精品久久久久久久久99蜜臂| 加勒比av一区二区| 亚洲国产中文字幕在线视频综合| 精品日韩一区二区| 欧美日韩综合一区| 成人福利视频网站| 久久草av在线| 午夜精品久久久| 成人欧美一区二区三区小说| 日韩欧美美女一区二区三区| 色婷婷久久一区二区三区麻豆| 国产一区二区免费在线| 亚洲成人一区在线| 最新热久久免费视频| 日韩一区二区三区视频| 日本高清不卡视频| 成人高清在线视频| 国产毛片精品视频| 麻豆国产精品视频| 午夜久久久久久电影| 日韩美女啊v在线免费观看| 精品国产凹凸成av人导航| 欧美人伦禁忌dvd放荡欲情| 99vv1com这只有精品| 国产精品18久久久久久久网站| 男女男精品网站| 五月开心婷婷久久| 香蕉久久一区二区不卡无毒影院| 综合激情成人伊人| 亚洲日本在线看| 亚洲欧美精品午睡沙发| 国产精品久久久久久户外露出| 久久影视一区二区| 久久一留热品黄| 欧美一级国产精品| 日韩三级精品电影久久久| 91精品国产综合久久久蜜臀图片 | 国产电影一区在线| 国产精品影视网| 成人性色生活片免费看爆迷你毛片| 另类人妖一区二区av| 蜜臀a∨国产成人精品| 美女视频免费一区| 久久99深爱久久99精品| 精品一区二区在线播放| 国产一区二区伦理片| 国产麻豆成人传媒免费观看| 激情欧美一区二区三区在线观看| 精品一区二区三区久久久| 国产一区二区三区黄视频| 国产盗摄一区二区| a在线播放不卡| 在线视频一区二区免费| 欧美日本国产视频| 精品对白一区国产伦| 2024国产精品| ...xxx性欧美| 婷婷久久综合九色综合伊人色| 日韩av在线播放中文字幕| 久久国产综合精品| 国产成a人亚洲精| 色欧美乱欧美15图片| 538在线一区二区精品国产| 日韩精品一区在线| 国产精品视频你懂的| 亚洲欧美激情小说另类| 日本三级亚洲精品| 高清不卡在线观看av| 91麻豆.com| 日韩一区二区三区三四区视频在线观看 | 一区二区免费在线| 蜜桃视频在线一区| 成人av在线播放网址| 欧美日韩国产综合视频在线观看| 日韩免费高清电影| 国产精品你懂的在线| 亚洲午夜三级在线| 国产精品18久久久久久久网站| 91黄色免费观看| 综合亚洲深深色噜噜狠狠网站| 亚洲国产成人va在线观看天堂| 国产一区二区三区观看| 精品1区2区3区| 欧美国产1区2区| 免费在线观看成人| 91色九色蝌蚪| 久久久久国产免费免费| 午夜日韩在线电影| 91在线视频免费91| 精品国产网站在线观看| 亚洲亚洲人成综合网络| 福利一区在线观看| 日韩限制级电影在线观看| 亚洲视频在线观看三级| 国产最新精品精品你懂的| 欧美日韩一级二级三级| 成人欧美一区二区三区1314 | 一区二区三区中文在线| 国产一区二区精品久久| 在线成人午夜影院| 一区二区三区在线观看欧美| 国产精品888| 日韩免费观看高清完整版| 亚洲va国产天堂va久久en| 99久久精品情趣| 国产偷v国产偷v亚洲高清 | 艳妇臀荡乳欲伦亚洲一区| 懂色一区二区三区免费观看| 欧美tickling网站挠脚心| 日韩高清电影一区| 欧美日韩卡一卡二| 亚洲综合在线电影| 99精品久久只有精品| 国产欧美日韩三级| 国产麻豆精品视频| 久久影音资源网| 国模冰冰炮一区二区| 精品欧美一区二区三区精品久久| 亚洲成人免费视| 欧美日韩一区二区电影| 亚洲国产精品久久久久秋霞影院| 欧洲一区二区av| 无码av免费一区二区三区试看| 欧美日韩一本到| 日韩精品三区四区|