12 : p0_(p0), p1_(p1), width_(stroke.
width), cap_(stroke.cap) {
26 return std::max(
width, min_size) * 0.5f;
30 bool allow_zero_length,
42 if (!allow_zero_length) {
46 return {stroke_half_width, 0};
48 return along * stroke_half_width /
length;
54 bool extend_endpoints,
63 auto across =
Vector2(along.y, -along.x);
64 corners[0] = p0 - across;
65 corners[1] = p1 - across;
66 corners[2] = p0 + across;
67 corners[3] = p1 + across;
68 if (extend_endpoints) {
91GeometryResult LineGeometry::GetPositionBuffer(
const ContentContext& renderer,
93 RenderPass& pass)
const {
94 using VT = SolidFillVertexShader::PerVertexData;
103 if (width_ == 0.f &&
transform.IsTranslationScaleOnly()) {
108 p0.x = RoundToHalf(p0.x);
111 p0.y = RoundToHalf(p0.y);
116 Entity fixed_transform = entity.Clone();
121 renderer.GetTessellator().RoundCapLine(
transform, p0, p1, radius);
131 auto& data_host_buffer = renderer.GetTransientsDataBuffer();
134 BufferView vertex_buffer = data_host_buffer.Emplace(
135 count *
sizeof(VT),
alignof(VT), [&corners](uint8_t* buffer) {
136 auto vertices =
reinterpret_cast<VT*
>(
buffer);
137 for (
auto& corner : corners) {
144 return GeometryResult{
148 .vertex_buffer = vertex_buffer,
149 .vertex_count = count,
152 .transform = fixed_transform.GetShaderTransform(pass),
164 for (
int i = 0;
i < 4;
i++) {
175 return coverage.has_value() ? coverage->Contains(rect) :
false;
179 return cap_ !=
Cap::kRound && (p0_.x == p1_.x || p0_.y == p1_.y);
static Scalar ComputeStrokeAlphaCoverage(const Matrix &entity, Scalar stroke_width)
Compute an alpha value to simulate lower coverage of fractional pixel strokes.
static GeometryResult ComputePositionGeometry(const ContentContext &renderer, const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
static Vector2 ComputeAlongVector(const Matrix &transform, bool allow_zero_length, Point p0, Point p1, Scalar width)
static Scalar ComputePixelHalfWidth(const Matrix &transform, Scalar width)
LineGeometry(Point p0, Point p1, const StrokeParameters &stroke)
bool IsAxisAlignedRect() const override
Scalar ComputeAlphaCoverage(const Matrix &transform) const override
static bool ComputeCorners(Point corners[4], const Matrix &transform, bool extend_endpoints, Point p0, Point p1, Scalar width)
std::optional< Rect > GetCoverage(const Matrix &transform) const override
bool CoversArea(const Matrix &transform, const Rect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
#define FML_DCHECK(condition)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
@ kNone
Does not use the index buffer.
constexpr float kEhCloseEnough
static const GeometryResult kEmptyResult
static constexpr Scalar kMinStrokeSize
A 4x4 matrix using column-major storage.
A structure to store all of the parameters related to stroking a path or basic geometry object.
constexpr Type GetLength() const
static constexpr std::optional< TRect > MakePointBounds(const U &value)