Flutter Engine
Loading...
Searching...
No Matches
rational.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter 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 FLUTTER_IMPELLER_GEOMETRY_RATIONAL_H_
6
#define FLUTTER_IMPELLER_GEOMETRY_RATIONAL_H_
7
8
#include <cstdint>
9
#include "
impeller/geometry/scalar.h
"
10
11
namespace
impeller
{
12
13
class
Rational
{
14
public
:
15
constexpr
explicit
Rational
(int32_t num) : num_(num), den_(1) {}
16
17
constexpr
Rational
(int32_t num, uint32_t den) : num_(num), den_(den) {}
18
19
int32_t
GetNumerator
()
const
{
return
num_; }
20
21
uint32_t
GetDenominator
()
const
{
return
den_; }
22
23
bool
operator==
(
const
Rational
& that)
const
;
24
25
bool
operator<
(
const
Rational
& that)
const
;
26
27
uint64_t
GetHash
()
const
;
28
29
explicit
operator
Scalar
()
const
{
return
static_cast<
float
>
(num_) / den_; }
30
31
Rational
Invert
()
const
;
32
33
private
:
34
int32_t num_;
35
uint32_t den_;
36
};
37
38
}
// namespace impeller
39
40
#endif
// FLUTTER_IMPELLER_GEOMETRY_RATIONAL_H_
impeller::Rational
Definition
rational.h:13
impeller::Rational::Rational
constexpr Rational(int32_t num, uint32_t den)
Definition
rational.h:17
impeller::Rational::Invert
Rational Invert() const
Definition
rational.cc:46
impeller::Rational::Rational
constexpr Rational(int32_t num)
Definition
rational.h:15
impeller::Rational::operator<
bool operator<(const Rational &that) const
Definition
rational.cc:28
impeller::Rational::GetNumerator
int32_t GetNumerator() const
Definition
rational.h:19
impeller::Rational::GetHash
uint64_t GetHash() const
Definition
rational.cc:38
impeller::Rational::GetDenominator
uint32_t GetDenominator() const
Definition
rational.h:21
impeller::Rational::operator==
bool operator==(const Rational &that) const
Definition
rational.cc:18
impeller
Definition
texture.h:16
impeller::Scalar
float Scalar
Definition
scalar.h:19
scalar.h
impeller
geometry
rational.h
Generated on Thu Nov 6 2025 16:11:23 for Flutter Engine by
1.9.8