Flutter Engine
The 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
5#include "flutter/lib/ui/painting/rrect.h"
6
7#include "flutter/fml/logging.h"
10
11using flutter::RRect;
12
13namespace 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]
19 Float32List buffer(value);
20
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
46
47} // namespace tonic
bool is_null
Definition rrect.h:17
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
struct _Dart_NativeArguments * Dart_NativeArguments
Definition dart_api.h:3010
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static const uint8_t buffer[]
uint8_t value
GAsyncResult * result
#define FML_DCHECK(condition)
Definition logging.h:103
bool CheckAndHandleError(Dart_Handle handle)
Definition dart_error.cc:33
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646