Chromium Code Reviews| Index: include/core/SkRSXform.h |
| diff --git a/include/core/SkRSXform.h b/include/core/SkRSXform.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c71b18e80be9327c028375df8555fb78f7757e1e |
| --- /dev/null |
| +++ b/include/core/SkRSXform.h |
| @@ -0,0 +1,42 @@ |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef SkRSXform_DEFINED |
| +#define SkRSXform_DEFINED |
| + |
| +#include "SkScalar.h" |
| + |
|
robertphillips
2015/06/24 15:11:02
// A compressed transformation representation. It
reed1
2015/06/24 16:17:48
Done.
|
| +struct SkRSXform { |
| + SkScalar fSCos; |
| + SkScalar fSSin; |
| + SkScalar fTx; |
| + SkScalar fTy; |
| + |
| + bool rectStaysRect() const { |
| + return 0 == fSCos || 0 == fSSin; |
| + } |
| + |
| + void setIdentity() { |
| + fSCos = 1; |
| + fSSin = fTx = fTy = 0; |
| + } |
| + |
| + void set(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty) { |
| + fSCos = scos; |
| + fSSin = ssin; |
| + fTx = tx; |
| + fTy = ty; |
| + } |
| + |
| + void toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const; |
| + void toQuad(const SkSize& size, SkPoint quad[4]) const { |
| + this->toQuad(size.width(), size.height(), quad); |
| + } |
| +}; |
| + |
| +#endif |
| + |