Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkIPoint16.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkIPoint16_DEFINED
9#define SkIPoint16_DEFINED
10
13
14/** \struct SkIPoint16
15 SkIPoint16 holds two 16 bit integer coordinates.
16 */
17struct SkIPoint16 {
18 int16_t fX; //!< x-axis value used by SkIPoint16
19
20 int16_t fY; //!< y-axis value used by SkIPoint16
21
22 /** Sets fX to x, fY to y. If SK_DEBUG is defined, asserts
23 if x or y does not fit in 16 bits.
24
25 @param x integer x-axis value of constructed SkIPoint
26 @param y integer y-axis value of constructed SkIPoint
27 @return SkIPoint16 (x, y)
28 */
29 static constexpr SkIPoint16 Make(int x, int y) {
30 return {SkToS16(x), SkToS16(y)};
31 }
32
33 /** Returns x-axis value of SkIPoint16.
34
35 @return fX
36 */
37 int16_t x() const { return fX; }
38
39 /** Returns y-axis value of SkIPoint.
40
41 @return fY
42 */
43 int16_t y() const { return fY; }
44
45 /** Sets fX to x and fY to y.
46
47 @param x new value for fX
48 @param y new value for fY
49 */
50 void set(int x, int y) {
51 fX = SkToS16(x);
52 fY = SkToS16(y);
53 }
54};
55
56#endif
57
constexpr int16_t SkToS16(S x)
Definition SkTo.h:23
void set(int x, int y)
Definition SkIPoint16.h:50
int16_t fY
y-axis value used by SkIPoint16
Definition SkIPoint16.h:20
int16_t fX
x-axis value used by SkIPoint16
Definition SkIPoint16.h:18
int16_t y() const
Definition SkIPoint16.h:43
int16_t x() const
Definition SkIPoint16.h:37
static constexpr SkIPoint16 Make(int x, int y)
Definition SkIPoint16.h:29