11#include "gtest/gtest.h"
40TEST(DisplayListUtils, OverRestore) {
50TEST(DisplayListUtils, SetColorSourceDithersIfGradient) {
54 EXPECT_TRUE(helper.
paint(
true).isDither());
55 EXPECT_FALSE(helper.
paint(
false).isDither());
59TEST(DisplayListUtils, SetColorSourceDoesNotDitherIfNotGradient) {
64 EXPECT_FALSE(helper.
paint(
true).isDither());
65 EXPECT_FALSE(helper.
paint(
false).isDither());
68 EXPECT_FALSE(helper.
paint(
true).isDither());
69 EXPECT_FALSE(helper.
paint(
false).isDither());
73TEST(DisplayListUtils, SkDispatcherSetColorSourceDithersIfGradient) {
78 EXPECT_TRUE(dispatcher.
paint(
true).isDither());
79 EXPECT_FALSE(dispatcher.
paint(
false).isDither());
80 EXPECT_FALSE(dispatcher.
safe_paint(
true)->isDither());
85TEST(DisplayListUtils, SkDispatcherSetColorSourceDoesNotDitherIfNotGradient) {
91 EXPECT_FALSE(dispatcher.
paint(
true).isDither());
92 EXPECT_FALSE(dispatcher.
paint(
false).isDither());
93 EXPECT_FALSE(dispatcher.
safe_paint(
true)->isDither());
97 EXPECT_FALSE(dispatcher.
paint(
true).isDither());
98 EXPECT_FALSE(dispatcher.
paint(
false).isDither());
99 EXPECT_FALSE(dispatcher.
safe_paint(
true)->isDither());
103TEST(DisplayListUtils, DispatchSetColorSupportsWideGamut) {
109 SkColor4f sk_color = dispatcher.
paint().getColor4f();
110 EXPECT_EQ(dl_color.
getRedF(), sk_color.fR);
111 EXPECT_EQ(dl_color.
getGreenF(), sk_color.fG);
112 EXPECT_EQ(dl_color.
getBlueF(), sk_color.fB);
static std::shared_ptr< DlColorSource > MakeLinear(const DlPoint start_point, const DlPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
Internal API for rendering recorded display lists to backends.
virtual void setColorSource(const DlColorSource *source)=0
virtual void setColor(DlColor color)=0
Backend implementation of |DlOpReceiver| for |SkCanvas|.
const SkPaint * safe_paint(bool use_attributes)
const SkPaint & paint(bool uses_shader=true)
void save_opacity(SkScalar opacity_for_children)
static const auto kTestLinearGradient
static const std::shared_ptr< DlColorSource > kTestSource1
static constexpr float kTestStops[kTestStopCount]
TEST(NativeAssetsManagerTest, NoAvailableAssets)
static constexpr DlColor kTestColors[kTestStopCount]
constexpr DlScalar getRedF() const
constexpr DlScalar getBlueF() const
constexpr DlScalar getGreenF() const