Try out SkMatrix::Concat.
This should RVO to the same as doing it on the stack with setConcat. BUG=skia: R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/293693002 git-svn-id: http://skia.googlecode.com/svn/trunk@14782 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
7b1715215a
commit
99bd7d8174
@ -589,6 +589,15 @@ public:
|
||||
*/
|
||||
static const SkMatrix& InvalidMatrix();
|
||||
|
||||
/**
|
||||
* Return the concatenation of two matrices, a * b.
|
||||
*/
|
||||
static SkMatrix Concat(const SkMatrix& a, const SkMatrix& b) {
|
||||
SkMatrix result;
|
||||
result.setConcat(a, b);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing routine; the matrix's type cache should never need to be
|
||||
* manually invalidated during normal use.
|
||||
|
@ -38,13 +38,7 @@ DRAW(PopCull, popCull());
|
||||
DRAW(PushCull, pushCull(r.rect));
|
||||
DRAW(Clear, clear(r.color));
|
||||
DRAW(Concat, concat(r.matrix));
|
||||
|
||||
// We can't clobber the canvas' initial CTM when calling setMatrix.
|
||||
template <> void Draw::draw(const SetMatrix& r) {
|
||||
SkMatrix ctm;
|
||||
ctm.setConcat(fInitialCTM, r.matrix);
|
||||
fCanvas->setMatrix(ctm);
|
||||
}
|
||||
DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix)));
|
||||
|
||||
DRAW(ClipPath, clipPath(r.path, r.op, r.doAA));
|
||||
DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA));
|
||||
|
@ -785,3 +785,16 @@ DEF_TEST(Matrix, reporter) {
|
||||
test_matrix_decomposition(reporter);
|
||||
test_matrix_homogeneous(reporter);
|
||||
}
|
||||
|
||||
DEF_TEST(Matrix_Concat, r) {
|
||||
SkMatrix a;
|
||||
a.setTranslate(10, 20);
|
||||
|
||||
SkMatrix b;
|
||||
b.setScale(3, 5);
|
||||
|
||||
SkMatrix expected;
|
||||
expected.setConcat(a,b);
|
||||
|
||||
REPORTER_ASSERT(r, expected == SkMatrix::Concat(a, b));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user