Simplify CPDF_RenderContext::Render().
Remove redundant code between an if-branch and its corresponding else
branch.
Change-Id: I322c287141a15f9cffd24330af78d67d491652eb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65271
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp
index e303aab..1280cee 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -66,16 +66,13 @@
status.SetOptions(*pOptions);
status.SetStopObject(pStopObj);
status.SetTransparency(layer.m_pObjectHolder->GetTransparency());
+ CFX_Matrix final_matrix = layer.m_Matrix;
if (pLastMatrix) {
- const CFX_Matrix& last_matrix = *pLastMatrix;
- CFX_Matrix final_matrix = layer.m_Matrix * last_matrix;
- status.SetDeviceMatrix(last_matrix);
- status.Initialize(nullptr, nullptr);
- status.RenderObjectList(layer.m_pObjectHolder.Get(), final_matrix);
- } else {
- status.Initialize(nullptr, nullptr);
- status.RenderObjectList(layer.m_pObjectHolder.Get(), layer.m_Matrix);
+ final_matrix *= *pLastMatrix;
+ status.SetDeviceMatrix(*pLastMatrix);
}
+ status.Initialize(nullptr, nullptr);
+ status.RenderObjectList(layer.m_pObjectHolder.Get(), final_matrix);
if (status.GetRenderOptions().GetOptions().bLimitedImageCache) {
m_pPageCache->CacheOptimization(
status.GetRenderOptions().GetCacheSizeLimit());
@@ -85,8 +82,8 @@
}
}
-CPDF_RenderContext::Layer::Layer() {}
+CPDF_RenderContext::Layer::Layer() = default;
CPDF_RenderContext::Layer::Layer(const Layer& that) = default;
-CPDF_RenderContext::Layer::~Layer() {}
+CPDF_RenderContext::Layer::~Layer() = default;