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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? surface.c

?? libminigui-1.3.0.tar.gz。 miniGUI的庫(kù)函數(shù)源代碼!
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/***  $Id: surface.c,v 1.21 2003/11/22 03:53:11 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) {        GAL_Rect sr;        sr.x = srcx;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本美女一区二区| 欧美精品一级二级三级| 国产综合色视频| 蜜臀精品一区二区三区在线观看| 亚洲一级不卡视频| 亚洲精品国产第一综合99久久| 国产精品国产三级国产aⅴ入口 | 中文字幕欧美日本乱码一线二线| 欧美电影免费观看高清完整版在线| 91精品国产乱| 欧美一区二区日韩一区二区| 日韩一区二区三区电影在线观看| 91精品免费观看| 欧美一区二区三区白人| 欧美大片一区二区| 久久久久久久久免费| 国产午夜久久久久| 午夜成人在线视频| 亚洲第一狼人社区| 日韩成人免费看| 免费av网站大全久久| 麻豆精品在线视频| 久久成人久久爱| 国产精品一区二区三区99| 国产福利一区二区三区| 成人国产精品免费观看动漫| 99国产欧美另类久久久精品| 色婷婷亚洲综合| 欧美性大战久久久久久久 | 欧美久久婷婷综合色| 欧美日本乱大交xxxxx| 欧美一区二区久久久| 精品入口麻豆88视频| 欧美激情一区三区| 亚洲影视资源网| 强制捆绑调教一区二区| 国产精品一卡二| 色综合天天在线| 国产精品美女久久久久久久久久久 | 免费观看成人av| 国产精品影视网| 91视视频在线观看入口直接观看www| 色婷婷一区二区| 678五月天丁香亚洲综合网| 精品va天堂亚洲国产| 国产精品无码永久免费888| 亚洲精品免费看| 美女性感视频久久| 成人av网站免费| 欧美精品18+| 欧美韩国一区二区| 香蕉久久夜色精品国产使用方法 | 91精品国产一区二区人妖| 久久亚洲一区二区三区明星换脸| 国产精品成人免费在线| 日本亚洲天堂网| 成人h动漫精品| 欧美一区二区播放| 最新中文字幕一区二区三区| 99re亚洲国产精品| 日韩欧美国产不卡| 一区二区三区日本| 国产真实精品久久二三区| 在线观看视频一区| 久久精品人人做人人爽人人| 亚洲一区二区三区不卡国产欧美| 韩国av一区二区三区在线观看| 日本电影欧美片| 久久久欧美精品sm网站| 亚洲第一久久影院| 菠萝蜜视频在线观看一区| 日韩欧美你懂的| 一区二区三区**美女毛片| 国产成人精品亚洲777人妖| 3atv一区二区三区| 亚洲丝袜精品丝袜在线| 国产一区二区三区在线看麻豆| 欧美视频精品在线观看| 国产精品美女一区二区| 国产综合色产在线精品| 欧美精品高清视频| 一区二区在线观看免费视频播放| 国产九色sp调教91| 欧美成人精品二区三区99精品| 亚洲专区一二三| 91在线观看免费视频| 久久―日本道色综合久久| 七七婷婷婷婷精品国产| 欧美日韩在线观看一区二区 | 久久精品在线免费观看| 日本三级亚洲精品| 欧美日韩一区久久| 亚洲一区在线看| 91麻豆swag| 中文字幕一区二区三区不卡| 国产老肥熟一区二区三区| 精品国精品国产| 久久精品72免费观看| 欧美精选在线播放| 亚洲gay无套男同| 欧美在线视频全部完| 一区二区在线免费| 日本丰满少妇一区二区三区| 日韩理论片在线| 91在线视频观看| 亚洲欧洲美洲综合色网| 99久久国产免费看| 成人免费在线视频观看| 99久久精品国产网站| 中文字幕中文乱码欧美一区二区| 成人精品电影在线观看| 亚洲欧洲一区二区三区| 97成人超碰视| 一区二区三区电影在线播| 欧美亚一区二区| 偷窥国产亚洲免费视频| 91麻豆精品国产91| 久久国产精品无码网站| 欧美精品一区二区三区一线天视频| 蜜臀av在线播放一区二区三区| 日韩欧美在线123| 极品美女销魂一区二区三区免费| www久久久久| 丰满白嫩尤物一区二区| 亚洲欧洲精品一区二区三区不卡| 91在线porny国产在线看| 玉米视频成人免费看| 欧美日韩免费视频| 蜜桃一区二区三区在线观看| 精品av久久707| 成人午夜视频免费看| 中文字幕一区av| 欧美色爱综合网| 美女被吸乳得到大胸91| 国产三级精品三级在线专区| 波多野结衣中文一区| 一区二区高清在线| 91精品国产综合久久福利软件| 国产真实乱子伦精品视频| 国产精品久久久久久亚洲毛片| 色94色欧美sute亚洲线路一久| 五月天欧美精品| 久久久不卡网国产精品二区| 99精品欧美一区| 日韩激情av在线| 中文字幕免费不卡在线| 欧美色倩网站大全免费| 国产在线不卡一区| 亚洲精品写真福利| 日韩久久免费av| 欧美国产日韩精品免费观看| 欧洲一区在线电影| 久久99国产精品免费| 亚洲人成在线观看一区二区| 欧美肥妇free| www.日韩av| 奇米色一区二区| 国产精品不卡在线| 日韩精品在线一区二区| 99国产精品视频免费观看| 麻豆久久久久久| 亚洲精选视频免费看| www国产成人免费观看视频 深夜成人网| aaa国产一区| 久久精品国产99国产| 亚洲欧美电影一区二区| 精品福利在线导航| 欧美偷拍一区二区| 国产69精品久久99不卡| 日日夜夜精品视频免费| 18欧美亚洲精品| 精品国产乱码久久久久久久久| 日本道精品一区二区三区| 韩国欧美一区二区| 亚洲aⅴ怡春院| 亚洲美女屁股眼交| 国产无人区一区二区三区| 欧美一区二区视频在线观看2020| 99久久综合精品| 国产精品一级二级三级| 日韩vs国产vs欧美| 亚洲综合色婷婷| 国产精品嫩草99a| 精品久久免费看| 欧美日韩国产经典色站一区二区三区| 成人av在线看| 久久99国产精品久久99| 亚洲超碰97人人做人人爱| 亚洲三级在线看| 国产精品私人自拍| 久久综合九色综合97婷婷女人| 制服丝袜国产精品| 欧美亚洲一区二区在线观看| proumb性欧美在线观看| 国产精品一区二区你懂的| 91精品国产色综合久久ai换脸| 一本大道av一区二区在线播放| 高清不卡在线观看av| 国产精品中文字幕欧美| 韩国欧美一区二区|