summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authordeath2droid <death2droid@gmail.com>2009-05-23 07:55:38 +0000
committerdeath2droid <death2droid@gmail.com>2009-05-23 07:55:38 +0000
commit727f8aad876fd691cfabaebcbf345e48e35b75e2 (patch)
tree8f2861efa5f3c3f537193b9eb6fd102f1fc680f3 /Source
parentd6b86232e09c9ea334c685934598388b060a306b (diff)
Update the flickering fix.
Should work a lot better. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3276 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp44
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.h2
2 files changed, 26 insertions, 20 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index 8b151ffc5c..2fdf030a53 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -1177,6 +1177,30 @@ void Renderer::DrawDebugText()
Renderer::RenderText(debugtext_buffer, 21, 21, 0xDD000000);
Renderer::RenderText(debugtext_buffer, 20, 20, 0xFF00FFFF);
}
+bool Renderer::IsBlack()
+{
+ char pixels [2];
+ short color[] = {GL_RED, GL_GREEN, GL_BLUE};
+
+ for(int x = 0; x < (int) OpenGL_GetBackbufferHeight(); x++)
+ {
+ for(int y = 0; y < (int) OpenGL_GetBackbufferWidth(); y++)
+ {
+ for (int i = 0; i < 2;i++)
+ {
+ for (int c = 0; c < 2 ;c++)
+ {
+ glReadPixels(500, 300, 1, 1, color[c], GL_BYTE, &pixels[i]);
+ if(pixels[i] != 0)
+ return false;
+ else
+ return true;
+ }
+ }
+ }
+ }
+
+}
// -------------------------------------------------------------------------------------------------------
// We can now draw whatever we want on top of the picture. Then we copy the final picture to the output.
@@ -1223,26 +1247,8 @@ void Renderer::SwapBuffers()
if (g_Config.bRemoveFlicker)
{
BOOL pass = FALSE;
- char pixels [15];
- short color[] = {GL_RED, GL_GREEN, GL_BLUE};
- for( int i = 0; i < 14; i)
- {
- for( int c = 0; c < 3; c++,i+=5)
- {
- glReadPixels(300, 200, 1, 1, color[c], GL_BYTE, &pixels[i]);
- glReadPixels(300, 400, 1, 1, color[c], GL_BYTE, &pixels[i+1]);
- glReadPixels(700, 200, 1, 1, color[c], GL_BYTE, &pixels[i+2]);
- glReadPixels(700, 400, 1, 1, color[c], GL_BYTE, &pixels[i+3]);
- glReadPixels(500, 300, 1, 1, color[c], GL_BYTE, &pixels[i+4]);
- }
- }
- for( int p = 0; p < 14; p++ )
- {
- if( pixels[p] != 0 )
- pass = TRUE;
- }
- if( pass )
+ if(!Renderer::IsBlack())
OpenGL_SwapBuffers();
}
else
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h
index 60a6b6de83..10b84762a4 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h
@@ -55,7 +55,7 @@ public:
static void SwapBuffers();
static bool IsUsingATIDrawBuffers();
-
+ static bool IsBlack();
static void SetColorMask();
static void SetBlendMode(bool forceUpdate);
static bool SetScissorRect();