Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * 2010 Dirk Schulze <krit@webkit.org> | 3 * 2010 Dirk Schulze <krit@webkit.org> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 AffineTransform result = *this; | 149 AffineTransform result = *this; |
| 150 result *= t; | 150 result *= t; |
| 151 return result; | 151 return result; |
| 152 } | 152 } |
| 153 | 153 |
| 154 static AffineTransform translation(double x, double y) | 154 static AffineTransform translation(double x, double y) |
| 155 { | 155 { |
| 156 return AffineTransform(1, 0, 0, 1, x, y); | 156 return AffineTransform(1, 0, 0, 1, x, y); |
| 157 } | 157 } |
| 158 | 158 |
| 159 AffineTransform& operator =(const AffineTransform &t) | |
|
fs
2014/11/10 11:36:43
Hmm, why was this needed? Worrying about self-assi
| |
| 160 { | |
| 161 setMatrix(t.m_transform); | |
| 162 return *this; | |
| 163 } | |
| 164 | |
| 159 // decompose the matrix into its component parts | 165 // decompose the matrix into its component parts |
| 160 typedef struct { | 166 typedef struct { |
| 161 double scaleX, scaleY; | 167 double scaleX, scaleY; |
| 162 double angle; | 168 double angle; |
| 163 double remainderA, remainderB, remainderC, remainderD; | 169 double remainderA, remainderB, remainderC, remainderD; |
| 164 double translateX, translateY; | 170 double translateX, translateY; |
| 165 } DecomposedType; | 171 } DecomposedType; |
| 166 | 172 |
| 167 bool decompose(DecomposedType&) const; | 173 bool decompose(DecomposedType&) const; |
| 168 void recompose(const DecomposedType&); | 174 void recompose(const DecomposedType&); |
| 169 | 175 |
| 170 private: | 176 private: |
| 171 void setMatrix(const Transform m) | 177 void setMatrix(const Transform m) |
| 172 { | 178 { |
| 173 if (m && m != m_transform) | 179 if (m && m != m_transform) |
| 174 memcpy(m_transform, m, sizeof(Transform)); | 180 memcpy(m_transform, m, sizeof(Transform)); |
| 175 } | 181 } |
| 176 | 182 |
| 177 Transform m_transform; | 183 Transform m_transform; |
| 178 }; | 184 }; |
| 179 | 185 |
| 180 } | 186 } |
| 181 | 187 |
| 182 #endif | 188 #endif |
| OLD | NEW |