BZ #567559: Flip images in software for PPM output since hardware flipping

fails on some video cards
This commit is contained in:
Siddhesh Poyarekar 2010-02-28 10:41:10 +00:00
parent 919581c1a1
commit d2f7f99207
2 changed files with 108 additions and 1 deletions

View File

@ -0,0 +1,98 @@
commit aac1f0378e293a6e456a7de5e1fe615e581be202
Author: Andrew Caudwell <acaudwell@gmail.com>
Date: Wed Feb 24 16:23:41 2010 +1300
PPM output no longer flips the image in hardware, which failed on
some video cards.
diff --git a/src/ppm.cpp b/src/ppm.cpp
index 82ac334..9f103d9 100644
--- a/src/ppm.cpp
+++ b/src/ppm.cpp
@@ -37,8 +37,9 @@ FrameExporter::FrameExporter() {
rowstride = display.width * 3;
- pixels1 = new char[display.height * rowstride];
- pixels2 = new char[display.height * rowstride];
+ pixels1 = new char[display.height * rowstride];
+ pixels2 = new char[display.height * rowstride];
+ pixels_out = new char[display.height * rowstride];
pixels_shared_ptr = 0;
@@ -73,6 +74,7 @@ FrameExporter::~FrameExporter() {
delete[] pixels1;
delete[] pixels2;
+ delete[] pixels_out;
}
void FrameExporter::dump() {
@@ -82,12 +84,6 @@ void FrameExporter::dump() {
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- //render view to texture
- display.renderToTexture(screentex, display.width, display.height, GL_RGBA);
-
- //draw view screen flipped
- display.fullScreenQuad(true);
-
char* next_pixel_ptr = (pixels_shared_ptr == pixels1) ? pixels2 : pixels1;
// copy pixels - now the right way up
@@ -103,10 +99,6 @@ void FrameExporter::dump() {
SDL_CondSignal(cond);
SDL_mutexV(mutex);
-
- // redraw view the right way up for the user
- display.fullScreenQuad(false);
-
}
void FrameExporter::dumpThr() {
@@ -119,7 +111,17 @@ void FrameExporter::dumpThr() {
if (dumper_thread_state == FRAME_EXPORTER_EXIT) break;
- dumpImpl();
+ if (pixels_shared_ptr != 0) {
+
+ //invert image
+ for(int y=0;y<display.height;y++) {
+ for(int x=0;x<rowstride;x++) {
+ pixels_out[x + y * rowstride] = pixels_shared_ptr[x + (display.height - y - 1) * rowstride];
+ }
+ }
+
+ dumpImpl();
+ }
dumper_thread_state = FRAME_EXPORTER_WAIT;
}
@@ -166,9 +168,6 @@ PPMExporter::~PPMExporter() {
}
void PPMExporter::dumpImpl() {
- if(pixels_shared_ptr==0) return;
-
*output << ppmheader;
-
- output->write(pixels_shared_ptr, rowstride * display.height);
+ output->write(pixels_out, rowstride * display.height);
}
diff --git a/src/ppm.h b/src/ppm.h
index 994c661..7564fbd 100644
--- a/src/ppm.h
+++ b/src/ppm.h
@@ -35,6 +35,8 @@ protected:
char* pixels1;
char* pixels2;
+ char* pixels_out;
+
char* pixels_shared_ptr;
size_t rowstride;

View File

@ -3,7 +3,7 @@
Summary: Software version control visualization
Name: gource
Version: 0.24
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://gource.googlecode.com/
Source: http://gource.googlecode.com/files/%{name}-%{version}.tar.gz
@ -24,6 +24,9 @@ BuildRequires: freetype-devel
Requires: gnu-free-sans-fonts
# https://bugzilla.redhat.com/show_bug.cgi?id=567559
Patch0: gource-ppm-software-flip.patch
%description
OpenGL-based 3D visualisation tool for source control repositories.
@ -36,6 +39,8 @@ files and directories.
%setup -q
sed -i.cp -e 's|cp |cp -p |' Makefile.in
%patch0 -p1 -b .ppm-software-flip
%build
%configure --enable-ttf-font-dir=%{_datadir}/fonts/gnu-free/
make %{?_smp_mflags}
@ -59,6 +64,10 @@ rm -rf %{buildroot}
%{_datadir}/gource/*
%changelog
* Sun Feb 28 2010 Siddhesh Poyarekar <spoyarek@redhat.com> - 0.24-2
- BZ #567559: Flip images in software for PPM output since hardware flipping
fails on some video cards
* Thu Feb 18 2010 Siddhesh Poyarekar <spoyarek@redhat.com> - 0.24-1
- New upstream release
- Added COPYING, README, THANKS and ChangeLog in docs