Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmain.c
Go to the documentation of this file.
00001 /* 00002 * Copyright 2009 Vincent Povirk for CodeWeavers 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00017 */ 00018 00019 00020 #include "config.h" 00021 00022 #include <stdarg.h> 00023 00024 #include "windef.h" 00025 #include "winbase.h" 00026 #include "objbase.h" 00027 #include "wincodec.h" 00028 00029 #include "wincodecs_private.h" 00030 00031 #include "wine/debug.h" 00032 00033 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); 00034 00035 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 00036 { 00037 00038 switch (fdwReason) 00039 { 00040 case DLL_WINE_PREATTACH: 00041 return FALSE; /* prefer native version */ 00042 case DLL_PROCESS_ATTACH: 00043 DisableThreadLibraryCalls(hinstDLL); 00044 break; 00045 case DLL_PROCESS_DETACH: 00046 break; 00047 } 00048 00049 return TRUE; 00050 } 00051 00052 HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer, 00053 UINT srcwidth, UINT srcheight, INT srcstride, 00054 const WICRect *rc, UINT dststride, UINT dstbuffersize, BYTE *dstbuffer) 00055 { 00056 UINT bytesperrow; 00057 UINT row_offset; /* number of bits into the source rows where the data starts */ 00058 00059 if (rc->X < 0 || rc->Y < 0 || rc->X+rc->Width > srcwidth || rc->Y+rc->Height > srcheight) 00060 return E_INVALIDARG; 00061 00062 bytesperrow = ((bpp * rc->Width)+7)/8; 00063 00064 if (dststride < bytesperrow) 00065 return E_INVALIDARG; 00066 00067 if ((dststride * rc->Height) > dstbuffersize) 00068 return E_INVALIDARG; 00069 00070 row_offset = rc->X * bpp; 00071 00072 if (row_offset % 8 == 0) 00073 { 00074 /* everything lines up on a byte boundary */ 00075 UINT row; 00076 const BYTE *src; 00077 BYTE *dst; 00078 00079 src = srcbuffer + (row_offset / 8) + srcstride * rc->Y; 00080 dst = dstbuffer; 00081 for (row=0; row < rc->Height; row++) 00082 { 00083 memcpy(dst, src, bytesperrow); 00084 src += srcstride; 00085 dst += dststride; 00086 } 00087 return S_OK; 00088 } 00089 else 00090 { 00091 /* we have to do a weird bitwise copy. eww. */ 00092 FIXME("cannot reliably copy bitmap data if bpp < 8\n"); 00093 return E_FAIL; 00094 } 00095 } Generated on Sun May 27 2012 04:16:43 for ReactOS by
1.7.6.1
|