Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 1858963002: Rename printing::ClipBox to PdfRectangle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | printing/pdf_transform.h » ('j') | printing/pdf_transform.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 3178
3179 const gfx::Rect gfx_content_rect(content_rect.x(), 3179 const gfx::Rect gfx_content_rect(content_rect.x(),
3180 content_rect.y(), 3180 content_rect.y(),
3181 content_rect.width(), 3181 content_rect.width(),
3182 content_rect.height()); 3182 content_rect.height());
3183 const double scale_factor = fit_to_page ? 3183 const double scale_factor = fit_to_page ?
3184 printing::CalculateScaleFactor( 3184 printing::CalculateScaleFactor(
3185 gfx_content_rect, src_page_width, src_page_height, rotated) : 1.0; 3185 gfx_content_rect, src_page_width, src_page_height, rotated) : 1.0;
3186 3186
3187 // Calculate positions for the clip box. 3187 // Calculate positions for the clip box.
3188 printing::ClipBox media_box; 3188 printing::PdfRectangle media_box;
3189 printing::ClipBox crop_box; 3189 printing::PdfRectangle crop_box;
3190 bool has_media_box = !!FPDFPage_GetMediaBox(page, 3190 bool has_media_box = !!FPDFPage_GetMediaBox(page,
3191 &media_box.left, 3191 &media_box.left,
3192 &media_box.bottom, 3192 &media_box.bottom,
3193 &media_box.right, 3193 &media_box.right,
3194 &media_box.top); 3194 &media_box.top);
3195 bool has_crop_box = !!FPDFPage_GetCropBox(page, 3195 bool has_crop_box = !!FPDFPage_GetCropBox(page,
3196 &crop_box.left, 3196 &crop_box.left,
3197 &crop_box.bottom, 3197 &crop_box.bottom,
3198 &crop_box.right, 3198 &crop_box.right,
3199 &crop_box.top); 3199 &crop_box.top);
3200 printing::CalculateMediaBoxAndCropBox( 3200 printing::CalculateMediaBoxAndCropBox(
3201 rotated, has_media_box, has_crop_box, &media_box, &crop_box); 3201 rotated, has_media_box, has_crop_box, &media_box, &crop_box);
3202 printing::ClipBox source_clip_box = 3202 printing::PdfRectangle source_clip_box =
3203 printing::CalculateClipBoxBoundary(media_box, crop_box); 3203 printing::CalculateClipBoxBoundary(media_box, crop_box);
3204 printing::ScaleClipBox(scale_factor, &source_clip_box); 3204 printing::ScalePdfRectangle(scale_factor, &source_clip_box);
3205 3205
3206 // Calculate the translation offset values. 3206 // Calculate the translation offset values.
3207 double offset_x = 0; 3207 double offset_x = 0;
3208 double offset_y = 0; 3208 double offset_y = 0;
3209 if (fit_to_page) { 3209 if (fit_to_page) {
3210 printing::CalculateScaledClipBoxOffset( 3210 printing::CalculateScaledClipBoxOffset(
3211 gfx_content_rect, source_clip_box, &offset_x, &offset_y); 3211 gfx_content_rect, source_clip_box, &offset_x, &offset_y);
3212 } else { 3212 } else {
3213 printing::CalculateNonScaledClipBoxOffset( 3213 printing::CalculateNonScaledClipBoxOffset(
3214 gfx_content_rect, src_page_rotation, 3214 gfx_content_rect, src_page_rotation,
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3873 FPDF_DOCUMENT doc = 3873 FPDF_DOCUMENT doc =
3874 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 3874 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
3875 if (!doc) 3875 if (!doc)
3876 return false; 3876 return false;
3877 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 3877 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
3878 FPDF_CloseDocument(doc); 3878 FPDF_CloseDocument(doc);
3879 return success; 3879 return success;
3880 } 3880 }
3881 3881
3882 } // namespace chrome_pdf 3882 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | printing/pdf_transform.h » ('j') | printing/pdf_transform.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698