Flutter Engine
 
Loading...
Searching...
No Matches
rrect.cc
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
6
10
11using flutter::RRect;
12
13namespace tonic {
14
15// Construct an DlRoundRect from a Dart RRect object.
16// The Dart RRect is a Float32List containing
17// [left, top, right, bottom, xRadius, yRadius]
19 Float32List buffer(value);
20
21 RRect result;
22 result.is_null = true;
23 if (buffer.data() == nullptr) {
24 return result;
25 }
26
27 // The Flutter rect may be inverted (upside down, backward, or both)
28 // Historically, Skia would normalize such rects but we will do that
29 // manually below when we construct the Impeller RoundRect
30 flutter::DlRect raw_rect =
31 flutter::DlRect::MakeLTRB(buffer[0], buffer[1], buffer[2], buffer[3]);
32
33 // Flutter has radii in TL,TR,BR,BL (clockwise) order,
34 // but Impeller uses TL,TR,BL,BR (zig-zag) order
36 .top_left = flutter::DlSize(buffer[4], buffer[5]),
37 .top_right = flutter::DlSize(buffer[6], buffer[7]),
38 .bottom_left = flutter::DlSize(buffer[10], buffer[11]),
39 .bottom_right = flutter::DlSize(buffer[8], buffer[9]),
40 };
41
42 result.rrect =
44
45 result.is_null = false;
46 return result;
47}
48
50 int index,
51 Dart_Handle& exception) {
52 Dart_Handle value = Dart_GetNativeArgument(args, index);
54 return FromDart(value);
55}
56
57} // namespace tonic
bool is_null
Definition rrect.h:18
DlRoundRect rrect
Definition rrect.h:17
int32_t value
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define FML_DCHECK(condition)
Definition logging.h:122
impeller::Size DlSize
bool CheckAndHandleError(Dart_Handle handle)
Definition dart_error.cc:33
static RoundRect MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
Definition round_rect.cc:9
constexpr TRect GetPositive() const
Get a version of this rectangle that has a non-negative size.
Definition rect.h:398
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129