OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
10 #include "SkRSXform.h" | 10 #include "SkRSXform.h" |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 rotation2->fX = cos2; | 1837 rotation2->fX = cos2; |
1838 rotation2->fY = sin2; | 1838 rotation2->fY = sin2; |
1839 } | 1839 } |
1840 | 1840 |
1841 return true; | 1841 return true; |
1842 } | 1842 } |
1843 | 1843 |
1844 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 1844 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
1845 | 1845 |
1846 void SkRSXform::toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const { | 1846 void SkRSXform::toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const { |
| 1847 #if 0 |
| 1848 // This is the slow way, but it documents what we're doing |
1847 quad[0].set(0, 0); | 1849 quad[0].set(0, 0); |
1848 quad[1].set(width, 0); | 1850 quad[1].set(width, 0); |
1849 quad[2].set(width, height); | 1851 quad[2].set(width, height); |
1850 quad[3].set(0, height); | 1852 quad[3].set(0, height); |
1851 SkMatrix m; | 1853 SkMatrix m; |
1852 m.setRSXform(*this).mapPoints(quad, quad, 4); | 1854 m.setRSXform(*this).mapPoints(quad, quad, 4); |
| 1855 #else |
| 1856 const SkScalar m00 = fSCos; |
| 1857 const SkScalar m01 = -fSSin; |
| 1858 const SkScalar m02 = fTx; |
| 1859 const SkScalar m10 = -m01; |
| 1860 const SkScalar m11 = m00; |
| 1861 const SkScalar m12 = fTy; |
| 1862 |
| 1863 quad[0].set(m02, m12); |
| 1864 quad[1].set(m00 * width + m02, m10 * width + m12); |
| 1865 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); |
| 1866 quad[3].set(m01 * height + m02, m11 * height + m12); |
| 1867 #endif |
1853 } | 1868 } |
1854 | 1869 |
OLD | NEW |