From bba2a7cf30da9e84bcc14ef32dbb0bb944229219 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Feb 2017 16:36:39 -0500 Subject: Update to use CFX_Rect{F} and CFX_Matrix constructors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez --- core/fpdfapi/page/cpdf_page.cpp | 17 +++-- core/fpdfapi/page/cpdf_streamcontentparser.cpp | 7 +- core/fpdfapi/page/cpdf_textobject.cpp | 8 ++- core/fpdfapi/parser/cpdf_array.cpp | 7 +- core/fpdfapi/render/cpdf_renderstatus.cpp | 18 +++-- core/fpdfapi/render/cpdf_type3cache.cpp | 6 +- core/fpdfdoc/cpdf_defaultappearance.cpp | 17 +++-- core/fpdftext/cpdf_textpage.cpp | 11 ++- core/fxcrt/fx_basic_coords.cpp | 48 ++++--------- core/fxcrt/fx_coordinates.h | 95 +++++++++++--------------- core/fxge/agg/fx_agg_driver.cpp | 8 ++- core/fxge/apple/fx_apple_platform.cpp | 2 +- core/fxge/ge/cfx_renderdevice.cpp | 5 +- core/fxge/skia/fx_skia_device_unittest.cpp | 4 +- core/fxge/win32/cfx_psrenderer.cpp | 9 ++- 15 files changed, 124 insertions(+), 138 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp index f9c02837a7..7714369df8 100644 --- a/core/fpdfapi/page/cpdf_page.cpp +++ b/core/fpdfapi/page/cpdf_page.cpp @@ -66,16 +66,17 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument, switch (rotate) { case 0: - m_PageMatrix.Set(1.0f, 0, 0, 1.0f, -m_BBox.left, -m_BBox.bottom); + m_PageMatrix = CFX_Matrix(1.0f, 0, 0, 1.0f, -m_BBox.left, -m_BBox.bottom); break; case 1: - m_PageMatrix.Set(0, -1.0f, 1.0f, 0, -m_BBox.bottom, m_BBox.right); + m_PageMatrix = + CFX_Matrix(0, -1.0f, 1.0f, 0, -m_BBox.bottom, m_BBox.right); break; case 2: - m_PageMatrix.Set(-1.0f, 0, 0, -1.0f, m_BBox.right, m_BBox.top); + m_PageMatrix = CFX_Matrix(-1.0f, 0, 0, -1.0f, m_BBox.right, m_BBox.top); break; case 3: - m_PageMatrix.Set(0, 1.0f, -1.0f, 0, m_BBox.top, -m_BBox.left); + m_PageMatrix = CFX_Matrix(0, 1.0f, -1.0f, 0, m_BBox.top, -m_BBox.left); break; } @@ -128,7 +129,6 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix, if (m_PageWidth == 0 || m_PageHeight == 0) { return; } - CFX_Matrix display_matrix; float x0 = 0; float y0 = 0; float x1 = 0; @@ -170,9 +170,8 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix, y2 = yPos; break; } - display_matrix.Set((x2 - x0) / m_PageWidth, (y2 - y0) / m_PageWidth, - (x1 - x0) / m_PageHeight, (y1 - y0) / m_PageHeight, x0, - y0); matrix = m_PageMatrix; - matrix.Concat(display_matrix); + matrix.Concat(CFX_Matrix((x2 - x0) / m_PageWidth, (y2 - y0) / m_PageWidth, + (x1 - x0) / m_PageHeight, (y1 - y0) / m_PageHeight, + x0, y0)); } diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 3dec01a52e..28f3594f47 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -673,7 +673,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent() { } void CPDF_StreamContentParser::Handle_BeginText() { - m_pCurStates->m_TextMatrix.Set(1.0f, 0, 0, 1.0f, 0, 0); + m_pCurStates->m_TextMatrix = CFX_Matrix(); OnChangeTextMatrix(); m_pCurStates->m_TextX = 0; m_pCurStates->m_TextY = 0; @@ -1365,8 +1365,9 @@ void CPDF_StreamContentParser::Handle_SetTextLeading() { } void CPDF_StreamContentParser::Handle_SetTextMatrix() { - m_pCurStates->m_TextMatrix.Set(GetNumber(5), GetNumber(4), GetNumber(3), - GetNumber(2), GetNumber(1), GetNumber(0)); + m_pCurStates->m_TextMatrix = + CFX_Matrix(GetNumber(5), GetNumber(4), GetNumber(3), GetNumber(2), + GetNumber(1), GetNumber(0)); OnChangeTextMatrix(); m_pCurStates->m_TextX = 0; m_pCurStates->m_TextY = 0; diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp index 0979fcfb33..fb81a40d0c 100644 --- a/core/fpdfapi/page/cpdf_textobject.cpp +++ b/core/fpdfapi/page/cpdf_textobject.cpp @@ -162,8 +162,12 @@ const CPDF_TextObject* CPDF_TextObject::AsText() const { void CPDF_TextObject::GetTextMatrix(CFX_Matrix* pMatrix) const { const FX_FLOAT* pTextMatrix = m_TextState.GetMatrix(); - pMatrix->Set(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1], pTextMatrix[3], - m_PosX, m_PosY); + pMatrix->a = pTextMatrix[0]; + pMatrix->b = pTextMatrix[2]; + pMatrix->c = pTextMatrix[1]; + pMatrix->d = pTextMatrix[3]; + pMatrix->e = m_PosX; + pMatrix->f = m_PosY; } void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp index 64010e19e8..05a93702f1 100644 --- a/core/fpdfapi/parser/cpdf_array.cpp +++ b/core/fpdfapi/parser/cpdf_array.cpp @@ -78,11 +78,10 @@ CFX_FloatRect CPDF_Array::GetRect() { CFX_Matrix CPDF_Array::GetMatrix() { CFX_Matrix matrix; if (!IsArray() || m_Objects.size() != 6) - return matrix; + return CFX_Matrix(); - matrix.Set(GetNumberAt(0), GetNumberAt(1), GetNumberAt(2), GetNumberAt(3), - GetNumberAt(4), GetNumberAt(5)); - return matrix; + return CFX_Matrix(GetNumberAt(0), GetNumberAt(1), GetNumberAt(2), + GetNumberAt(3), GetNumberAt(4), GetNumberAt(5)); } CPDF_Object* CPDF_Array::GetObjectAt(size_t i) const { diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 8fe7a31ce4..861aec4eea 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -327,8 +327,10 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, ymax = pDomain->GetNumberAt(3); } CFX_Matrix mtDomain2Target = pDict->GetMatrixFor("Matrix"); - CFX_Matrix matrix, reverse_matrix; + CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); + + CFX_Matrix reverse_matrix; reverse_matrix.SetReverse(mtDomain2Target); matrix.Concat(reverse_matrix); int width = pBitmap->GetWidth(); @@ -891,6 +893,7 @@ std::unique_ptr DrawPatternBitmap( CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); CFX_Matrix mtAdjust; mtAdjust.MatchRect(bitmap_rect, cell_bbox); + CFX_Matrix mtPattern2Bitmap = *pObject2Device; mtPattern2Bitmap.Concat(mtAdjust); CPDF_RenderOptions options; @@ -1987,16 +1990,19 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, : pFont->m_FontFallbacks[charpos.m_FallbackFontPosition].get(); const CFX_PathData* pPath = font->LoadGlyphPath(charpos.m_GlyphIndex, charpos.m_FontCharWidth); - if (!pPath) { + if (!pPath) continue; - } + CPDF_PathObject path; path.m_GraphState = textobj->m_GraphState; path.m_ColorState = textobj->m_ColorState; + CFX_Matrix matrix; - if (charpos.m_bGlyphAdjust) - matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], - charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + if (charpos.m_bGlyphAdjust) { + matrix = CFX_Matrix(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], + charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], + 0, 0); + } matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, charpos.m_OriginY); path.m_Path.Append(pPath, &matrix); diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index b27fdf507e..63cc780d1d 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -122,10 +122,10 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, return nullptr; CFX_DIBitmap* pBitmap = pChar->m_pBitmap.get(); - CFX_Matrix image_matrix, text_matrix; - image_matrix = pChar->m_ImageMatrix; - text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); + CFX_Matrix image_matrix = pChar->m_ImageMatrix; + CFX_Matrix text_matrix(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0); image_matrix.Concat(text_matrix); + std::unique_ptr pResBitmap; int left = 0; int top = 0; diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp index daf93414bf..19767650f3 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.cpp +++ b/core/fpdfdoc/cpdf_defaultappearance.cpp @@ -209,16 +209,15 @@ CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() { } CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() { - CFX_Matrix tm; if (m_csDA.IsEmpty()) - return tm; + return CFX_Matrix(); CPDF_SimpleParser syntax(m_csDA.AsStringC()); - if (syntax.FindTagParamFromStart("Tm", 6)) { - FX_FLOAT f[6]; - for (int i = 0; i < 6; i++) - f[i] = FX_atof(syntax.GetWord()); - tm.Set(f[0], f[1], f[2], f[3], f[4], f[5]); - } - return tm; + if (!syntax.FindTagParamFromStart("Tm", 6)) + return CFX_Matrix(); + + FX_FLOAT f[6]; + for (int i = 0; i < 6; i++) + f[i] = FX_atof(syntax.GetWord()); + return CFX_Matrix(f); } diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 9cde4f5026..a919aa51ec 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -239,9 +239,11 @@ std::vector CPDF_TextPage::GetRectArray(int start, } if (bFlagNewRect) { FX_FLOAT orgX = info_curchar.m_OriginX, orgY = info_curchar.m_OriginY; - CFX_Matrix matrix, matrix_reverse; + CFX_Matrix matrix; info_curchar.m_pTextObj->GetTextMatrix(&matrix); matrix.Concat(info_curchar.m_Matrix); + + CFX_Matrix matrix_reverse; matrix_reverse.SetReverse(matrix); matrix_reverse.Transform(orgX, orgY); rect.left = info_curchar.m_CharBox.left; @@ -766,6 +768,7 @@ void CPDF_TextPage::ProcessTextObject( FX_FLOAT this_width = GetCharWidth(item.m_CharCode, pTextObj->GetFont()) * pTextObj->GetFontSize() / 1000; this_width = FXSYS_fabs(this_width); + CFX_Matrix this_matrix; pTextObj->GetTextMatrix(&this_matrix); this_width = FXSYS_fabs(this_width); @@ -1218,6 +1221,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode( CPDF_TextObjectItem first, last; pTextObj->GetCharInfo(0, &first); pTextObj->GetCharInfo(nChars - 1, &last); + CFX_Matrix textMatrix; pTextObj->GetTextMatrix(&textMatrix); textMatrix.TransformPoint(first.m_OriginX, first.m_OriginY); @@ -1327,9 +1331,12 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( this_width = FXSYS_fabs(this_width); FX_FLOAT threshold = last_width > this_width ? last_width / 4 : this_width / 4; - CFX_Matrix prev_matrix, prev_reverse; + + CFX_Matrix prev_matrix; m_pPreTextObj->GetTextMatrix(&prev_matrix); prev_matrix.Concat(m_perMatrix); + + CFX_Matrix prev_reverse; prev_reverse.SetReverse(prev_matrix); FX_FLOAT x = pObj->GetPosX(); FX_FLOAT y = pObj->GetPosY(); diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index d2bcc2b3ed..62cc4f5890 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -239,27 +239,7 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) { } return CFX_FloatRect(min_x, min_y, max_x, max_y); } -void CFX_Matrix::Set(FX_FLOAT other_a, - FX_FLOAT other_b, - FX_FLOAT other_c, - FX_FLOAT other_d, - FX_FLOAT other_e, - FX_FLOAT other_f) { - a = other_a; - b = other_b; - c = other_c; - d = other_d; - e = other_e; - f = other_f; -} -void CFX_Matrix::Set(const FX_FLOAT n[6]) { - a = n[0]; - b = n[1]; - c = n[2]; - d = n[3]; - e = n[4]; - f = n[5]; -} + void CFX_Matrix::SetReverse(const CFX_Matrix& m) { FX_FLOAT i = m.a * m.d - m.b * m.c; if (FXSYS_fabs(i) == 0) { @@ -284,6 +264,7 @@ static void FXCRT_Matrix_Concat(CFX_Matrix& m, FX_FLOAT ff = m1.e * m2.b + m1.f * m2.d + m2.f; m.a = aa, m.b = bb, m.c = cc, m.d = dd, m.e = ee, m.f = ff; } + void CFX_Matrix::Concat(FX_FLOAT a_in, FX_FLOAT b_in, FX_FLOAT c_in, @@ -291,10 +272,9 @@ void CFX_Matrix::Concat(FX_FLOAT a_in, FX_FLOAT e_in, FX_FLOAT f_in, bool bPrepended) { - CFX_Matrix m; - m.Set(a_in, b_in, c_in, d_in, e_in, f_in); - Concat(m, bPrepended); + Concat(CFX_Matrix(a_in, b_in, c_in, d_in, e_in, f_in), bPrepended); } + void CFX_Matrix::Concat(const CFX_Matrix& m, bool bPrepended) { if (bPrepended) { FXCRT_Matrix_Concat(*this, m, *this); @@ -338,17 +318,17 @@ void CFX_Matrix::Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended) { f *= sy; } } + void CFX_Matrix::Rotate(FX_FLOAT fRadian, bool bPrepended) { FX_FLOAT cosValue = FXSYS_cos(fRadian); FX_FLOAT sinValue = FXSYS_sin(fRadian); - CFX_Matrix m; - m.Set(cosValue, sinValue, -sinValue, cosValue, 0, 0); - if (bPrepended) { + CFX_Matrix m(cosValue, sinValue, -sinValue, cosValue, 0, 0); + if (bPrepended) FXCRT_Matrix_Concat(*this, m, *this); - } else { + else FXCRT_Matrix_Concat(*this, *this, m); - } } + void CFX_Matrix::RotateAt(FX_FLOAT fRadian, FX_FLOAT dx, FX_FLOAT dy, @@ -357,17 +337,17 @@ void CFX_Matrix::RotateAt(FX_FLOAT fRadian, Rotate(fRadian, bPrepended); Translate(-dx, -dy, bPrepended); } + void CFX_Matrix::Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadian, bool bPrepended) { - CFX_Matrix m; - m.Set(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0); - if (bPrepended) { + CFX_Matrix m(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0); + if (bPrepended) FXCRT_Matrix_Concat(*this, m, *this); - } else { + else FXCRT_Matrix_Concat(*this, *this, m); - } } + void CFX_Matrix::MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src) { FX_FLOAT fDiff = src.left - src.right; diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index f00675842d..359bf46884 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -270,48 +270,22 @@ class CFX_RTemplate { : left(p.x), top(p.y), width(dst_width), height(dst_height) {} CFX_RTemplate(const PointType& p1, const SizeType& s2) : left(p1.x), top(p1.y), width(s2.x), height(s2.y) {} - - void Set(BaseType dst_left, - BaseType dst_top, - BaseType dst_width, - BaseType dst_height) { - left = dst_left; - top = dst_top; - width = dst_width; - height = dst_height; - } - void Set(BaseType dst_left, BaseType dst_top, const SizeType& dst_size) { - left = dst_left; - top = dst_top; - width = dst_size.x; - height = dst_size.y; - } - void Set(const PointType& p, BaseType dst_width, BaseType dst_height) { - left = p.x; - top = p.y; - width = dst_width; - height = dst_height; - } - void Set(const PointType& p, const SizeType& s) { - left = p.x; - top = p.y; - width = s.x; - height = s.y; - } - void Set(const PointType& p1, const PointType& p2) { - left = p1.x; - top = p1.y; - width = p2.x - p1.x; - height = p2.y - p1.y; + CFX_RTemplate(const PointType& p1, const PointType& p2) + : left(p1.x), top(p1.y), width(p2.x - p1.x), height(p2.y - p1.y) { Normalize(); } - void Set(const PointType& p, const VectorType& v) { - left = p.x; - top = p.y; - width = v.x; - height = v.y; + CFX_RTemplate(const PointType& p, const VectorType& v) + : left(p.x), top(p.y), width(v.x), height(v.y) { Normalize(); } + + // NOLINTNEXTLINE(runtime/explicit) + CFX_RTemplate(const RectType& other) + : left(other.left), + top(other.top), + width(other.width), + height(other.height) {} + void Reset() { left = 0; top = 0; @@ -595,31 +569,40 @@ class CFX_Matrix { public: CFX_Matrix() { SetIdentity(); } + explicit CFX_Matrix(const FX_FLOAT n[6]) + : a(n[0]), b(n[1]), c(n[2]), d(n[3]), e(n[4]), f(n[5]) {} + + CFX_Matrix(const CFX_Matrix& other) + : a(other.a), + b(other.b), + c(other.c), + d(other.d), + e(other.e), + f(other.f) {} CFX_Matrix(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1, FX_FLOAT d1, FX_FLOAT e1, - FX_FLOAT f1) { - a = a1; - b = b1; - c = c1; - d = d1; - e = e1; - f = f1; - } - - void Set(FX_FLOAT a, - FX_FLOAT b, - FX_FLOAT c, - FX_FLOAT d, - FX_FLOAT e, - FX_FLOAT f); - void Set(const FX_FLOAT n[6]); + FX_FLOAT f1) + : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1) {} + + void operator=(const CFX_Matrix& other) { + a = other.a; + b = other.b; + c = other.c; + d = other.d; + e = other.e; + f = other.f; + } void SetIdentity() { - a = d = 1; - b = c = e = f = 0; + a = 1; + b = 0; + c = 0; + d = 1; + e = 0; + f = 0; } void SetReverse(const CFX_Matrix& m); diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index fa361547a9..71d6dbaf86 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1501,14 +1501,16 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, matrix1.a = std::max(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject2Device->b)); matrix1.d = matrix1.a; - matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a, - pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d, 0, - 0); + matrix2 = CFX_Matrix( + pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a, + pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d, 0, 0); + CFX_Matrix mtRervese; mtRervese.SetReverse(matrix2); matrix1 = *pObject2Device; matrix1.Concat(mtRervese); } + CAgg_PathData path_data; path_data.BuildPath(pPathData, &matrix1); agg::rasterizer_scanline_aa rasterizer; diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index 7fc12fd362..6d7fb2e06a 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -35,12 +35,12 @@ bool CGDrawGlyphRun(CGContextRef pContext, if (nChars == 0) return true; - CFX_Matrix new_matrix; bool bNegSize = font_size < 0; if (bNegSize) font_size = -font_size; FX_FLOAT ori_x = pCharPos[0].m_OriginX, ori_y = pCharPos[0].m_OriginY; + CFX_Matrix new_matrix; new_matrix.Transform(ori_x, ori_y); if (pObject2Device) new_matrix.Concat(*pObject2Device); diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 4353e0a414..2f3d1bb60e 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -1060,8 +1060,9 @@ bool CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS& charpos = pCharPos[iChar]; CFX_Matrix matrix; if (charpos.m_bGlyphAdjust) { - matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], - charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + matrix = CFX_Matrix(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], + charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], + 0, 0); } matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, charpos.m_OriginY); diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp index c77c8f88e6..693cf1b616 100644 --- a/core/fxge/skia/fx_skia_device_unittest.cpp +++ b/core/fxge/skia/fx_skia_device_unittest.cpp @@ -46,7 +46,9 @@ void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) { driver->SaveState(); CFX_PathData path1; path1.AppendRect(0, 0, 1, 2); - CFX_Matrix matrix, matrix2; + + CFX_Matrix matrix; + CFX_Matrix matrix2; matrix2.Translate(1, 0); CFX_GraphStateData graphState; if (state.m_save == State::Save::kYes) diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index c01c4c0060..9970e21254 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -581,10 +581,13 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, pPSFont->m_Glyphs[glyphindex].m_AdjustMatrix[3] = charpos.m_AdjustMatrix[3]; } pPSFont->m_nGlyphs++; + CFX_Matrix matrix; - if (charpos.m_bGlyphAdjust) - matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], - charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + if (charpos.m_bGlyphAdjust) { + matrix = + CFX_Matrix(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], + charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + } matrix.Concat(1.0f, 0, 0, 1.0f, 0, 0); const CFX_PathData* pPathData = pFaceCache->LoadGlyphPath( pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth); -- cgit v1.2.3