diff options
author | noamsml@chromium.org <noamsml@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-31 23:15:19 +0000 |
---|---|---|
committer | noamsml@chromium.org <noamsml@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-31 23:15:19 +0000 |
commit | 45a4f1ff5da3196aa03cfbe3862f57a1e1eb029c (patch) | |
tree | 146dfa0eb49e203dfd8676e39cd5685945d051c7 /chrome/utility/chrome_content_utility_client.cc | |
parent | 2879a90031e5025d366b7305d8b7d9f401dcf97a (diff) | |
download | chromium_src-45a4f1ff5da3196aa03cfbe3862f57a1e1eb029c.zip chromium_src-45a4f1ff5da3196aa03cfbe3862f57a1e1eb029c.tar.gz chromium_src-45a4f1ff5da3196aa03cfbe3862f57a1e1eb029c.tar.bz2 |
Update PWG Raster encoder to latest version and add transformation
1. Update PWG raster encoder to latest version ported from GCP code
2. This new version adds the ability to flip the input while encoding,
use this to implement the transformations specified in PwgRasterConfig.
BUG=354605
Review URL: https://codereview.chromium.org/211783004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility/chrome_content_utility_client.cc')
-rw-r--r-- | chrome/utility/chrome_content_utility_client.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index f7274ed..01d4c57 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -731,8 +731,36 @@ bool ChromeContentUtilityClient::RenderPDFPagesToPWGRaster( autoupdate)) { return false; } + + cloud_print::PwgHeaderInfo header_info; + header_info.dpi = settings.dpi(); + header_info.total_pages = total_page_count; + + // Transform odd pages. + if (page_number % 2) { + switch (bitmap_settings.odd_page_transform) { + case printing::TRANSFORM_NORMAL: + break; + case printing::TRANSFORM_ROTATE_180: + header_info.flipx = true; + header_info.flipy = true; + break; + case printing::TRANSFORM_FLIP_HORIZONTAL: + header_info.flipx = true; + break; + case printing::TRANSFORM_FLIP_VERTICAL: + header_info.flipy = true; + break; + } + } + + if (bitmap_settings.rotate_all_pages) { + header_info.flipx = !header_info.flipx; + header_info.flipy = !header_info.flipy; + } + std::string pwg_page; - if (!encoder.EncodePage(image, settings.dpi(), total_page_count, &pwg_page)) + if (!encoder.EncodePage(&image, header_info, &pwg_page)) return false; bytes_written = base::WritePlatformFileAtCurrentPos(bitmap_file, pwg_page.data(), |