Revision: 11110
http://xbmc.svn.sourceforge.net/xbmc/?rev=11110&view=rev
Author: darkdonno
Date: 2007-12-28 01:17:17 -0800 (Fri, 28 Dec 2007)
Log Message:
-----------
changed: XBMCTex tool so its more GNUC friendly.
Modified Paths:
--------------
trunk/XBMC/tools/XBMCTex/AnimatedGif.cpp
trunk/XBMC/tools/XBMCTex/AnimatedGif.h
trunk/XBMC/tools/XBMCTex/Bundler.cpp
trunk/XBMC/tools/XBMCTex/Bundler.h
trunk/XBMC/tools/XBMCTex/XBMCTex.cpp
trunk/XBMC/tools/XBMCTex/cmdlineargs.h
trunk/XBMC/tools/XBMCTex/stdafx.h
trunk/XBMC/tools/XBMCTex/xbox.cpp
Modified: trunk/XBMC/tools/XBMCTex/AnimatedGif.cpp
===================================================================
--- trunk/XBMC/tools/XBMCTex/AnimatedGif.cpp 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/AnimatedGif.cpp 2007-12-28 09:17:17 UTC (rev 11110)
@@ -27,7 +27,7 @@
// ****************************************************************************
#include "stdafx.h"
-#include "animatedgif.h"
+#include "AnimatedGif.h"
#pragma pack(1)
// Error processing macro (NO-OP by default):
@@ -60,26 +60,6 @@
delete [] Raster;
}
-// Round a number to the nearest power of 2 rounding up
-// runs pretty quickly - the only expensive op is the bsr
-// alternive would be to dec the source, round down and double the result
-// which is slightly faster but rounds 1 to 2
-DWORD __forceinline __stdcall PadPow2(DWORD x)
-{
- __asm {
- mov edx,x // put the value in edx
- xor ecx,ecx // clear ecx - if x is 0 bsr doesn't alter it
- bsr ecx,edx // find MSB position
- mov eax,1 // shift 1 by result effectively
- shl eax,cl // doing a round down to power of 2
- cmp eax,edx // check if x was already a power of two
- adc ecx,0 // if it wasn't then CF is set so add to ecx
- mov eax,1 // shift 1 by result again, this does a round
- shl eax,cl // up as a result of adding CF to ecx
- }
- // return result in eax
-}
-
// Init: Allocates space for raster and palette in GDI-compatible structures.
void CAnimatedGif::Init(int iWidth, int iHeight, int iBPP, int iLoops)
{
@@ -628,4 +608,4 @@
// Refer to WINIMAGE.TXT for copyright and patent notices on GIF and LZW.
-#pragma pack()
\ No newline at end of file
+#pragma pack()
Modified: trunk/XBMC/tools/XBMCTex/AnimatedGif.h
===================================================================
--- trunk/XBMC/tools/XBMCTex/AnimatedGif.h 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/AnimatedGif.h 2007-12-28 09:17:17 UTC (rev 11110)
@@ -3,7 +3,6 @@
\brief
*/
-
// ****************************************************************************
//
// WINIMAGE.H : Generic classes for raster images (MSWindows specialization)
@@ -32,8 +31,6 @@
//
// ****************************************************************************
-
-
using namespace std;
#pragma pack(1)
Modified: trunk/XBMC/tools/XBMCTex/Bundler.cpp
===================================================================
--- trunk/XBMC/tools/XBMCTex/Bundler.cpp 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/Bundler.cpp 2007-12-28 09:17:17 UTC (rev 11110)
@@ -1,5 +1,5 @@
#include "StdAfx.h"
-#include ".\bundler.h"
+#include "Bundler.h"
#include "../../xbmc/lib/liblzo/lzo1x.h"
// alignment of file blocks - should be a multiple of the sector size of the disk and a power of 2
Modified: trunk/XBMC/tools/XBMCTex/Bundler.h
===================================================================
--- trunk/XBMC/tools/XBMCTex/Bundler.h 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/Bundler.h 2007-12-28 09:17:17 UTC (rev 11110)
@@ -23,4 +23,4 @@
int WriteBundle(const char* Filename, int NoProtect);
bool AddFile(const char* Filename, int nBuffers, const void** Buffers, DWORD* Sizes);
-};
\ No newline at end of file
+};
Modified: trunk/XBMC/tools/XBMCTex/XBMCTex.cpp
===================================================================
--- trunk/XBMC/tools/XBMCTex/XBMCTex.cpp 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/XBMCTex.cpp 2007-12-28 09:17:17 UTC (rev 11110)
@@ -21,27 +21,6 @@
UINT TotalDstPixels;
bool AllowLinear;
-
-// Round a number to the nearest power of 2 rounding up
-// runs pretty quickly - the only expensive op is the bsr
-// alternive would be to dec the source, round down and double the result
-// which is slightly faster but rounds 1 to 2
-DWORD __forceinline __stdcall PadPow2(DWORD x)
-{
- __asm {
- mov edx,x // put the value in edx
- xor ecx,ecx // clear ecx - if x is 0 bsr doesn't alter it
- bsr ecx,edx // find MSB position
- mov eax,1 // shift 1 by result effectively
- shl eax,cl // doing a round down to power of 2
- cmp eax,edx // check if x was already a power of two
- adc ecx,0 // if it wasn't then CF is set so add to ecx
- mov eax,1 // shift 1 by result again, this does a round
- shl eax,cl // up as a result of adding CF to ecx
- }
- // return result in eax
-}
-
#pragma pack(push,1)
struct RGBCOLOUR
{
Modified: trunk/XBMC/tools/XBMCTex/cmdlineargs.h
===================================================================
--- trunk/XBMC/tools/XBMCTex/cmdlineargs.h 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/cmdlineargs.h 2007-12-28 09:17:17 UTC (rev 11110)
@@ -88,4 +88,4 @@
}; // class CmdLineArgs
-#endif // CMDLINEARGS_H
\ No newline at end of file
+#endif // CMDLINEARGS_H
Modified: trunk/XBMC/tools/XBMCTex/stdafx.h
===================================================================
--- trunk/XBMC/tools/XBMCTex/stdafx.h 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/stdafx.h 2007-12-28 09:17:17 UTC (rev 11110)
@@ -25,11 +25,44 @@
#include <XGraphics.h>
#endif
+#include "xbox.h"
+
+// Round a number to the nearest power of 2 rounding up
+// runs pretty quickly - the only expensive op is the bsr
+// alternive would be to dec the source, round down and double the result
+// which is slightly faster but rounds 1 to 2
+#if defined(_MSC_VER)
+DWORD __forceinline __stdcall PadPow2(DWORD x)
+{
+ __asm {
+ mov edx,x // put the value in edx
+ xor ecx,ecx // clear ecx - if x is 0 bsr doesn't alter it
+ bsr ecx,edx // find MSB position
+ mov eax,1 // shift 1 by result effectively
+ shl eax,cl // doing a round down to power of 2
+ cmp eax,edx // check if x was already a power of two
+ adc ecx,0 // if it wasn't then CF is set so add to ecx
+ mov eax,1 // shift 1 by result again, this does a round
+ shl eax,cl // up as a result of adding CF to ecx
+ }
+ // return result in eax
+}
+#else
+DWORD inline PadPow2(DWORD x)
+{
+ --x;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ return ++x;
+}
+#endif
+
// Debug macros
+#if defined(_DEBUG) && defined(_MSC_VER)
#include <crtdbg.h>
-
-#ifdef _DEBUG
-
#define TRACE0(f) _RPT0(_CRT_WARN, f)
#define TRACE1(f, a) _RPT1(_CRT_WARN, f, a)
#define TRACE2(f, a, b) _RPT2(_CRT_WARN, f, a, b)
@@ -48,4 +81,4 @@
#endif
-#include "xbox.h"
\ No newline at end of file
+
Modified: trunk/XBMC/tools/XBMCTex/xbox.cpp
===================================================================
--- trunk/XBMC/tools/XBMCTex/xbox.cpp 2007-12-27 15:02:41 UTC (rev 11109)
+++ trunk/XBMC/tools/XBMCTex/xbox.cpp 2007-12-28 09:17:17 UTC (rev 11110)
@@ -1,5 +1,9 @@
#include "stdafx.h"
+#ifndef min
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
bool IsPowerOf2(UINT number)
{
return (number & (~number+1)) == number;
@@ -158,21 +162,6 @@
// runs pretty quickly - the only expensive op is the bsr
// alternive would be to dec the source, round down and double the result
// which is slightly faster but rounds 1 to 2
-DWORD __forceinline __stdcall PadPow2(DWORD x)
-{
- __asm {
- mov edx,x // put the value in edx
- xor ecx,ecx // clear ecx - if x is 0 bsr doesn't alter it
- bsr ecx,edx // find MSB position
- mov eax,1 // shift 1 by result effectively
- shl eax,cl // doing a round down to power of 2
- cmp eax,edx // check if x was already a power of two
- adc ecx,0 // if it wasn't then CF is set so add to ecx
- mov eax,1 // shift 1 by result again, this does a round
- shl eax,cl // up as a result of adding CF to ecx
- }
- // return result in eax
-}
D3DFORMAT D3DFormat(XB_D3DFORMAT format)
{
@@ -233,4 +222,4 @@
return hr;
#endif
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|