Remove stale parameter from CalculateNonScaledClipBoxOffset()
Remove stale parameter from CalculateNonScaledClipBoxOffset() and change all calls with that parameter. Bug: 989977 Change-Id: I6fa9cc1d6ada76e109895af64eea40c538309c20 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1740308 Auto-Submit: Daniel Hosseinian <dhoss@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Daniel Hosseinian <dhoss@chromium.org> Cr-Commit-Position: refs/heads/master@{#684547}
This commit is contained in:

committed by
Commit Bot

parent
ef8bd7e297
commit
038f0d7d08
@ -105,8 +105,7 @@ void CalculateScaledClipBoxOffset(const gfx::Rect& content_rect,
|
||||
source_clip_box.bottom;
|
||||
}
|
||||
|
||||
void CalculateNonScaledClipBoxOffset(const gfx::Rect& content_rect,
|
||||
int rotation,
|
||||
void CalculateNonScaledClipBoxOffset(int rotation,
|
||||
int page_width,
|
||||
int page_height,
|
||||
const PdfRectangle& source_clip_box,
|
||||
|
@ -57,7 +57,7 @@ void CalculateMediaBoxAndCropBox(bool rotated,
|
||||
PdfRectangle CalculateClipBoxBoundary(const PdfRectangle& media_box,
|
||||
const PdfRectangle& crop_box);
|
||||
|
||||
// Scale |box| by |scale_factor|.
|
||||
// Scale |rect| by |scale_factor|.
|
||||
void ScalePdfRectangle(double scale_factor, PdfRectangle* rect);
|
||||
|
||||
// Calculate the clip box translation offset for a page that does need to be
|
||||
@ -77,8 +77,6 @@ void CalculateScaledClipBoxOffset(const gfx::Rect& content_rect,
|
||||
// Calculate the clip box offset for a page that does not need to be scaled.
|
||||
// All parameters are in points.
|
||||
//
|
||||
// |content_rect| specifies the printable area of the destination page, with
|
||||
// origin at left-bottom.
|
||||
// |rotation| specifies the source page rotation values which are N / 90
|
||||
// degrees.
|
||||
// |page_width| specifies the screen destination page width.
|
||||
@ -87,8 +85,7 @@ void CalculateScaledClipBoxOffset(const gfx::Rect& content_rect,
|
||||
// at left-bottom.
|
||||
// |offset_x| and |offset_y| will contain the final translation offsets for the
|
||||
// source clip box, relative to origin at left-bottom.
|
||||
void CalculateNonScaledClipBoxOffset(const gfx::Rect& content_rect,
|
||||
int rotation,
|
||||
void CalculateNonScaledClipBoxOffset(int rotation,
|
||||
int page_width,
|
||||
int page_height,
|
||||
const PdfRectangle& source_clip_box,
|
||||
|
@ -210,26 +210,25 @@ TEST(PdfTransformTest, CalculateScaledClipBoxOffset) {
|
||||
TEST(PdfTransformTest, CalculateNonScaledClipBoxOffset) {
|
||||
int page_width = kDefaultWidth;
|
||||
int page_height = kDefaultHeight;
|
||||
constexpr gfx::Rect rect(kDefaultWidth, kDefaultHeight);
|
||||
PdfRectangle clip_box;
|
||||
double offset_x;
|
||||
double offset_y;
|
||||
|
||||
// |rect|, page size and |clip_box| are the same.
|
||||
InitializeBoxToDefaultPortraitValues(&clip_box);
|
||||
CalculateNonScaledClipBoxOffset(rect, 0, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(0, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 1, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(1, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 2, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(2, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 3, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(3, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(180, offset_x);
|
||||
EXPECT_DOUBLE_EQ(-180, offset_y);
|
||||
@ -237,19 +236,19 @@ TEST(PdfTransformTest, CalculateNonScaledClipBoxOffset) {
|
||||
// Smaller |clip_box|.
|
||||
clip_box.top /= 4;
|
||||
clip_box.right /= 2;
|
||||
CalculateNonScaledClipBoxOffset(rect, 0, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(0, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(594, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 1, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(1, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 2, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(2, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(306, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 3, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(3, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(486, offset_x);
|
||||
EXPECT_DOUBLE_EQ(414, offset_y);
|
||||
@ -258,19 +257,19 @@ TEST(PdfTransformTest, CalculateNonScaledClipBoxOffset) {
|
||||
InitializeBoxToDefaultPortraitValues(&clip_box);
|
||||
page_width += 10;
|
||||
page_height += 20;
|
||||
CalculateNonScaledClipBoxOffset(rect, 0, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(0, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(20, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 1, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(1, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 2, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(2, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(10, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
CalculateNonScaledClipBoxOffset(rect, 3, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(3, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(200, offset_x);
|
||||
EXPECT_DOUBLE_EQ(-170, offset_y);
|
||||
@ -296,8 +295,8 @@ TEST(PdfTransformTest, ReversedMediaBox) {
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(792, offset_y);
|
||||
|
||||
CalculateNonScaledClipBoxOffset(rect, 0, page_width, page_height,
|
||||
media_box_b491160, &offset_x, &offset_y);
|
||||
CalculateNonScaledClipBoxOffset(0, page_width, page_height, media_box_b491160,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(792, offset_y);
|
||||
|
||||
@ -311,7 +310,7 @@ TEST(PdfTransformTest, ReversedMediaBox) {
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
|
||||
CalculateNonScaledClipBoxOffset(rect, 0, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(0, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
@ -326,7 +325,7 @@ TEST(PdfTransformTest, ReversedMediaBox) {
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
|
||||
CalculateNonScaledClipBoxOffset(rect, 0, page_width, page_height, clip_box,
|
||||
CalculateNonScaledClipBoxOffset(0, page_width, page_height, clip_box,
|
||||
&offset_x, &offset_y);
|
||||
EXPECT_DOUBLE_EQ(0, offset_x);
|
||||
EXPECT_DOUBLE_EQ(0, offset_y);
|
||||
|
@ -118,9 +118,9 @@ void TransformPDFPageForPrinting(FPDF_PAGE page,
|
||||
CalculateScaledClipBoxOffset(gfx_content_rect, source_clip_box, &offset_x,
|
||||
&offset_y);
|
||||
} else {
|
||||
CalculateNonScaledClipBoxOffset(gfx_content_rect, src_page_rotation,
|
||||
actual_page_width, actual_page_height,
|
||||
source_clip_box, &offset_x, &offset_y);
|
||||
CalculateNonScaledClipBoxOffset(src_page_rotation, actual_page_width,
|
||||
actual_page_height, source_clip_box,
|
||||
&offset_x, &offset_y);
|
||||
}
|
||||
|
||||
// Reset the media box and crop box. When the page has crop box and media box,
|
||||
|
Reference in New Issue
Block a user