From 4389d32381eb26734fb4451d3f1f883fcf1c3342 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 3 Mar 2014 19:29:31 -0500 Subject: [PATCH] GIFTranslator: Read the left and top image coordinates --- src/add-ons/translators/gif/GIFLoad.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/add-ons/translators/gif/GIFLoad.cpp b/src/add-ons/translators/gif/GIFLoad.cpp index 137d886001..9979e7d4a9 100644 --- a/src/add-ons/translators/gif/GIFLoad.cpp +++ b/src/add-ons/translators/gif/GIFLoad.cpp @@ -263,6 +263,8 @@ GIFLoad::ReadGIFImageHeader() if (fInput->Read(data, 9) < 9) return false; + int left = data[0] + (data[1] << 8); + int top = data[2] + (data[3] << 8); int localWidth = data[4] + (data[5] << 8); int localHeight = data[6] + (data[7] << 8); if (fWidth != localWidth || fHeight != localHeight) { @@ -284,7 +286,7 @@ GIFLoad::ReadGIFImageHeader() return false; } - BRect rect(0, 0, fWidth - 1, fHeight - 1); + BRect rect(left, top, left + fWidth - 1, top + fHeight - 1); TranslatorBitmap header; header.magic = B_HOST_TO_BENDIAN_INT32(B_TRANSLATOR_BITMAP); header.bounds.left = B_HOST_TO_BENDIAN_FLOAT(rect.left);