[vlc-commits] commit: Qt4: speedup pictureflow rendering littlebit by using scanline and qtransform instead of doing those by hand (Ilkka Ollakka )

git at videolan.org git at videolan.org
Sun Nov 7 20:35:48 CET 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Nov  7 21:26:43 2010 +0200| [b3a201c3b24352020c4393cad0644b11e5d72625] | committer: Ilkka Ollakka 

Qt4: speedup pictureflow rendering littlebit by using scanline and qtransform instead of doing those by hand

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b3a201c3b24352020c4393cad0644b11e5d72625
---

 modules/gui/qt4/util/pictureflow.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp
index 3a33963..c5a6112 100644
--- a/modules/gui/qt4/util/pictureflow.cpp
+++ b/modules/gui/qt4/util/pictureflow.cpp
@@ -509,24 +509,33 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol
 
     // offscreen buffer: black is sweet
     QImage* result = new QImage(hs, w, QImage::Format_RGB32);
+    QPainter imagePainter( result );
+    QTransform rotation;
+    rotation.rotate(90);
     result->fill(bgcolor);
 
     // transpose the image, this is to speed-up the rendering
     // because we process one column at a time
     // (and much better and faster to work row-wise, i.e in one scanline)
+    /*
     for (int x = 0; x < w; x++)
         for (int y = 0; y < h; y++)
             result->setPixel(hofs + y, x, img.pixel(x, y));
-
+    */
+    imagePainter.drawImage( hofs+h, 0, result->transformed( rotation ) );
     if (reflectionEffect != PictureFlow::NoReflection) {
         // create the reflection
         int ht = hs - h - hofs;
         int hte = ht;
         for (int x = 0; x < w; x++)
+        {
+            QRgb *line = (QRgb*)(result->scanLine( x ));
             for (int y = 0; y < ht; y++) {
                 QRgb color = img.pixel(x, img.height() - y - 1);
-                result->setPixel(h + hofs + y, x, blendColor(color, bgcolor, 128*(hte - y) / hte));
+                line[h+hofs+y] = blendColor( color, bgcolor, 128*(hte-y)/hte );
+                //result->setPixel(h + hofs + y, x, blendColor(color, bgcolor, 128*(hte - y) / hte));
             }
+        }
 
         if (reflectionEffect == PictureFlow::BlurredReflection) {
             // blur the reflection everything first



More information about the vlc-commits mailing list