Path: blob/master/libmupen64plus/mupen64plus-video-glide64mk2/src/GlideHQ/tc-1.1+/texstore.c
2 views
/*1* Mesa 3-D graphics library2* Version: 6.33*4* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.5*6* Permission is hereby granted, free of charge, to any person obtaining a7* copy of this software and associated documentation files (the "Software"),8* to deal in the Software without restriction, including without limitation9* the rights to use, copy, modify, merge, publish, distribute, sublicense,10* and/or sell copies of the Software, and to permit persons to whom the11* Software is furnished to do so, subject to the following conditions:12*13* The above copyright notice and this permission notice shall be included14* in all copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS17* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL19* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN20* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN21* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.22*/2324/* Copyright (C) 2007 Hiroshi Morii <koolsmoky(at)users.sourceforge.net>25* _mesa_upscale_teximage2d speedup26*/2728#include <assert.h>2930#include "types.h"31#include "internal.h"323334void35_mesa_upscale_teximage2d (unsigned int inWidth, unsigned int inHeight,36unsigned int outWidth, unsigned int outHeight,37unsigned int comps,38const byte *src, int srcRowStride,39byte *dest)40{41unsigned int i, j, k;4243assert(outWidth >= inWidth);44assert(outHeight >= inHeight);4546#if 1 /* H.Morii - faster loops */47for (i = 0; i < inHeight; i++) {48for (j = 0; j < inWidth; j++) {49const int aa = (i * outWidth + j) * comps;50const int bb = i * srcRowStride + j * comps;51for (k = 0; k < comps; k++) {52dest[aa + k] = src[bb + k];53}54}55for (; j < outWidth; j++) {56const int aa = (i * outWidth + j) * comps;57const int bb = i * srcRowStride + (j - inWidth) * comps;58for (k = 0; k < comps; k++) {59dest[aa + k] = src[bb + k];60}61}62}63for (; i < outHeight; i++) {64for (j = 0; j < inWidth; j++) {65const int aa = (i * outWidth + j) * comps;66const int bb = (i - inHeight) * srcRowStride + j * comps;67for (k = 0; k < comps; k++) {68dest[aa + k] = src[bb + k];69}70}71for (; j < outWidth; j++) {72const int aa = (i * outWidth + j) * comps;73const int bb = (i - inHeight) * srcRowStride + (j - inWidth) * comps;74for (k = 0; k < comps; k++) {75dest[aa + k] = src[bb + k];76}77}78}79#else80for (i = 0; i < outHeight; i++) {81const int ii = i % inHeight;82for (j = 0; j < outWidth; j++) {83const int jj = j % inWidth;84const int aa = (i * outWidth + j) * comps;85const int bb = ii * srcRowStride + jj * comps;86for (k = 0; k < comps; k++) {87dest[aa + k] = src[bb + k];88}89}90}91#endif92}939495