Flutter Engine
The Flutter Engine
aiks_dl_path_unittests.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/impeller/aiks/aiks_unittests.h"
6
7#include "flutter/display_list/dl_blend_mode.h"
8#include "flutter/display_list/dl_builder.h"
9#include "flutter/display_list/dl_color.h"
10#include "flutter/display_list/dl_paint.h"
11#include "flutter/display_list/effects/dl_color_filter.h"
12#include "flutter/testing/testing.h"
13
14namespace impeller {
15namespace testing {
16
17using namespace flutter;
18
19TEST_P(AiksTest, RotateColorFilteredPath) {
21 builder.Transform(SkMatrix::Translate(300, 300) * SkMatrix::RotateDeg(90));
22
23 SkPath arrow_stem;
24 SkPath arrow_head;
25
26 arrow_stem.moveTo({120, 190}).lineTo({120, 50});
27 arrow_head.moveTo({50, 120}).lineTo({120, 190}).lineTo({190, 120});
28
29 auto filter =
30 DlBlendColorFilter::Make(DlColor::kAliceBlue(), DlBlendMode::kSrcIn);
31
33 paint.setStrokeWidth(15.0);
34 paint.setStrokeCap(DlStrokeCap::kRound);
35 paint.setStrokeJoin(DlStrokeJoin::kRound);
36 paint.setDrawStyle(DlDrawStyle::kStroke);
37 paint.setColorFilter(filter);
38 paint.setColor(DlColor::kBlack());
39
40 builder.DrawPath(arrow_stem, paint);
41 builder.DrawPath(arrow_head, paint);
42
43 ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
44}
45} // namespace testing
46} // namespace impeller
static SkMatrix RotateDeg(SkScalar deg)
Definition: SkMatrix.h:104
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition: SkMatrix.h:91
Definition: SkPath.h:59
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
static std::shared_ptr< DlColorFilter > Make(DlColor color, DlBlendMode mode)
const Paint & paint
Definition: color_source.cc:38
@ kRound
adds circle
@ kStroke
strokes boundary of shapes
TEST_P(AiksTest, CanRenderAdvancedBlendColorFilterWithSaveLayer)
static constexpr DlColor kBlack()
Definition: dl_color.h:22
static constexpr DlColor kAliceBlue()
Definition: dl_color.h:33