summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/ImageWrite.cpp
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-11-15 13:05:03 +1300
committerMatthew Parlane <parlane@gmail.com>2013-11-15 13:05:03 +1300
commitba71cdcc5161602474dbf52f6149af6a4ec1ba39 (patch)
treeca3f9efd3e53481138e7c80a967fd7d531b5f17b /Source/Core/VideoCommon/Src/ImageWrite.cpp
parent033ed9477e9e2319df449b1e310de96e5c371968 (diff)
Goto crosses initialization error.
Sorry.
Diffstat (limited to 'Source/Core/VideoCommon/Src/ImageWrite.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/ImageWrite.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/Src/ImageWrite.cpp b/Source/Core/VideoCommon/Src/ImageWrite.cpp
index f42e89cfd0..7249a59952 100644
--- a/Source/Core/VideoCommon/Src/ImageWrite.cpp
+++ b/Source/Core/VideoCommon/Src/ImageWrite.cpp
@@ -81,15 +81,20 @@ bool TextureToPng(u8* data, int row_stride, const char* filename, int width, int
if (!data)
return false;
+ char title[] = "Dolphin Screenshot";
+ FILE *fp = NULL;
+ png_structp png_ptr = NULL;
+ png_infop info_ptr = NULL;
+
// Open file for writing (binary mode)
- FILE *fp = fopen(filename, "wb");
+ fp = fopen(filename, "wb");
if (fp == NULL) {
PanicAlert("Screenshot failed: Could not open file %s\n", filename);
goto finalise;
}
// Initialize write structure
- png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL) {
PanicAlert("Screenshot failed: Could not allocate write struct\n");
goto finalise;
@@ -97,7 +102,7 @@ bool TextureToPng(u8* data, int row_stride, const char* filename, int width, int
}
// Initialize info structure
- png_infop info_ptr = png_create_info_struct(png_ptr);
+ info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
PanicAlert("Screenshot failed: Could not allocate info struct\n");
goto finalise;
@@ -116,7 +121,6 @@ bool TextureToPng(u8* data, int row_stride, const char* filename, int width, int
8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
- char title[] = "Dolphin Screenshot";
png_text title_text;
title_text.compression = PNG_TEXT_COMPRESSION_NONE;
title_text.key = "Title";