Changeset 10167 for trunk/src


Ignore:
Timestamp:
Jul 16, 2003, 12:46:18 PM (22 years ago)
Author:
sandervl
Message:

DT: Fix for partial blits in StretchDIBits; optimized rgb conversion calls

Location:
trunk/src/gdi32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/blit.cpp

    r10059 r10167  
    1 /* $Id: blit.cpp,v 1.44 2003-05-02 15:32:27 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.45 2003-07-16 10:46:16 sandervl Exp $ */
    22
    33/*
     
    183183
    184184        newbits = (WORD *)malloc(imgsize);
    185         if(CPUFeatures & CPUID_MMX) {
    186              RGB555to565MMX(newbits, (WORD *)bits, imgsize/sizeof(WORD));
    187         }
    188         else
    189           RGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD));
     185        pRGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD));
    190186        bits = newbits;
    191187    }
     
    469465        break;
    470466    }
     467
    471468    if(bitfields[1] == RGB555_GREEN_MASK)
    472469    {//RGB 555?
     
    474471
    475472        ULONG imgsize = CalcBitmapSize(info->bmiHeader.biBitCount,
    476                                      widthSrc, heightSrc);
     473                                     abs(info->bmiHeader.biWidth), heightSrc);
    477474        ULONG offset = CalcBitmapSize(info->bmiHeader.biBitCount,
    478                                      xSrc, ySrc)/sizeof(WORD);
     475                                     abs(info->bmiHeader.biWidth), ySrc)/sizeof(WORD);
    479476        newbits = (WORD *) HeapAlloc(GetProcessHeap(), 0, imgsize);
    480 //bugbug (too much)
    481 //bugbug
    482         if(CPUFeatures & CPUID_MMX) {
    483              RGB555to565MMX(newbits, (WORD *)bits+offset, imgsize/sizeof(WORD));
    484         }
    485         else
    486           RGB555to565(newbits, (WORD *)bits+offset, imgsize/sizeof(WORD));
     477
     478        //we still convert too much
     479        pRGB555to565(newbits, (WORD *)bits+offset, imgsize/sizeof(WORD));
    487480        bits = newbits;
     481
     482        ySrc = 0;
    488483    }
    489484    //SvL: Ignore BI_BITFIELDS type (StretchDIBits fails otherwise)
  • trunk/src/gdi32/dibitmap.cpp

    r10088 r10167  
    1 /* $Id: dibitmap.cpp,v 1.40 2003-05-14 11:39:59 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.41 2003-07-16 10:46:17 sandervl Exp $ */
    22
    33/*
     
    112112
    113113        newbits = (WORD *)malloc(imgsize);
    114         if(CPUFeatures & CPUID_MMX) {
    115              RGB555to565MMX(newbits, (WORD *)lpbInit, imgsize/sizeof(WORD));
    116         }
    117         else RGB555to565(newbits, (WORD *)lpbInit, imgsize/sizeof(WORD));
     114        pRGB555to565(newbits, (WORD *)lpbInit, imgsize/sizeof(WORD));
     115
    118116        lpbInit = newbits;
    119117    }
     
    496494                                     lpbi->bmiHeader.biWidth, nrlines);
    497495
    498         if(CPUFeatures & CPUID_MMX) {
    499              RGB565to555MMX((WORD *)lpvBits, (WORD *)lpvBits, imgsize/sizeof(WORD));
    500         }
    501         else RGB565to555((WORD *)lpvBits, (WORD *)lpvBits, imgsize/sizeof(WORD));
     496        pRGB565to555((WORD *)lpvBits, (WORD *)lpvBits, imgsize/sizeof(WORD));
    502497    }
    503498
     
    515510void WIN32API ConvertRGB555to565(LPVOID dest, LPVOID src, UINT imgsize)
    516511{
    517     if(CPUFeatures & CPUID_MMX) {
    518          RGB555to565MMX((WORD *)dest, (WORD *)src, imgsize/sizeof(WORD));
    519     }
    520     else RGB555to565((WORD *)dest, (WORD *)src, imgsize/sizeof(WORD));
     512    pRGB555to565((WORD *)dest, (WORD *)src, imgsize/sizeof(WORD));
    521513}
    522514//******************************************************************************
     
    592584
    593585        newbits = (WORD *)malloc(imgsize);
    594         if(CPUFeatures & CPUID_MMX) {
    595              RGB555to565MMX(newbits, (WORD *)pBits, imgsize/sizeof(WORD));
    596         }
    597         else RGB555to565(newbits, (WORD *)pBits, imgsize/sizeof(WORD));
     586        pRGB555to565(newbits, (WORD *)pBits, imgsize/sizeof(WORD));
    598587        pBits = newbits;
    599588    }
  • trunk/src/gdi32/dibsect.cpp

    r10088 r10167  
    1 /* $Id: dibsect.cpp,v 1.66 2003-05-14 11:39:59 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.67 2003-07-16 10:46:17 sandervl Exp $ */
    22
    33/*
     
    2323#include <winconst.h>
    2424#include <winuser32.h>
    25 #include <cpuhlp.h>
    2625#include <dcdata.h>
    2726#include "dibsect.h"
     
    626625        if (iLength > 0)
    627626        {
    628             if(CPUFeatures & CPUID_MMX)
    629                     RGB555to565MMX((WORD *)bmpBitsDblBuffer, (WORD *)bitmapBits, iLength/sizeof(WORD));
    630             else    RGB555to565((WORD *)bmpBitsDblBuffer, (WORD *)bitmapBits, iLength/sizeof(WORD));
     627            pRGB555to565((WORD *)bmpBitsDblBuffer, (WORD *)bitmapBits, iLength/sizeof(WORD));
    631628        }
    632629        else
     
    760757      destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes;
    761758
    762       if(CPUFeatures & CPUID_MMX) {
    763             RGB565to555MMX((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
    764       }
    765       else  RGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
     759      pRGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
    766760  }
    767761
  • trunk/src/gdi32/initgdi32.cpp

    r8934 r10167  
    1 /* $Id: initgdi32.cpp,v 1.13 2002-07-29 11:26:48 sandervl Exp $
     1/* $Id: initgdi32.cpp,v 1.14 2003-07-16 10:46:18 sandervl Exp $
    22 *
    33 * DLL entry point
     
    3535#include <winconst.h>
    3636#include <odinlx.h>
    37 #include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
     37#include <cpuhlp.h>
     38#include <dbglog.h>
    3839#include "region.h"
    3940#include <initdll.h>
    4041#include <stats.h>
    4142#include "dibsect.h"
     43#include "rgbcvt.h"
    4244
    4345#define DBG_LOCALLOG    DBG_initterm
     
    4850 extern DWORD gdi32_PEResTab;
    4951}
     52
    5053static HMODULE dllHandle = 0;
     54void (_Optlink *pRGB555to565)(WORD *dest, WORD *src, ULONG num) = NULL;
     55void (_Optlink *pRGB565to555)(WORD *dest, WORD *src, ULONG num) = NULL;
     56
    5157//******************************************************************************
    5258//******************************************************************************
     
    97103         }
    98104         DIBSection::initDIBSection();
     105         if(CPUFeatures & CPUID_MMX) {
     106             pRGB555to565 = RGB555to565MMX;
     107             pRGB565to555 = RGB565to555MMX;
     108         }
     109         else {
     110             pRGB555to565 = RGB555to565;
     111             pRGB555to565 = RGB565to555;
     112         }
    99113         dllHandle = RegisterLxDll(hModule, GdiLibMain, (PVOID)&gdi32_PEResTab,
    100114                                   GDI32_MAJORIMAGE_VERSION, GDI32_MINORIMAGE_VERSION,
  • trunk/src/gdi32/rgbcvt.h

    r8871 r10167  
    1 //$Id: rgbcvt.h,v 1.3 2002-07-15 10:02:30 sandervl Exp $
     1//$Id: rgbcvt.h,v 1.4 2003-07-16 10:46:18 sandervl Exp $
    22#ifndef __RGBCVT_H__
    33#define __RGBCVT_H__
     
    3232void _Optlink RGB565to555MMX(WORD *dest, WORD *src, ULONG num);
    3333
     34extern void (_Optlink *pRGB555to565)(WORD *dest, WORD *src, ULONG num);
     35extern void (_Optlink *pRGB565to555)(WORD *dest, WORD *src, ULONG num);
     36
    3437#endif //__RGBCVT_H__
Note: See TracChangeset for help on using the changeset viewer.