From 0edcd9aecceaffe22368d91df82a0e4f6ff47d97 Mon Sep 17 00:00:00 2001 From: Yujie Qin Date: Thu, 14 Apr 2016 14:40:21 +0200 Subject: Update PIEX * Adjust the max thumbnail size to 512 pixel * Reads the correct full dimensions for DNGs which are stored in DefaultCropSize of the main image Cherry-pick of be908191d0a6883a95333bdc0bca749c9b830969 from public AOSP This change should fix the issue of Skia getPixels() / getAndroidPixels() It is already tested and used by the up-stream Skia since http://crrev.com/1883783002 Bug: 28162811, Bug: 28119810 Change-Id: I78caa62eb79ae0b6c8cf718a2ba82c0b6bde9f27 --- src/tiff_parser.cc | 31 ++++++++++++++++--------------- src/tiff_parser.h | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/tiff_parser.cc b/src/tiff_parser.cc index 697e320..00bb944 100644 --- a/src/tiff_parser.cc +++ b/src/tiff_parser.cc @@ -556,7 +556,22 @@ bool GetFullDimension32(const TiffDirectory& tiff_directory, } } - if (tiff_directory.Has(kExifTagWidth) && tiff_directory.Has(kExifTagHeight)) { + if (tiff_directory.Has(kExifTagDefaultCropSize)) { + std::vector crop(2); + std::vector crop_rational(2); + if (tiff_directory.Get(kExifTagDefaultCropSize, &crop)) { + *width = crop[0]; + *height = crop[1]; + } else if (tiff_directory.Get(kExifTagDefaultCropSize, &crop_rational) && + crop_rational[0].denominator != 0 && + crop_rational[1].denominator != 0) { + *width = crop_rational[0].numerator / crop_rational[0].denominator; + *height = crop_rational[1].numerator / crop_rational[1].denominator; + } else { + return false; + } + } else if (tiff_directory.Has(kExifTagWidth) && + tiff_directory.Has(kExifTagHeight)) { if (!tiff_directory.Get(kExifTagWidth, width) || !tiff_directory.Get(kExifTagHeight, height)) { return false; @@ -585,20 +600,6 @@ bool GetFullDimension32(const TiffDirectory& tiff_directory, } else { return false; } - } else if (tiff_directory.Has(kExifTagDefaultCropSize)) { - std::vector crop(2); - std::vector crop_rational(2); - if (tiff_directory.Get(kExifTagDefaultCropSize, &crop)) { - *width = crop[0]; - *height = crop[1]; - } else if (tiff_directory.Get(kExifTagDefaultCropSize, &crop_rational) && - crop_rational[0].denominator != 0 && - crop_rational[1].denominator != 0) { - *width = crop_rational[0].numerator / crop_rational[0].denominator; - *height = crop_rational[1].numerator / crop_rational[1].denominator; - } else { - return false; - } } return true; } diff --git a/src/tiff_parser.h b/src/tiff_parser.h index a19b71e..3cb9d7e 100644 --- a/src/tiff_parser.h +++ b/src/tiff_parser.h @@ -28,7 +28,7 @@ namespace piex { // Specifies the maximum number of pixels for thumbnails in each direction. -const int kThumbnailMaxDimension = 256; +const int kThumbnailMaxDimension = 512; // Specifies all tags that might be of interest to get the preview data. enum GpsTags { -- cgit v1.2.3