Flutter Engine
The Flutter Engine
third_party
accessibility
gfx
geometry
rect_conversions.h
Go to the documentation of this file.
1
// Copyright (c) 2012 The Chromium 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
#ifndef UI_GFX_GEOMETRY_RECT_CONVERSIONS_H_
6
#define UI_GFX_GEOMETRY_RECT_CONVERSIONS_H_
7
8
#include "
rect.h
"
9
#include "
rect_f.h
"
10
11
namespace
gfx
{
12
13
// Returns the smallest Rect that encloses the given RectF.
14
GFX_EXPORT
Rect
ToEnclosingRect
(
const
RectF&
rect
);
15
16
// Similar to ToEnclosingRect(), but for each edge, if the distance between the
17
// edge and the nearest integer grid is smaller than |error|, the edge is
18
// snapped to the integer grid. Unlike ToNearestRect() which only accepts
19
// integer rect with or without floating point error, this function also accepts
20
// non-integer rect.
21
GFX_EXPORT
Rect
ToEnclosingRectIgnoringError
(
const
RectF&
rect
,
float
error
);
22
23
// Returns the largest Rect that is enclosed by the given RectF.
24
GFX_EXPORT
Rect
ToEnclosedRect
(
const
RectF&
rect
);
25
26
// Similar to ToEnclosedRect(), but for each edge, if the distance between the
27
// edge and the nearest integer grid is smaller than |error|, the edge is
28
// snapped to the integer grid. Unlike ToNearestRect() which only accepts
29
// integer rect with or without floating point error, this function also accepts
30
// non-integer rect.
31
GFX_EXPORT
Rect
ToEnclosedRectIgnoringError
(
const
RectF&
rect
,
float
error
);
32
33
// Returns the Rect after snapping the corners of the RectF to an integer grid.
34
// This should only be used when the RectF you provide is expected to be an
35
// integer rect with floating point error. If it is an arbitrary RectF, then
36
// you should use a different method.
37
GFX_EXPORT
Rect
ToNearestRect
(
const
RectF&
rect
);
38
39
// Returns true if the Rect produced after snapping the corners of the RectF
40
// to an integer grid is within |distance|.
41
GFX_EXPORT
bool
IsNearestRectWithinDistance
(
const
gfx::RectF
&
rect
,
42
float
distance
);
43
44
// Returns the Rect after rounding the corners of the RectF to an integer grid.
45
GFX_EXPORT
gfx::Rect
ToRoundedRect
(
const
gfx::RectF
&
rect
);
46
47
// Returns a Rect obtained by flooring the values of the given RectF.
48
// Please prefer the previous two functions in new code.
49
GFX_EXPORT
Rect
ToFlooredRectDeprecated
(
const
RectF&
rect
);
50
51
}
// namespace gfx
52
53
#endif
// UI_GFX_GEOMETRY_RECT_CONVERSIONS_H_
gfx::RectF
Definition:
rect_f.h:26
gfx::Rect
Definition:
rect.h:36
error
const uint8_t uint32_t uint32_t GError ** error
Definition:
fl_pixel_buffer_texture_test.cc:40
GFX_EXPORT
#define GFX_EXPORT
Definition:
gfx_export.h:26
SkRecords::rect
sk_sp< SkBlender > blender SkRect rect
Definition:
SkRecords.h:350
gfx
Definition:
insets.cc:10
gfx::ToEnclosingRectIgnoringError
Rect ToEnclosingRectIgnoringError(const RectF &r, float error)
Definition:
rect_conversions.cc:40
gfx::ToEnclosingRect
Rect ToEnclosingRect(const RectF &r)
Definition:
rect_conversions.cc:29
gfx::ToRoundedRect
gfx::Rect ToRoundedRect(const gfx::RectF &rect)
Definition:
rect_conversions.cc:111
gfx::IsNearestRectWithinDistance
bool IsNearestRectWithinDistance(const gfx::RectF &rect, float distance)
Definition:
rect_conversions.cc:94
gfx::ToEnclosedRectIgnoringError
Rect ToEnclosedRectIgnoringError(const RectF &r, float error)
Definition:
rect_conversions.cc:59
gfx::ToEnclosedRect
Rect ToEnclosedRect(const RectF &rect)
Definition:
rect_conversions.cc:51
gfx::ToFlooredRectDeprecated
Rect ToFlooredRectDeprecated(const RectF &rect)
Definition:
rect_conversions.cc:121
gfx::ToNearestRect
Rect ToNearestRect(const RectF &rect)
Definition:
rect_conversions.cc:70
impeller::saturated::distance
SI distance
Definition:
saturated_math.h:57
impeller::Rect
TRect< Scalar > Rect
Definition:
rect.h:769
rect_f.h
rect.h
Generated on Sun Jun 23 2024 21:55:21 for Flutter Engine by
1.9.4