From 87028c546fe5bdd8e5c08e47a551f15f9c257bb5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Apr 2010 07:28:54 +0000 Subject: PSP: Fix code formatting using astyle svn-id: r48634 --- backends/platform/psp/memory.cpp | 66 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'backends/platform/psp/memory.cpp') diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp index 9cf7ba7c6c..ba7645cf56 100644 --- a/backends/platform/psp/memory.cpp +++ b/backends/platform/psp/memory.cpp @@ -23,12 +23,12 @@ * */ -#include "common/scummsys.h" +#include "common/scummsys.h" #include "common/singleton.h" #include "common/list.h" #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/memory.h" - + // Class Copier -------------------------------------------------------------------------- //#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ //#define __PSP_DEBUG_PRINT__ @@ -37,7 +37,7 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) { DEBUG_ENTER_FUNC(); - + uint32 prefixDst = (((uint32)dst) & 0x3); prefixDst = prefixDst ? 4 - prefixDst : 0; // prefix only if we have address % 4 != 0 uint32 prefixSrc = (((uint32)src) & 0x3); @@ -47,11 +47,11 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *form #ifdef __PSP_DEBUG_PRINT__ uint32 debugBytes = bytes; const byte *debugDst = dst, *debugSrc = src; -#endif +#endif uint32 words, remainingBytes; - + //PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%d], swap[%s], prefixDst[%u], prefixSrc[%u]\n", dst, src, bytes, swapRB ? "true" : "false", prefixDst, prefixSrc); - + if (prefixDst || prefixSrc) { // we're not aligned to word boundaries if (prefixDst != prefixSrc) { // worst case: we can never be aligned. this mode is highly inefficient. try to get engines not to use this mode too much PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src, dst); @@ -59,10 +59,10 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *form copy8(dst, src, bytes); // no swap is possible on 8 bit else copy16((uint16 *)dst, (uint16 *)src, bytes, format); - - goto test; + + goto test; } - + // Do the prefix: the part to get us aligned if (prefixDst & 1) { // byte copy8(dst, src, prefixDst); // no swap available @@ -72,7 +72,7 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *form if (bytes > prefixDst) // check that we can afford to subtract from bytes bytes -= prefixDst; else { - DEBUG_EXIT_FUNC(); + DEBUG_EXIT_FUNC(); return; } dst32 = (uint32 *)(dst + prefixDst); @@ -80,11 +80,11 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *form } else { // We're aligned to word boundaries dst32 = (uint32 *)dst; src32 = (uint32 *)src; - } - + } + words = bytes >> 2; remainingBytes = bytes & 0x3; - + if (swapRB) { // need to swap for (; words > 0; words--) { *dst32 = format->swapRedBlue32(*src32); @@ -107,13 +107,13 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *form copy16((uint16*)dst32, (uint16 *)src32, remainingBytes, format); } -test: +test: // debug #ifdef __PSP_DEBUG_PRINT__ bool mismatch = false; - for (uint32 i=0; iswapRedBlue16(*src); dst++; src++; - } + } } else { for (; shorts > 0 ; shorts--) { *dst = *src; @@ -158,8 +158,8 @@ inline void Copier::copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixe if (remainingBytes) *(byte *)dst = *(byte *)src; } - - + + // Class VramAllocator ----------------------------------- DECLARE_SINGLETON(VramAllocator) @@ -172,34 +172,34 @@ DECLARE_SINGLETON(VramAllocator) void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { DEBUG_ENTER_FUNC(); - assert (size > 0); - + assert(size > 0); + byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; Common::List::iterator i; // Find a block that fits, starting from the beginning for (i = _allocList.begin(); i != _allocList.end(); ++i) { byte *currAddress = (*i).address; - + if (currAddress - lastAddress >= size) // We found a match break; - + if ((*i).getEnd() > lastAddress) lastAddress = (byte *)(*i).getEnd(); } if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", - size, _bytesAllocated); + size, _bytesAllocated); return NULL; } _allocList.insert(i, Allocation(lastAddress, size)); _bytesAllocated += size; - + PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); - + DEBUG_EXIT_FUNC(); return lastAddress; } @@ -208,9 +208,9 @@ void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { void VramAllocator::deallocate(void *address) { DEBUG_ENTER_FUNC(); address = (byte *)CACHED(address); // Make sure all addresses are the same - + Common::List::iterator i; - + // Find the Allocator to deallocate for (i = _allocList.begin(); i != _allocList.end(); ++i) { if ((*i).address == address) { @@ -220,8 +220,8 @@ void VramAllocator::deallocate(void *address) { DEBUG_EXIT_FUNC(); return; } - } - + } + PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); DEBUG_EXIT_FUNC(); -} +} -- cgit v1.2.3