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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatQuad.cpp

Issue 2733503002: Fix the conditional operator's usage (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2013 Xidorn Quan (quanxunzhen@gmail.com) 4 * Copyright (C) 2013 Xidorn Quan (quanxunzhen@gmail.com)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01); 74 float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01);
75 float u = (dot11 * dot02 - dot01 * dot12) * invDenom; 75 float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
76 float v = (dot00 * dot12 - dot01 * dot02) * invDenom; 76 float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
77 77
78 // Check if point is in triangle 78 // Check if point is in triangle
79 return (u >= 0) && (v >= 0) && (u + v <= 1); 79 return (u >= 0) && (v >= 0) && (u + v <= 1);
80 } 80 }
81 81
82 static inline float saturateInf(float value) { 82 static inline float saturateInf(float value) {
83 if (UNLIKELY(std::isinf(value))) { 83 if (UNLIKELY(std::isinf(value))) {
84 return std::signbit(value) ? std::numeric_limits<int>::min() 84 return std::numeric_limits<int>::min();
85 : std::numeric_limits<int>::min();
Avi (use Gerrit) 2017/03/03 02:03:44 It seems likely that they meant return std::signb
86 } 85 }
87 return value; 86 return value;
88 } 87 }
89 88
90 FloatRect FloatQuad::boundingBox() const { 89 FloatRect FloatQuad::boundingBox() const {
91 float left = saturateInf(min4(m_p1.x(), m_p2.x(), m_p3.x(), m_p4.x())); 90 float left = saturateInf(min4(m_p1.x(), m_p2.x(), m_p3.x(), m_p4.x()));
92 float top = saturateInf(min4(m_p1.y(), m_p2.y(), m_p3.y(), m_p4.y())); 91 float top = saturateInf(min4(m_p1.y(), m_p2.y(), m_p3.y(), m_p4.y()));
93 92
94 float right = saturateInf(max4(m_p1.x(), m_p2.x(), m_p3.x(), m_p4.x())); 93 float right = saturateInf(max4(m_p1.x(), m_p2.x(), m_p3.x(), m_p4.x()));
95 float bottom = saturateInf(max4(m_p1.y(), m_p2.y(), m_p3.y(), m_p4.y())); 94 float bottom = saturateInf(max4(m_p1.y(), m_p2.y(), m_p3.y(), m_p4.y()));
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 252 }
254 253
255 String FloatQuad::toString() const { 254 String FloatQuad::toString() const {
256 return String::format("%s; %s; %s; %s", m_p1.toString().ascii().data(), 255 return String::format("%s; %s; %s; %s", m_p1.toString().ascii().data(),
257 m_p2.toString().ascii().data(), 256 m_p2.toString().ascii().data(),
258 m_p3.toString().ascii().data(), 257 m_p3.toString().ascii().data(),
259 m_p4.toString().ascii().data()); 258 m_p4.toString().ascii().data());
260 } 259 }
261 260
262 } // namespace blink 261 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698