[Scummvm-cvs-logs] SF.net SVN: scummvm:[38484] scummvm/branches/branch-0-13-0
joostp at users.sourceforge.net
joostp at users.sourceforge.net
Wed Feb 18 16:01:08 CET 2009
Revision: 38484
http://scummvm.svn.sourceforge.net/scummvm/?rev=38484&view=rev
Author: joostp
Date: 2009-02-18 15:01:07 +0000 (Wed, 18 Feb 2009)
Log Message:
-----------
backport from trunk: PSP use 4444 overlay + honour alpha bits in applyScreenShading()
Modified Paths:
--------------
scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.cpp
scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.h
scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp_gu.cpp
scummvm/branches/branch-0-13-0/graphics/VectorRendererSpec.cpp
scummvm/branches/branch-0-13-0/graphics/colormasks.h
Modified: scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.cpp 2009-02-18 14:57:03 UTC (rev 38483)
+++ scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.cpp 2009-02-18 15:01:07 UTC (rev 38484)
@@ -86,8 +86,8 @@
sceDisplaySetFrameBuf((char *)DisplayBuffer, 512, 1, 1);
sceDisplayWaitVblankStart();
- // Correct pixel format ABBBBBGGGGGRRRRR
- InitScalers(1555);
+ // Correct pixel format AAAABBBBGGGGRRRR
+ InitScalers(4444);
}
OSystem_PSP::~OSystem_PSP() {
@@ -117,7 +117,7 @@
}
bool OSystem_PSP::getFeatureState(Feature f) {
- return false;
+ return (f == kFeatureOverlaySupportsAlpha);
}
const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const {
Modified: scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.h
===================================================================
--- scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.h 2009-02-18 14:57:03 UTC (rev 38483)
+++ scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp.h 2009-02-18 15:01:07 UTC (rev 38484)
@@ -108,7 +108,7 @@
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual void grabPalette(byte *colors, uint start, uint num);
- virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); }
+ virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); }
virtual bool showMouse(bool visible);
Modified: scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp_gu.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp_gu.cpp 2009-02-18 14:57:03 UTC (rev 38483)
+++ scummvm/branches/branch-0-13-0/backends/platform/psp/osys_psp_gu.cpp 2009-02-18 15:01:07 UTC (rev 38484)
@@ -333,15 +333,19 @@
vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
vertices[0].u = 0.5; vertices[0].v = 0.5;
vertices[1].u = _overlayWidth - 0.5; vertices[1].v = _overlayHeight - 0.5;
- sceGuTexMode(GU_PSM_5551, 0, 0, 0); // 16-bit image
- sceGuAlphaFunc(GU_GREATER, 0, 0xff);
- sceGuEnable(GU_ALPHA_TEST);
+ sceGuTexMode(GU_PSM_4444, 0, 0, 0); // 16-bit image
+ sceGuDisable(GU_ALPHA_TEST);
+ sceGuEnable(GU_BLEND);
+
+ //sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
+ sceGuBlendFunc(GU_ADD, GU_FIX, GU_ONE_MINUS_SRC_ALPHA, 0xFFFFFFFF, 0);
+
if (_overlayWidth > 320)
sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer);
else
sceGuTexImage(0, 512, 256, _overlayWidth, _overlayBuffer);
- sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
// need to render twice for textures > 512
if ( _overlayWidth > 512) {
@@ -350,6 +354,7 @@
vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0;
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
}
+ sceGuDisable(GU_BLEND);
}
// draw mouse
Modified: scummvm/branches/branch-0-13-0/graphics/VectorRendererSpec.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/graphics/VectorRendererSpec.cpp 2009-02-18 14:57:03 UTC (rev 38483)
+++ scummvm/branches/branch-0-13-0/graphics/VectorRendererSpec.cpp 2009-02-18 15:01:07 UTC (rev 38484)
@@ -363,7 +363,8 @@
const uint32 shiftMask = (uint32)~(
(1 << PixelFormat::kGreenShift) |
(1 << PixelFormat::kRedShift) |
- (1 << PixelFormat::kBlueShift)) >> 1;
+ (1 << PixelFormat::kBlueShift) |
+ (PixelFormat::kAlphaBits ? (1 << PixelFormat::kAlphaShift) : 0)) >> 1;
if (shadingStyle == GUI::ThemeEngine::kShadingDim) {
Modified: scummvm/branches/branch-0-13-0/graphics/colormasks.h
===================================================================
--- scummvm/branches/branch-0-13-0/graphics/colormasks.h 2009-02-18 14:57:03 UTC (rev 38483)
+++ scummvm/branches/branch-0-13-0/graphics/colormasks.h 2009-02-18 15:01:07 UTC (rev 38484)
@@ -160,10 +160,17 @@
kGreenBits = 4,
kBlueBits = 4,
+#ifdef __PSP__ //PSP uses ABGR
kAlphaShift = kRedBits+kGreenBits+kBlueBits,
+ kRedShift = 0,
+ kGreenShift = kRedBits,
+ kBlueShift = kRedBits+kGreenBits,
+#else //ARGB
+ kAlphaShift = kRedBits+kGreenBits+kBlueBits,
kRedShift = kGreenBits+kBlueBits,
kGreenShift = kBlueBits,
kBlueShift = 0,
+#endif
kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
kRedMask = ((1 << kRedBits) - 1) << kRedShift,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list