diff options
author | Nicolas Pena <npm@chromium.org> | 2017-06-29 12:02:06 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-29 20:50:09 +0000 |
commit | b21f174ad87e46c823c2ef8c11682167e2d12864 (patch) | |
tree | 79c3661672cbd2f84ee835f9922231bb90a634b3 /core/fpdfapi | |
parent | 8ce58f522e046ae3b1561d592ca7b3cd7c894731 (diff) | |
download | pdfium-b21f174ad87e46c823c2ef8c11682167e2d12864.tar.xz |
Change SetReverse to GetInverse in CFX_Matrix
CFX_Matrix::GetInverse is much clearer.
Change-Id: Id10ab1723735332e1a78de853f28415ec3a4d834
Reviewed-on: https://pdfium-review.googlesource.com/7090
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_progressiverenderer.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 23 |
3 files changed, 9 insertions, 25 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 10b3933742..369c2a81ff 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -68,11 +68,8 @@ void CPDF_PageContentGenerator::GenerateContent() { // Set the default graphic state values buf << "q\n"; - if (!m_pObjHolder->GetLastCTM().IsIdentity()) { - CFX_Matrix reverse; - reverse.SetReverse(m_pObjHolder->GetLastCTM()); - buf << reverse << " cm\n"; - } + if (!m_pObjHolder->GetLastCTM().IsIdentity()) + buf << m_pObjHolder->GetLastCTM().GetInverse() << " cm\n"; ProcessDefaultGraphics(&buf); // Process the page objects diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.cpp b/core/fpdfapi/render/cpdf_progressiverenderer.cpp index 984ad75834..4ddc528342 100644 --- a/core/fpdfapi/render/cpdf_progressiverenderer.cpp +++ b/core/fpdfapi/render/cpdf_progressiverenderer.cpp @@ -60,9 +60,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { nullptr); m_pDevice->SaveState(); m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); - CFX_Matrix device2object; - device2object.SetReverse(m_pCurrentLayer->m_Matrix); - device2object.TransformRect(m_ClipRect); + m_pCurrentLayer->m_Matrix.GetInverse().TransformRect(m_ClipRect); } CPDF_PageObjectList::iterator iter; CPDF_PageObjectList::iterator iterEnd = diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index beeca3febe..a3b1bb8567 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -133,8 +133,6 @@ void DrawAxialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, float x_span = end_x - start_x; float y_span = end_y - start_y; float axis_len_square = (x_span * x_span) + (y_span * y_span); - CFX_Matrix matrix; - matrix.SetReverse(*pObject2Bitmap); uint32_t total_results = std::max(CountOutputs(funcs), pCS->CountComponents()); CFX_FixedBufGrow<float, 16> result_array(total_results); @@ -160,6 +158,7 @@ void DrawAxialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, FXSYS_round(G * 255), FXSYS_round(B * 255))); } int pitch = pBitmap->GetPitch(); + CFX_Matrix matrix = pObject2Bitmap->GetInverse(); for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { @@ -202,8 +201,6 @@ void DrawRadialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, float end_x = pCoords->GetNumberAt(3); float end_y = pCoords->GetNumberAt(4); float end_r = pCoords->GetNumberAt(5); - CFX_Matrix matrix; - matrix.SetReverse(*pObject2Bitmap); float t_min = 0; float t_max = 1.0f; CPDF_Array* pArray = pDict->GetArrayFor("Domain"); @@ -256,6 +253,7 @@ void DrawRadialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, bDecreasing = true; } } + CFX_Matrix matrix = pObject2Bitmap->GetInverse(); for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { @@ -334,12 +332,8 @@ void DrawFuncShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, ymax = pDomain->GetNumberAt(3); } CFX_Matrix mtDomain2Target = pDict->GetMatrixFor("Matrix"); - CFX_Matrix matrix; - matrix.SetReverse(*pObject2Bitmap); - - CFX_Matrix reverse_matrix; - reverse_matrix.SetReverse(mtDomain2Target); - matrix.Concat(reverse_matrix); + CFX_Matrix matrix = pObject2Bitmap->GetInverse(); + matrix.Concat(mtDomain2Target.GetInverse()); int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); @@ -1056,9 +1050,7 @@ void CPDF_RenderStatus::RenderObjectList( DebugVerifyDeviceIsPreMultiplied(); #endif CFX_FloatRect clip_rect(m_pDevice->GetClipBox()); - CFX_Matrix device2object; - device2object.SetReverse(*pObj2Device); - device2object.TransformRect(clip_rect); + pObj2Device->GetInverse().TransformRect(clip_rect); for (const auto& pCurObj : *pObjectHolder->GetPageObjectList()) { if (pCurObj.get() == m_pStopObj) { @@ -2243,11 +2235,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, if (height == 0) height = 1; - CFX_Matrix mtDevice2Pattern; - mtDevice2Pattern.SetReverse(mtPattern2Device); - CFX_FloatRect clip_box_p(clip_box); - mtDevice2Pattern.TransformRect(clip_box_p); + mtPattern2Device.GetInverse().TransformRect(clip_box_p); int min_col = (int)ceil((clip_box_p.left - pPattern->bbox().right) / pPattern->x_step()); |