1 // Copyright 2016 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FPDFDOC_CPVT_FLOATRECT_H_ 8 #define CORE_FPDFDOC_CPVT_FLOATRECT_H_ 9 10 #include "core/fxcrt/fx_coordinates.h" 11 12 class CPVT_FloatRect : public CFX_FloatRect { 13 public: CPVT_FloatRect()14 CPVT_FloatRect() { left = top = right = bottom = 0.0f; } 15 CPVT_FloatRect(float other_left,float other_top,float other_right,float other_bottom)16 CPVT_FloatRect(float other_left, 17 float other_top, 18 float other_right, 19 float other_bottom) { 20 left = other_left; 21 top = other_top; 22 right = other_right; 23 bottom = other_bottom; 24 } 25 CPVT_FloatRect(const CFX_FloatRect & rect)26 explicit CPVT_FloatRect(const CFX_FloatRect& rect) { 27 left = rect.left; 28 top = rect.top; 29 right = rect.right; 30 bottom = rect.bottom; 31 } 32 Height()33 float Height() const { 34 if (top > bottom) 35 return top - bottom; 36 return bottom - top; 37 } 38 }; 39 40 #endif // CORE_FPDFDOC_CPVT_FLOATRECT_H_ 41