Skip to content

Commit

Permalink
Add Matrix::set/pre/postConcat() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Jul 26, 2023
1 parent 5fcfcf3 commit 565ee01
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 6 additions & 1 deletion gfx/matrix_none.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// LAF Gfx Library
// Copyright (c) 2020 Igara Studio S.A.
// Copyright (c) 2020-2023 Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
Expand Down Expand Up @@ -46,6 +46,11 @@ namespace gfx {
void setScaleTranslate(float sx, float sy, float tx, float ty) { }
Matrix& preTranslate(float dx, float dy) { return *this; }
Matrix& postTranslate(float dx, float dy) { return *this; }

Matrix& setConcat(const Matrix& a, const Matrix& b) { return *this; }
Matrix& preConcat(const Matrix& other) { return *this; }
Matrix& postConcat(const Matrix& other) { return *this; }

RectF mapRect(const RectF& src) const { return RectF(); }
};

Expand Down
17 changes: 16 additions & 1 deletion gfx/matrix_skia.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// LAF Gfx Library
// Copyright (c) 2020 Igara Studio S.A.
// Copyright (c) 2020-2023 Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
Expand Down Expand Up @@ -99,6 +99,21 @@ namespace gfx {
return *this;
}

Matrix& setConcat(const Matrix& a, const Matrix& b) {
m_skMatrix.setConcat(a.m_skMatrix, b.m_skMatrix);
return *this;
}

Matrix& preConcat(const Matrix& other) {
m_skMatrix.preConcat(other.m_skMatrix);
return *this;
}

Matrix& postConcat(const Matrix& other) {
m_skMatrix.postConcat(other.m_skMatrix);
return *this;
}

RectF mapRect(const RectF& src) const {
SkRect dst;
m_skMatrix.mapRect(&dst, SkRect::MakeXYWH(SkScalar(src.x), SkScalar(src.y),
Expand Down

0 comments on commit 565ee01

Please sign in to comment.