]> git.cworth.org Git - apitrace/commitdiff
gui: make sure that the alpha channel is initialized
authorZack Rusin <zack@kde.org>
Thu, 12 Sep 2013 21:41:57 +0000 (17:41 -0400)
committerZack Rusin <zack@kde.org>
Thu, 12 Sep 2013 21:41:57 +0000 (17:41 -0400)
For surfaces with less than four channels we weren't
initializing the alpha channel resulting in an image
that had garbage for alpha.

gui/apisurface.cpp

index 199cd7d3cdb115c884571fb58005150b644ed094..a872c13b6b2270a27eb68685a289b4827d77057c 100644 (file)
@@ -144,7 +144,7 @@ ApiSurface::qimageFromRawImage(const image::Image *image)
         if (image->channelType == image::TYPE_UNORM8) {
             const unsigned char *src = srcRow;
             for (int x = 0; x < width; ++x) {
-                unsigned char rgba[4];
+                unsigned char rgba[4] = {0, 0, 0, 0xff};
                 for (int c = 0; c < image->channels; ++c) {
                     rgba[c] = *src++;
                 }