Revert "Fix clip box calculation in CFX_PSRenderer::SetClip_PathFill()" This reverts commit 2e017ed40229d88ac293865ab057036f62dc7eb3. Reason for revert: Blocks PDFium roll. Failure Link: crrev.com/c/8392474 Original change's description: > Fix clip box calculation in CFX_PSRenderer::SetClip_PathFill() > > In CFX_PSRenderer::SetClip_PathFill(), replace the manual coordinate > calculations with `clip_box_.Intersect(rect.GetOuterRect())`. Calling > `rect.GetOuterRect()` matches CFX_PSRenderer::SetClip_PathStroke() and > restores the logic from before CL [1]. > > Update PSRendererTest.SetClipPathFill to remove the TODOs and assert the > correct clip box values. > > [1] https://codereview.chromium.org/2612243005 > > TAG=agy > CONV=8f063108-e7ca-41cf-8504-4967b5566063 > > Bug: 553140224 > Change-Id: Ic4cdce68e24f48d9660d7a1fbde7f116620284a5 > Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157312 > Reviewed-by: Andy Phan <andyphan@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 553140224 Change-Id: Ia988b1e6e73411a68d7a0ce5ae3c63b869ae1968 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157751 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 9ac18d0..b8710e5 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -378,7 +378,10 @@ rect = pObject2Device->TransformRect(rect); } - clip_box_.Intersect(rect.GetOuterRect()); + clip_box_.left = static_cast<int>(rect.left); + clip_box_.right = static_cast<int>(rect.left + rect.right); + clip_box_.top = static_cast<int>(rect.top + rect.bottom); + clip_box_.bottom = static_cast<int>(rect.bottom); WriteString("W"); if (fill_options.fill_type != CFX_FillRenderOptions::FillType::kWinding) {
diff --git a/core/fxge/win32/cfx_psrenderer_unittest.cpp b/core/fxge/win32/cfx_psrenderer_unittest.cpp index b1ef1ac..cc5c148 100644 --- a/core/fxge/win32/cfx_psrenderer_unittest.cpp +++ b/core/fxge/win32/cfx_psrenderer_unittest.cpp
@@ -228,11 +228,13 @@ path.AppendRect(20.2f, 40.4f, 100.6f, 200.8f); renderer.SetClip_PathFill(path, /*matrix=*/nullptr, CFX_FillRenderOptions::WindingOptions()); - EXPECT_EQ(renderer.GetClipBox(), FX_RECT(20, 40, 101, 201)); + // TODO(crbug.com/553140224): Clip box should be FX_RECT(20, 40, 101, 201). + EXPECT_EQ(renderer.GetClipBox(), FX_RECT(20, 241, 120, 40)); CFX_Path path2; path2.AppendRect(50.1f, 80.3f, 150.7f, 250.9f); renderer.SetClip_PathFill(path2, /*matrix=*/nullptr, CFX_FillRenderOptions::WindingOptions()); - EXPECT_EQ(renderer.GetClipBox(), FX_RECT(50, 80, 101, 201)); + // TODO(crbug.com/553140224): Clip box should be FX_RECT(50, 80, 101, 201). + EXPECT_EQ(renderer.GetClipBox(), FX_RECT(50, 331, 200, 80)); }
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp index 0e875a8..ddb0032 100644 --- a/fpdfsdk/fpdf_view_embeddertest.cpp +++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -1796,6 +1796,10 @@ "!fAD!!fAD!!fAD!!fAD!!fAD!!fAD!&-(;~>\n" "Q\n" "Q\n" + "q\n" + "q\n" + "Q\n" + "Q\n" "Q\n" "Q\n" "\n" @@ -1833,6 +1837,10 @@ Gb"0;0`_7S!5bE%:[N')TE"rlzGQSs[!!*~> Q Q +q +q +Q +Q Q Q