Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkRSXform_DEFINED | |
| 9 #define SkRSXform_DEFINED | |
| 10 | |
| 11 #include "SkScalar.h" | |
| 12 | |
|
robertphillips
2015/06/24 15:11:02
// A compressed transformation representation. It
reed1
2015/06/24 16:17:48
Done.
| |
| 13 struct SkRSXform { | |
| 14 SkScalar fSCos; | |
| 15 SkScalar fSSin; | |
| 16 SkScalar fTx; | |
| 17 SkScalar fTy; | |
| 18 | |
| 19 bool rectStaysRect() const { | |
| 20 return 0 == fSCos || 0 == fSSin; | |
| 21 } | |
| 22 | |
| 23 void setIdentity() { | |
| 24 fSCos = 1; | |
| 25 fSSin = fTx = fTy = 0; | |
| 26 } | |
| 27 | |
| 28 void set(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty) { | |
| 29 fSCos = scos; | |
| 30 fSSin = ssin; | |
| 31 fTx = tx; | |
| 32 fTy = ty; | |
| 33 } | |
| 34 | |
| 35 void toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const; | |
| 36 void toQuad(const SkSize& size, SkPoint quad[4]) const { | |
| 37 this->toQuad(size.width(), size.height(), quad); | |
| 38 } | |
| 39 }; | |
| 40 | |
| 41 #endif | |
| 42 | |
| OLD | NEW |