aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobo1on1 <bobo1on1@svn>2009-12-19 22:48:08 +0000
committerbobo1on1 <bobo1on1@svn>2009-12-19 22:48:08 +0000
commitd36db1bc9ed4c4e2f233fbac65fc89261a157507 (patch)
tree4d2f267bb67cbabdbde6aacb590f97ac4dfae3d2
parent4ed44633951ededfe3236499b192d598fce987cf (diff)
fixed: D3DLOCK_READONLY flag when locking the backbuffer makes things faster
fixed: set alpha byte to 0xFF on all playforms git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@25864 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/Util.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index 3719b1a7f8..70b6542010 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -1871,7 +1871,7 @@ void CUtil::TakeScreenshot(const CStdString &filename, bool sync)
D3DLOCKED_RECT lr;
D3DSURFACE_DESC desc;
lpSurface->GetDesc(&desc);
- if (SUCCEEDED(lpSurface->LockRect(&lr, NULL, 0)))
+ if (SUCCEEDED(lpSurface->LockRect(&lr, NULL, D3DLOCK_READONLY)))
{
width = desc.Width;
height = desc.Height;
@@ -1924,11 +1924,6 @@ void CUtil::TakeScreenshot(const CStdString &filename, bool sync)
for (int y = 0; y < height; y++)
memcpy(outpixels + y * stride, pixels + (height - y - 1) * stride, stride);
- //set alpha byte to 0xFF
- unsigned char* alphaptr = outpixels - 1;
- for (int i = 0; i < width * height; i++)
- *(alphaptr += 4) = 0xFF;
-
delete pixels;
#else
@@ -1944,6 +1939,14 @@ void CUtil::TakeScreenshot(const CStdString &filename, bool sync)
CLog::Log(LOGDEBUG, "Saving screenshot %s", filename.c_str());
+ //set alpha byte to 0xFF
+ for (int y = 0; y < height; y++)
+ {
+ unsigned char* alphaptr = outpixels - 1 + y * stride;
+ for (int x = 0; x < width; x++)
+ *(alphaptr += 4) = 0xFF;
+ }
+
//if sync is true, the png file needs to be completely written when this function returns
if (sync)
{