Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: cc/base/math_util.cc

Issue 1314943008: cc: Remove implicit conversions from Rect to RectF in src/cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rectfconvert-cc: rebase-and-sandwich-strategy Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/layers/delegated_frame_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/base/math_util.h" 5 #include "cc/base/math_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 DCHECK(transform.Preserves2dAxisAlignment()); 195 DCHECK(transform.Preserves2dAxisAlignment());
196 196
197 if (transform.IsIdentityOrIntegerTranslation()) { 197 if (transform.IsIdentityOrIntegerTranslation()) {
198 gfx::Vector2d offset(static_cast<int>(transform.matrix().getFloat(0, 3)), 198 gfx::Vector2d offset(static_cast<int>(transform.matrix().getFloat(0, 3)),
199 static_cast<int>(transform.matrix().getFloat(1, 3))); 199 static_cast<int>(transform.matrix().getFloat(1, 3)));
200 return rect + offset; 200 return rect + offset;
201 } 201 }
202 if (transform.IsIdentityOrTranslation()) { 202 if (transform.IsIdentityOrTranslation()) {
203 gfx::Vector2dF offset(transform.matrix().getFloat(0, 3), 203 gfx::Vector2dF offset(transform.matrix().getFloat(0, 3),
204 transform.matrix().getFloat(1, 3)); 204 transform.matrix().getFloat(1, 3));
205 return gfx::ToEnclosedRect(rect + offset); 205 return gfx::ToEnclosedRect(gfx::RectF(rect) + offset);
206 } 206 }
207 207
208 SkMScalar quad[2 * 2]; // input: 2 x 2D points 208 SkMScalar quad[2 * 2]; // input: 2 x 2D points
209 quad[0] = rect.x(); 209 quad[0] = rect.x();
210 quad[1] = rect.y(); 210 quad[1] = rect.y();
211 quad[2] = rect.right(); 211 quad[2] = rect.right();
212 quad[3] = rect.bottom(); 212 quad[3] = rect.bottom();
213 213
214 SkMScalar result[4 * 2]; // output: 2 x 4D homogeneous points 214 SkMScalar result[4 * 2]; // output: 2 x 4D homogeneous points
215 transform.matrix().map2(quad, 2, result); 215 transform.matrix().map2(quad, 2, result);
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 transform.matrix().getFloat(2, 0)); 875 transform.matrix().getFloat(2, 0));
876 } 876 }
877 877
878 gfx::Vector3dF MathUtil::GetYAxis(const gfx::Transform& transform) { 878 gfx::Vector3dF MathUtil::GetYAxis(const gfx::Transform& transform) {
879 return gfx::Vector3dF(transform.matrix().getFloat(0, 1), 879 return gfx::Vector3dF(transform.matrix().getFloat(0, 1),
880 transform.matrix().getFloat(1, 1), 880 transform.matrix().getFloat(1, 1),
881 transform.matrix().getFloat(2, 1)); 881 transform.matrix().getFloat(2, 1));
882 } 882 }
883 883
884 } // namespace cc 884 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/delegated_frame_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698