Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
lib
ui
painting
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
5
#include "flutter/lib/ui/painting/rrect.h"
6
7
#include "flutter/fml/logging.h"
8
#include "
third_party/tonic/logging/dart_error.h
"
9
#include "
third_party/tonic/typed_data/typed_list.h
"
10
11
using
flutter::RRect
;
12
13
namespace
tonic
{
14
15
// Construct an SkRRect from a Dart RRect object.
16
// The Dart RRect is a Float32List containing
17
// [left, top, right, bottom, xRadius, yRadius]
18
RRect
DartConverter<flutter::RRect>::FromDart
(
Dart_Handle
value) {
19
Float32List
buffer
(
value
);
20
21
RRect
result
;
22
result
.
is_null
=
true
;
23
if
(
buffer
.data() ==
nullptr
) {
24
return
result
;
25
}
26
27
SkVector
radii[4] = {{
buffer
[4],
buffer
[5]},
28
{
buffer
[6],
buffer
[7]},
29
{
buffer
[8],
buffer
[9]},
30
{
buffer
[10],
buffer
[11]}};
31
32
result
.sk_rrect.setRectRadii(
33
SkRect::MakeLTRB
(
buffer
[0],
buffer
[1],
buffer
[2],
buffer
[3]), radii);
34
35
result
.is_null =
false
;
36
return
result
;
37
}
38
39
RRect
DartConverter<flutter::RRect>::FromArguments
(
Dart_NativeArguments
args
,
40
int
index,
41
Dart_Handle
& exception) {
42
Dart_Handle
value
=
Dart_GetNativeArgument
(
args
, index);
43
FML_DCHECK
(!
CheckAndHandleError
(
value
));
44
return
FromDart(
value
);
45
}
46
47
}
// namespace tonic
flutter::RRect
Definition
rrect.h:14
flutter::RRect::is_null
bool is_null
Definition
rrect.h:17
Dart_Handle
struct _Dart_Handle * Dart_Handle
Definition
dart_api.h:258
Dart_GetNativeArgument
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
Dart_NativeArguments
struct _Dart_NativeArguments * Dart_NativeArguments
Definition
dart_api.h:3010
dart_error.h
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition
fl_event_channel.h:89
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
value
uint8_t value
Definition
fl_standard_message_codec.cc:36
result
GAsyncResult * result
Definition
fl_text_input_plugin.cc:106
FML_DCHECK
#define FML_DCHECK(condition)
Definition
logging.h:103
tonic
Definition
image_filter.h:14
tonic::CheckAndHandleError
bool CheckAndHandleError(Dart_Handle handle)
Definition
dart_error.cc:33
SkPoint
Definition
SkPoint_impl.h:163
SkRect::MakeLTRB
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition
SkRect.h:646
tonic::DartConverter
Definition
dart_converter.h:21
typed_list.h
Generated on Fri Apr 26 2024 06:14:17 for Flutter Engine by
1.9.8