| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ |
| 9 | 9 |
| 10 #include "core/include/fxcrt/fx_basic.h" | 10 #include "core/include/fxcrt/fx_basic.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 FX_BOOL Contains(int x, int y) const { | 178 FX_BOOL Contains(int x, int y) const { |
| 179 return x >= left && x < right && y >= top && y < bottom; | 179 return x >= left && x < right && y >= top && y < bottom; |
| 180 } | 180 } |
| 181 | 181 |
| 182 FX_SMALL_RECT ToSmallRect() const { | 182 FX_SMALL_RECT ToSmallRect() const { |
| 183 return FX_SMALL_RECT( | 183 return FX_SMALL_RECT( |
| 184 static_cast<uint16_t>(left), static_cast<uint16_t>(top), | 184 static_cast<uint16_t>(left), static_cast<uint16_t>(top), |
| 185 static_cast<uint16_t>(right), static_cast<uint16_t>(bottom)); | 185 static_cast<uint16_t>(right), static_cast<uint16_t>(bottom)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 int left; | 188 int32_t left; |
| 189 int top; | 189 int32_t top; |
| 190 int right; | 190 int32_t right; |
| 191 int bottom; | 191 int32_t bottom; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 // LBRT rectangles (y-axis runs upwards). | 194 // LBRT rectangles (y-axis runs upwards). |
| 195 class CFX_FloatPoint { | 195 class CFX_FloatPoint { |
| 196 public: | 196 public: |
| 197 CFX_FloatPoint(FX_FLOAT xx, FX_FLOAT yy) : x(xx), y(yy) {} | 197 CFX_FloatPoint(FX_FLOAT xx, FX_FLOAT yy) : x(xx), y(yy) {} |
| 198 | 198 |
| 199 FX_FLOAT x; | 199 FX_FLOAT x; |
| 200 FX_FLOAT y; | 200 FX_FLOAT y; |
| 201 }; | 201 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 213 | 213 |
| 214 void Normalize(); | 214 void Normalize(); |
| 215 | 215 |
| 216 void Reset() { | 216 void Reset() { |
| 217 left = 0.0f; | 217 left = 0.0f; |
| 218 right = 0.0f; | 218 right = 0.0f; |
| 219 bottom = 0.0f; | 219 bottom = 0.0f; |
| 220 top = 0.0f; | 220 top = 0.0f; |
| 221 } | 221 } |
| 222 | 222 |
| 223 FX_BOOL IsEmpty() const { return left >= right || bottom >= top; } | 223 bool IsEmpty() const { return left >= right || bottom >= top; } |
| 224 FX_BOOL Contains(const CFX_FloatRect& other_rect) const; | 224 bool Contains(const CFX_FloatRect& other_rect) const; |
| 225 FX_BOOL Contains(FX_FLOAT x, FX_FLOAT y) const; | 225 bool Contains(FX_FLOAT x, FX_FLOAT y) const; |
| 226 | 226 |
| 227 void Transform(const CFX_Matrix* pMatrix); | 227 void Transform(const CFX_Matrix* pMatrix); |
| 228 void Intersect(const CFX_FloatRect& other_rect); | 228 void Intersect(const CFX_FloatRect& other_rect); |
| 229 void Union(const CFX_FloatRect& other_rect); | 229 void Union(const CFX_FloatRect& other_rect); |
| 230 | 230 |
| 231 FX_RECT GetInnerRect() const; | 231 FX_RECT GetInnerRect() const; |
| 232 FX_RECT GetOutterRect() const; | 232 FX_RECT GetOutterRect() const; |
| 233 FX_RECT GetClosestRect() const; | 233 FX_RECT GetClosestRect() const; |
| 234 | 234 |
| 235 int Substract4(CFX_FloatRect& substract_rect, CFX_FloatRect* pRects); | 235 int Substract4(CFX_FloatRect& substract_rect, CFX_FloatRect* pRects); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 void Translate(FX_FLOAT e, FX_FLOAT f) { | 294 void Translate(FX_FLOAT e, FX_FLOAT f) { |
| 295 left += e; | 295 left += e; |
| 296 right += e; | 296 right += e; |
| 297 top += f; | 297 top += f; |
| 298 bottom += f; | 298 bottom += f; |
| 299 } | 299 } |
| 300 | 300 |
| 301 static CFX_FloatRect GetBBox(const CFX_PointF* pPoints, int nPoints); | 301 static CFX_FloatRect GetBBox(const CFX_PointF* pPoints, int nPoints); |
| 302 | 302 |
| 303 FX_RECT ToFxRect() const { |
| 304 return FX_RECT(static_cast<int32_t>(left), static_cast<int32_t>(top), |
| 305 static_cast<int32_t>(right), static_cast<int32_t>(bottom)); |
| 306 } |
| 307 |
| 303 FX_FLOAT left; | 308 FX_FLOAT left; |
| 304 FX_FLOAT bottom; | 309 FX_FLOAT bottom; |
| 305 FX_FLOAT right; | 310 FX_FLOAT right; |
| 306 FX_FLOAT top; | 311 FX_FLOAT top; |
| 307 }; | 312 }; |
| 308 | 313 |
| 309 // LTWH rectangles (y-axis runs downwards). | 314 // LTWH rectangles (y-axis runs downwards). |
| 310 template <class baseType> | 315 template <class baseType> |
| 311 class CFX_RTemplate { | 316 class CFX_RTemplate { |
| 312 public: | 317 public: |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 public: | 666 public: |
| 662 FX_FLOAT a; | 667 FX_FLOAT a; |
| 663 FX_FLOAT b; | 668 FX_FLOAT b; |
| 664 FX_FLOAT c; | 669 FX_FLOAT c; |
| 665 FX_FLOAT d; | 670 FX_FLOAT d; |
| 666 FX_FLOAT e; | 671 FX_FLOAT e; |
| 667 FX_FLOAT f; | 672 FX_FLOAT f; |
| 668 }; | 673 }; |
| 669 | 674 |
| 670 #endif // CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ | 675 #endif // CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ |
| OLD | NEW |