[lint] Enforce k prefix for global constants (flutter/engine#33666)
Enforces that all global constants are prefixed with a 'k' as per the style guide and updates the codebase into conformance where necessary. This does not change any public API. Additional testing provided by the addition of the lint rule. Ref: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#begin-global-constant-names-with-prefix-k
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Checks: "google-*,\
|
||||
clang-analyzer-*,\
|
||||
clang-diagnostic-*,\
|
||||
readability-identifier-naming,\
|
||||
-google-objc-global-variable-declaration,\
|
||||
-google-objc-avoid-throwing-exception,\
|
||||
-clang-analyzer-nullability.NullPassedToNonnull,\
|
||||
@@ -15,6 +16,11 @@ clang-diagnostic-*,\
|
||||
# to prevent new warnings being introduced.
|
||||
# https://github.com/flutter/flutter/issues/93279
|
||||
WarningsAsErrors: "clang-analyzer-*,\
|
||||
readability-identifier-naming,\
|
||||
clang-diagnostic-*,\
|
||||
google-objc-*,\
|
||||
google-explicit-constructor"
|
||||
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.GlobalConstantPrefix
|
||||
value: k
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
static const float matrix[20] = {
|
||||
static const float kMatrix[20] = {
|
||||
1, 2, 3, 4, 5, //
|
||||
6, 7, 8, 9, 10, //
|
||||
11, 12, 13, 14, 15, //
|
||||
@@ -49,14 +49,14 @@ TEST(DisplayListColorFilter, FromSkiaBlendFilter) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, FromSkiaMatrixFilter) {
|
||||
sk_sp<SkColorFilter> sk_filter = SkColorFilters::Matrix(matrix);
|
||||
sk_sp<SkColorFilter> sk_filter = SkColorFilters::Matrix(kMatrix);
|
||||
std::shared_ptr<DlColorFilter> filter = DlColorFilter::From(sk_filter);
|
||||
DlMatrixColorFilter dl_filter(matrix);
|
||||
DlMatrixColorFilter dl_filter(kMatrix);
|
||||
ASSERT_EQ(filter->type(), DlColorFilterType::kMatrix);
|
||||
ASSERT_EQ(*filter->asMatrix(), dl_filter);
|
||||
const DlMatrixColorFilter* matrix_filter = filter->asMatrix();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
ASSERT_EQ((*matrix_filter)[i], matrix[i]);
|
||||
ASSERT_EQ((*matrix_filter)[i], kMatrix[i]);
|
||||
}
|
||||
|
||||
ASSERT_EQ(filter->asBlend(), nullptr);
|
||||
@@ -137,24 +137,24 @@ TEST(DisplayListColorFilter, NopBlendShouldNotCrash) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, MatrixConstructor) {
|
||||
DlMatrixColorFilter filter(matrix);
|
||||
DlMatrixColorFilter filter(kMatrix);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, MatrixShared) {
|
||||
DlMatrixColorFilter filter(matrix);
|
||||
DlMatrixColorFilter filter(kMatrix);
|
||||
ASSERT_NE(filter.shared().get(), &filter);
|
||||
ASSERT_EQ(*filter.shared(), filter);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, MatrixAsMatrix) {
|
||||
DlMatrixColorFilter filter(matrix);
|
||||
DlMatrixColorFilter filter(kMatrix);
|
||||
ASSERT_NE(filter.asMatrix(), nullptr);
|
||||
ASSERT_EQ(filter.asMatrix(), &filter);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, MatrixContents) {
|
||||
float matrix_[20];
|
||||
memcpy(matrix_, matrix, sizeof(matrix_));
|
||||
memcpy(matrix_, kMatrix, sizeof(matrix_));
|
||||
DlMatrixColorFilter filter(matrix_);
|
||||
|
||||
// Test deref operator []
|
||||
@@ -176,14 +176,14 @@ TEST(DisplayListColorFilter, MatrixContents) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, MatrixEquals) {
|
||||
DlMatrixColorFilter filter1(matrix);
|
||||
DlMatrixColorFilter filter2(matrix);
|
||||
DlMatrixColorFilter filter1(kMatrix);
|
||||
DlMatrixColorFilter filter2(kMatrix);
|
||||
TestEquals(filter1, filter2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorFilter, MatrixNotEquals) {
|
||||
float matrix_[20];
|
||||
memcpy(matrix_, matrix, sizeof(matrix_));
|
||||
memcpy(matrix_, kMatrix, sizeof(matrix_));
|
||||
DlMatrixColorFilter filter1(matrix_);
|
||||
matrix_[4] += 101;
|
||||
DlMatrixColorFilter filter2(matrix_);
|
||||
|
||||
@@ -25,58 +25,58 @@ static sk_sp<SkImage> MakeTestImage(int w, int h, SkColor color) {
|
||||
return surface->makeImageSnapshot();
|
||||
}
|
||||
|
||||
static const sk_sp<SkImage> TestImage1 = MakeTestImage(10, 10, SK_ColorGREEN);
|
||||
static const sk_sp<SkImage> TestAlphaImage1 =
|
||||
static const sk_sp<SkImage> kTestImage1 = MakeTestImage(10, 10, SK_ColorGREEN);
|
||||
static const sk_sp<SkImage> kTestAlphaImage1 =
|
||||
MakeTestImage(10, 10, SK_ColorTRANSPARENT);
|
||||
// clang-format off
|
||||
static const SkMatrix TestMatrix1 =
|
||||
static const SkMatrix kTestMatrix1 =
|
||||
SkMatrix::MakeAll(2, 0, 10,
|
||||
0, 3, 12,
|
||||
0, 0, 1);
|
||||
static const SkMatrix TestMatrix2 =
|
||||
static const SkMatrix kTestMatrix2 =
|
||||
SkMatrix::MakeAll(4, 0, 15,
|
||||
0, 7, 17,
|
||||
0, 0, 1);
|
||||
// clang-format on
|
||||
static constexpr int kTestStopCount = 3;
|
||||
static constexpr DlColor TestColors[kTestStopCount] = {
|
||||
static constexpr DlColor kTestColors[kTestStopCount] = {
|
||||
DlColor::kRed(),
|
||||
DlColor::kGreen(),
|
||||
DlColor::kBlue(),
|
||||
};
|
||||
static const DlColor TestAlphaColors[kTestStopCount] = {
|
||||
static const DlColor kTestAlphaColors[kTestStopCount] = {
|
||||
DlColor::kBlue().withAlpha(0x7F),
|
||||
DlColor::kRed().withAlpha(0x2F),
|
||||
DlColor::kGreen().withAlpha(0xCF),
|
||||
};
|
||||
static constexpr float TestStops[kTestStopCount] = {
|
||||
static constexpr float kTestStops[kTestStopCount] = {
|
||||
0.0f,
|
||||
0.7f,
|
||||
1.0f,
|
||||
};
|
||||
static constexpr float TestStops2[kTestStopCount] = {
|
||||
static constexpr float kTestStops2[kTestStopCount] = {
|
||||
0.0f,
|
||||
0.3f,
|
||||
1.0f,
|
||||
};
|
||||
static constexpr SkPoint TestPoints[2] = {
|
||||
static constexpr SkPoint kTestPoints[2] = {
|
||||
SkPoint::Make(5, 15),
|
||||
SkPoint::Make(7, 18),
|
||||
};
|
||||
static constexpr SkPoint TestPoints2[2] = {
|
||||
static constexpr SkPoint kTestPoints2[2] = {
|
||||
SkPoint::Make(100, 115),
|
||||
SkPoint::Make(107, 118),
|
||||
};
|
||||
static const sk_sp<SkShader> shaderA = SkShaders::Color(SK_ColorRED);
|
||||
static const sk_sp<SkShader> shaderB = SkShaders::Color(SK_ColorBLUE);
|
||||
static const sk_sp<SkShader> TestUnknownShader =
|
||||
SkShaders::Blend(SkBlendMode::kOverlay, shaderA, shaderB);
|
||||
static const sk_sp<SkShader> TestAlphaUnknownShader =
|
||||
SkShaders::Blend(SkBlendMode::kDstOut, shaderA, shaderB);
|
||||
static const sk_sp<SkShader> kShaderA = SkShaders::Color(SK_ColorRED);
|
||||
static const sk_sp<SkShader> kShaderB = SkShaders::Color(SK_ColorBLUE);
|
||||
static const sk_sp<SkShader> kTestUnknownShader =
|
||||
SkShaders::Blend(SkBlendMode::kOverlay, kShaderA, kShaderB);
|
||||
static const sk_sp<SkShader> kTestAlphaUnknownShader =
|
||||
SkShaders::Blend(SkBlendMode::kDstOut, kShaderA, kShaderB);
|
||||
|
||||
TEST(DisplayListColorSource, BuilderSetGet) {
|
||||
DlImageColorSource source(TestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &TestMatrix1);
|
||||
DlImageColorSource source(kTestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &kTestMatrix1);
|
||||
DisplayListBuilder builder;
|
||||
ASSERT_EQ(builder.getColorSource(), nullptr);
|
||||
builder.setColorSource(&source);
|
||||
@@ -117,15 +117,15 @@ TEST(DisplayListColorSource, FromSkiaColorShader) {
|
||||
|
||||
TEST(DisplayListColorSource, FromSkiaImageShader) {
|
||||
sk_sp<SkShader> shader =
|
||||
TestImage1->makeShader(DisplayList::LinearSampling, &TestMatrix1);
|
||||
kTestImage1->makeShader(DisplayList::LinearSampling, &kTestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::From(shader);
|
||||
DlImageColorSource dl_source(TestImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource dl_source(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kClamp, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
ASSERT_EQ(source->type(), DlColorSourceType::kImage);
|
||||
ASSERT_EQ(*source->asImage(), dl_source);
|
||||
ASSERT_EQ(source->asImage()->image(), TestImage1);
|
||||
ASSERT_EQ(source->asImage()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asImage()->image(), kTestImage1);
|
||||
ASSERT_EQ(source->asImage()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->asImage()->horizontal_tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asImage()->vertical_tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asImage()->sampling(), DisplayList::LinearSampling);
|
||||
@@ -141,9 +141,9 @@ TEST(DisplayListColorSource, FromSkiaLinearGradient) {
|
||||
// We cannot read back the matrix parameter from a Skia LinearGradient
|
||||
// so we conservatively use an UnknownColorSource wrapper so as to not
|
||||
// lose any data.
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(TestColors);
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(kTestColors);
|
||||
sk_sp<SkShader> shader = SkGradientShader::MakeLinear(
|
||||
TestPoints, sk_colors, TestStops, kTestStopCount, SkTileMode::kClamp);
|
||||
kTestPoints, sk_colors, kTestStops, kTestStopCount, SkTileMode::kClamp);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::From(shader);
|
||||
ASSERT_EQ(source->type(), DlColorSourceType::kUnknown);
|
||||
ASSERT_EQ(source->skia_object(), shader);
|
||||
@@ -160,9 +160,9 @@ TEST(DisplayListColorSource, FromSkiaRadialGradient) {
|
||||
// We cannot read back the matrix parameter from a Skia RadialGradient
|
||||
// so we conservatively use an UnknownColorSource wrapper so as to not
|
||||
// lose any data.
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(TestColors);
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(kTestColors);
|
||||
sk_sp<SkShader> shader =
|
||||
SkGradientShader::MakeRadial(TestPoints[0], 10.0, sk_colors, TestStops,
|
||||
SkGradientShader::MakeRadial(kTestPoints[0], 10.0, sk_colors, kTestStops,
|
||||
kTestStopCount, SkTileMode::kClamp);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::From(shader);
|
||||
ASSERT_EQ(source->type(), DlColorSourceType::kUnknown);
|
||||
@@ -180,9 +180,9 @@ TEST(DisplayListColorSource, FromSkiaConicalGradient) {
|
||||
// We cannot read back the matrix parameter from a Skia ConicalGradient
|
||||
// so we conservatively use an UnknownColorSource wrapper so as to not
|
||||
// lose any data.
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(TestColors);
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(kTestColors);
|
||||
sk_sp<SkShader> shader = SkGradientShader::MakeTwoPointConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, sk_colors, TestStops,
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, sk_colors, kTestStops,
|
||||
kTestStopCount, SkTileMode::kClamp);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::From(shader);
|
||||
ASSERT_EQ(source->type(), DlColorSourceType::kUnknown);
|
||||
@@ -200,9 +200,10 @@ TEST(DisplayListColorSource, FromSkiaSweepGradient) {
|
||||
// We cannot read back the matrix parameter, nor the sweep parameters from a
|
||||
// Skia SweepGradient so we conservatively use an UnknownColorSource wrapper
|
||||
// so as to not lose any data.
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(TestColors);
|
||||
sk_sp<SkShader> shader = SkGradientShader::MakeSweep(
|
||||
TestPoints[0].fX, TestPoints[0].fY, sk_colors, TestStops, kTestStopCount);
|
||||
const SkColor* sk_colors = reinterpret_cast<const SkColor*>(kTestColors);
|
||||
sk_sp<SkShader> shader =
|
||||
SkGradientShader::MakeSweep(kTestPoints[0].fX, kTestPoints[0].fY,
|
||||
sk_colors, kTestStops, kTestStopCount);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::From(shader);
|
||||
ASSERT_EQ(source->type(), DlColorSourceType::kUnknown);
|
||||
ASSERT_EQ(source->skia_object(), shader);
|
||||
@@ -217,9 +218,9 @@ TEST(DisplayListColorSource, FromSkiaSweepGradient) {
|
||||
|
||||
TEST(DisplayListColorSource, FromSkiaUnrecognizedShader) {
|
||||
std::shared_ptr<DlColorSource> source =
|
||||
DlColorSource::From(TestUnknownShader);
|
||||
DlColorSource::From(kTestUnknownShader);
|
||||
ASSERT_EQ(source->type(), DlColorSourceType::kUnknown);
|
||||
ASSERT_EQ(source->skia_object(), TestUnknownShader);
|
||||
ASSERT_EQ(source->skia_object(), kTestUnknownShader);
|
||||
|
||||
ASSERT_EQ(source->asColor(), nullptr);
|
||||
ASSERT_EQ(source->asImage(), nullptr);
|
||||
@@ -276,20 +277,20 @@ TEST(DisplayListColorSource, ColorNotEquals) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ImageConstructor) {
|
||||
DlImageColorSource source(TestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &TestMatrix1);
|
||||
DlImageColorSource source(kTestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &kTestMatrix1);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ImageShared) {
|
||||
DlImageColorSource source(TestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &TestMatrix1);
|
||||
DlImageColorSource source(kTestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &kTestMatrix1);
|
||||
ASSERT_NE(source.shared().get(), &source);
|
||||
ASSERT_EQ(*source.shared(), source);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ImageAsImage) {
|
||||
DlImageColorSource source(TestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &TestMatrix1);
|
||||
DlImageColorSource source(kTestImage1, DlTileMode::kClamp, DlTileMode::kClamp,
|
||||
DisplayList::LinearSampling, &kTestMatrix1);
|
||||
ASSERT_NE(source.asImage(), nullptr);
|
||||
ASSERT_EQ(source.asImage(), &source);
|
||||
|
||||
@@ -301,93 +302,93 @@ TEST(DisplayListColorSource, ImageAsImage) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ImageContents) {
|
||||
DlImageColorSource source(TestImage1, DlTileMode::kRepeat,
|
||||
DlImageColorSource source(kTestImage1, DlTileMode::kRepeat,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
ASSERT_EQ(source.image(), TestImage1);
|
||||
&kTestMatrix1);
|
||||
ASSERT_EQ(source.image(), kTestImage1);
|
||||
ASSERT_EQ(source.horizontal_tile_mode(), DlTileMode::kRepeat);
|
||||
ASSERT_EQ(source.vertical_tile_mode(), DlTileMode::kMirror);
|
||||
ASSERT_EQ(source.sampling(), DisplayList::LinearSampling);
|
||||
ASSERT_EQ(source.matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source.matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source.is_opaque(), true);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, AlphaImageContents) {
|
||||
DlImageColorSource source(TestAlphaImage1, DlTileMode::kRepeat,
|
||||
DlImageColorSource source(kTestAlphaImage1, DlTileMode::kRepeat,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
ASSERT_EQ(source.image(), TestAlphaImage1);
|
||||
&kTestMatrix1);
|
||||
ASSERT_EQ(source.image(), kTestAlphaImage1);
|
||||
ASSERT_EQ(source.horizontal_tile_mode(), DlTileMode::kRepeat);
|
||||
ASSERT_EQ(source.vertical_tile_mode(), DlTileMode::kMirror);
|
||||
ASSERT_EQ(source.sampling(), DisplayList::LinearSampling);
|
||||
ASSERT_EQ(source.matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source.matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source.is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ImageEquals) {
|
||||
DlImageColorSource source1(TestImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource source1(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
DlImageColorSource source2(TestImage1, DlTileMode::kClamp,
|
||||
&kTestMatrix1);
|
||||
DlImageColorSource source2(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
TestEquals(source1, source2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ImageNotEquals) {
|
||||
DlImageColorSource source1(TestImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource source1(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
{
|
||||
DlImageColorSource source2(TestAlphaImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource source2(kTestAlphaImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
TestNotEquals(source1, source2, "Image differs");
|
||||
}
|
||||
{
|
||||
DlImageColorSource source2(TestImage1, DlTileMode::kRepeat,
|
||||
DlImageColorSource source2(kTestImage1, DlTileMode::kRepeat,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
TestNotEquals(source1, source2, "hTileMode differs");
|
||||
}
|
||||
{
|
||||
DlImageColorSource source2(TestImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource source2(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kRepeat, DisplayList::LinearSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
TestNotEquals(source1, source2, "vTileMode differs");
|
||||
}
|
||||
{
|
||||
DlImageColorSource source2(TestImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource source2(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kMirror, DisplayList::CubicSampling,
|
||||
&TestMatrix1);
|
||||
&kTestMatrix1);
|
||||
TestNotEquals(source1, source2, "Sampling differs");
|
||||
}
|
||||
{
|
||||
DlImageColorSource source2(TestImage1, DlTileMode::kClamp,
|
||||
DlImageColorSource source2(kTestImage1, DlTileMode::kClamp,
|
||||
DlTileMode::kMirror, DisplayList::LinearSampling,
|
||||
&TestMatrix2);
|
||||
&kTestMatrix2);
|
||||
TestNotEquals(source1, source2, "Matrix differs");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, LinearGradientConstructor) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, LinearGradientShared) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->shared().get(), source.get());
|
||||
ASSERT_EQ(*source->shared().get(), *source.get());
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, LinearGradientAsLinear) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->asLinearGradient(), nullptr);
|
||||
ASSERT_EQ(source->asLinearGradient(), source.get());
|
||||
|
||||
@@ -400,112 +401,112 @@ TEST(DisplayListColorSource, LinearGradientAsLinear) {
|
||||
|
||||
TEST(DisplayListColorSource, LinearGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asLinearGradient()->start_point(), TestPoints[0]);
|
||||
ASSERT_EQ(source->asLinearGradient()->end_point(), TestPoints[1]);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asLinearGradient()->start_point(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asLinearGradient()->end_point(), kTestPoints[1]);
|
||||
ASSERT_EQ(source->asLinearGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asLinearGradient()->colors()[i], TestColors[i]);
|
||||
ASSERT_EQ(source->asLinearGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asLinearGradient()->colors()[i], kTestColors[i]);
|
||||
ASSERT_EQ(source->asLinearGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asLinearGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asLinearGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asLinearGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), true);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, AlphaLinearGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestAlphaColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asLinearGradient()->start_point(), TestPoints[0]);
|
||||
ASSERT_EQ(source->asLinearGradient()->end_point(), TestPoints[1]);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestAlphaColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asLinearGradient()->start_point(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asLinearGradient()->end_point(), kTestPoints[1]);
|
||||
ASSERT_EQ(source->asLinearGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asLinearGradient()->colors()[i], TestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asLinearGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asLinearGradient()->colors()[i], kTestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asLinearGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asLinearGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asLinearGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asLinearGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, LinearGradientEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestEquals(*source1, *source2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, LinearGradientNotEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints2[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints2[0], kTestPoints[1], kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Point 0 differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints2[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints2[1], kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Point 1 differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], 2, TestColors, TestStops, //
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], 2, kTestColors, kTestStops, //
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stop count differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestAlphaColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestAlphaColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Colors differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops2,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors,
|
||||
kTestStops2, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stops differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kMirror, &TestMatrix1);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kMirror, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Tile Mode differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeLinear(
|
||||
TestPoints[0], TestPoints[1], kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix2);
|
||||
kTestPoints[0], kTestPoints[1], kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix2);
|
||||
TestNotEquals(*source1, *source2, "Matrix differs");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, RadialGradientConstructor) {
|
||||
std::shared_ptr<DlColorSource> source =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, RadialGradientShared) {
|
||||
std::shared_ptr<DlColorSource> source =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->shared().get(), source.get());
|
||||
ASSERT_EQ(*source->shared().get(), *source.get());
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, RadialGradientAsRadial) {
|
||||
std::shared_ptr<DlColorSource> source =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->asRadialGradient(), nullptr);
|
||||
ASSERT_EQ(source->asRadialGradient(), source.get());
|
||||
|
||||
@@ -517,113 +518,113 @@ TEST(DisplayListColorSource, RadialGradientAsRadial) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, RadialGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asRadialGradient()->center(), TestPoints[0]);
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asRadialGradient()->center(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asRadialGradient()->radius(), 10.0);
|
||||
ASSERT_EQ(source->asRadialGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asRadialGradient()->colors()[i], TestColors[i]);
|
||||
ASSERT_EQ(source->asRadialGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asRadialGradient()->colors()[i], kTestColors[i]);
|
||||
ASSERT_EQ(source->asRadialGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asRadialGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asRadialGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asRadialGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), true);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, AlphaRadialGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 10.0, kTestStopCount, TestAlphaColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asRadialGradient()->center(), TestPoints[0]);
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestAlphaColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asRadialGradient()->center(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asRadialGradient()->radius(), 10.0);
|
||||
ASSERT_EQ(source->asRadialGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asRadialGradient()->colors()[i], TestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asRadialGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asRadialGradient()->colors()[i], kTestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asRadialGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asRadialGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asRadialGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asRadialGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, RadialGradientEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source2 =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestEquals(*source1, *source2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, RadialGradientNotEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 =
|
||||
DlColorSource::MakeRadial(TestPoints[0], 10.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeRadial(
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints2[0], 10.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints2[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Center differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Radius differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 10.0, 2, TestColors, TestStops, //
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 2, kTestColors, kTestStops, //
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stop count differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 10.0, kTestStopCount, TestAlphaColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestAlphaColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Colors differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 10.0, kTestStopCount, TestColors, TestStops2,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops2,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stops differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 10.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kMirror, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kMirror, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Tile Mode differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeRadial(
|
||||
TestPoints[0], 10.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix2);
|
||||
kTestPoints[0], 10.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix2);
|
||||
TestNotEquals(*source1, *source2, "Matrix differs");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ConicalGradientConstructor) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ConicalGradientShared) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->shared().get(), source.get());
|
||||
ASSERT_EQ(*source->shared().get(), *source.get());
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ConicalGradientAsConical) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->asConicalGradient(), nullptr);
|
||||
ASSERT_EQ(source->asConicalGradient(), source.get());
|
||||
|
||||
@@ -636,128 +637,128 @@ TEST(DisplayListColorSource, ConicalGradientAsConical) {
|
||||
|
||||
TEST(DisplayListColorSource, ConicalGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asConicalGradient()->start_center(), TestPoints[0]);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asConicalGradient()->start_center(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asConicalGradient()->start_radius(), 10.0);
|
||||
ASSERT_EQ(source->asConicalGradient()->end_center(), TestPoints[1]);
|
||||
ASSERT_EQ(source->asConicalGradient()->end_center(), kTestPoints[1]);
|
||||
ASSERT_EQ(source->asConicalGradient()->end_radius(), 20.0);
|
||||
ASSERT_EQ(source->asConicalGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asConicalGradient()->colors()[i], TestColors[i]);
|
||||
ASSERT_EQ(source->asConicalGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asConicalGradient()->colors()[i], kTestColors[i]);
|
||||
ASSERT_EQ(source->asConicalGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asConicalGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asConicalGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asConicalGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), true);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, AlphaConicalGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestAlphaColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asConicalGradient()->start_center(), TestPoints[0]);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount,
|
||||
kTestAlphaColors, kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asConicalGradient()->start_center(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asConicalGradient()->start_radius(), 10.0);
|
||||
ASSERT_EQ(source->asConicalGradient()->end_center(), TestPoints[1]);
|
||||
ASSERT_EQ(source->asConicalGradient()->end_center(), kTestPoints[1]);
|
||||
ASSERT_EQ(source->asConicalGradient()->end_radius(), 20.0);
|
||||
ASSERT_EQ(source->asConicalGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asConicalGradient()->colors()[i], TestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asConicalGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asConicalGradient()->colors()[i], kTestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asConicalGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asConicalGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asConicalGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asConicalGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ConicalGradientEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestEquals(*source1, *source2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, ConicalGradientNotEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints2[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints2[0], 10.0, kTestPoints[1], 20.0, kTestStopCount,
|
||||
kTestColors, kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Start Center differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 15.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 15.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Start Radius differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints2[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints2[1], 20.0, kTestStopCount,
|
||||
kTestColors, kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "End Center differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 25.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 25.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "End Radius differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, 2, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, 2, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stop count differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount,
|
||||
TestAlphaColors, TestStops, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount,
|
||||
kTestAlphaColors, kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Colors differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops2, DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops2, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stops differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kMirror, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kMirror, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Tile Mode differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeConical(
|
||||
TestPoints[0], 10.0, TestPoints[1], 20.0, kTestStopCount, TestColors,
|
||||
TestStops, DlTileMode::kClamp, &TestMatrix2);
|
||||
kTestPoints[0], 10.0, kTestPoints[1], 20.0, kTestStopCount, kTestColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix2);
|
||||
TestNotEquals(*source1, *source2, "Matrix differs");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, SweepGradientConstructor) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, SweepGradientShared) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->shared().get(), source.get());
|
||||
ASSERT_EQ(*source->shared().get(), *source.get());
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, SweepGradientAsSweep) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_NE(source->asSweepGradient(), nullptr);
|
||||
ASSERT_EQ(source->asSweepGradient(), source.get());
|
||||
|
||||
@@ -770,114 +771,114 @@ TEST(DisplayListColorSource, SweepGradientAsSweep) {
|
||||
|
||||
TEST(DisplayListColorSource, SweepGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asSweepGradient()->center(), TestPoints[0]);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asSweepGradient()->center(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asSweepGradient()->start(), 10.0);
|
||||
ASSERT_EQ(source->asSweepGradient()->end(), 20.0);
|
||||
ASSERT_EQ(source->asSweepGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asSweepGradient()->colors()[i], TestColors[i]);
|
||||
ASSERT_EQ(source->asSweepGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asSweepGradient()->colors()[i], kTestColors[i]);
|
||||
ASSERT_EQ(source->asSweepGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asSweepGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asSweepGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asSweepGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), true);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, AlphaSweepGradientContents) {
|
||||
std::shared_ptr<DlColorSource> source = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestAlphaColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
ASSERT_EQ(source->asSweepGradient()->center(), TestPoints[0]);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestAlphaColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
ASSERT_EQ(source->asSweepGradient()->center(), kTestPoints[0]);
|
||||
ASSERT_EQ(source->asSweepGradient()->start(), 10.0);
|
||||
ASSERT_EQ(source->asSweepGradient()->end(), 20.0);
|
||||
ASSERT_EQ(source->asSweepGradient()->stop_count(), kTestStopCount);
|
||||
for (int i = 0; i < kTestStopCount; i++) {
|
||||
ASSERT_EQ(source->asSweepGradient()->colors()[i], TestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asSweepGradient()->stops()[i], TestStops[i]);
|
||||
ASSERT_EQ(source->asSweepGradient()->colors()[i], kTestAlphaColors[i]);
|
||||
ASSERT_EQ(source->asSweepGradient()->stops()[i], kTestStops[i]);
|
||||
}
|
||||
ASSERT_EQ(source->asSweepGradient()->tile_mode(), DlTileMode::kClamp);
|
||||
ASSERT_EQ(source->asSweepGradient()->matrix(), TestMatrix1);
|
||||
ASSERT_EQ(source->asSweepGradient()->matrix(), kTestMatrix1);
|
||||
ASSERT_EQ(source->is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, SweepGradientEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestEquals(*source1, *source2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, SweepGradientNotEquals) {
|
||||
std::shared_ptr<DlColorSource> source1 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints2[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints2[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Center differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 15.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 15.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Start Angle differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 25.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 25.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "End Angle differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, 2, TestColors, TestStops, //
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, 2, kTestColors, kTestStops, //
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stop count differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestAlphaColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestAlphaColors,
|
||||
kTestStops, DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Colors differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops2,
|
||||
DlTileMode::kClamp, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops2,
|
||||
DlTileMode::kClamp, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Stops differ");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kMirror, &TestMatrix1);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kMirror, &kTestMatrix1);
|
||||
TestNotEquals(*source1, *source2, "Tile Mode differs");
|
||||
}
|
||||
{
|
||||
std::shared_ptr<DlColorSource> source2 = DlColorSource::MakeSweep(
|
||||
TestPoints[0], 10.0, 20.0, kTestStopCount, TestColors, TestStops,
|
||||
DlTileMode::kClamp, &TestMatrix2);
|
||||
kTestPoints[0], 10.0, 20.0, kTestStopCount, kTestColors, kTestStops,
|
||||
DlTileMode::kClamp, &kTestMatrix2);
|
||||
TestNotEquals(*source1, *source2, "Matrix differs");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, UnknownConstructor) {
|
||||
DlUnknownColorSource source(TestUnknownShader);
|
||||
DlUnknownColorSource source(kTestUnknownShader);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, UnknownShared) {
|
||||
DlUnknownColorSource source(TestUnknownShader);
|
||||
DlUnknownColorSource source(kTestUnknownShader);
|
||||
ASSERT_NE(source.shared().get(), &source);
|
||||
ASSERT_EQ(*source.shared(), source);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, UnknownAsNone) {
|
||||
DlUnknownColorSource source(TestUnknownShader);
|
||||
DlUnknownColorSource source(kTestUnknownShader);
|
||||
ASSERT_EQ(source.asColor(), nullptr);
|
||||
ASSERT_EQ(source.asImage(), nullptr);
|
||||
ASSERT_EQ(source.asLinearGradient(), nullptr);
|
||||
@@ -887,28 +888,28 @@ TEST(DisplayListColorSource, UnknownAsNone) {
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, UnknownContents) {
|
||||
DlUnknownColorSource source(TestUnknownShader);
|
||||
ASSERT_EQ(source.skia_object(), TestUnknownShader);
|
||||
DlUnknownColorSource source(kTestUnknownShader);
|
||||
ASSERT_EQ(source.skia_object(), kTestUnknownShader);
|
||||
// Blend shaders always return false for is_opaque.
|
||||
// See: https://bugs.chromium.org/p/skia/issues/detail?id=13046
|
||||
ASSERT_EQ(source.is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, AlphaUnknownContents) {
|
||||
DlUnknownColorSource source(TestAlphaUnknownShader);
|
||||
ASSERT_EQ(source.skia_object(), TestAlphaUnknownShader);
|
||||
DlUnknownColorSource source(kTestAlphaUnknownShader);
|
||||
ASSERT_EQ(source.skia_object(), kTestAlphaUnknownShader);
|
||||
ASSERT_EQ(source.is_opaque(), false);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, UnknownEquals) {
|
||||
DlUnknownColorSource source1(TestUnknownShader);
|
||||
DlUnknownColorSource source2(TestUnknownShader);
|
||||
DlUnknownColorSource source1(kTestUnknownShader);
|
||||
DlUnknownColorSource source2(kTestUnknownShader);
|
||||
TestEquals(source1, source2);
|
||||
}
|
||||
|
||||
TEST(DisplayListColorSource, UnknownNotEquals) {
|
||||
DlUnknownColorSource source1(TestUnknownShader);
|
||||
DlUnknownColorSource source2(TestAlphaUnknownShader);
|
||||
DlUnknownColorSource source1(kTestUnknownShader);
|
||||
DlUnknownColorSource source2(kTestAlphaUnknownShader);
|
||||
TestNotEquals(source1, source2, "SkShader differs");
|
||||
}
|
||||
|
||||
|
||||
@@ -20,31 +20,31 @@
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
constexpr SkPoint end_points[] = {
|
||||
constexpr SkPoint kEndPoints[] = {
|
||||
{0, 0},
|
||||
{100, 100},
|
||||
};
|
||||
const DlColor colors[] = {
|
||||
const DlColor kColors[] = {
|
||||
DlColor::kGreen(),
|
||||
DlColor::kYellow(),
|
||||
DlColor::kBlue(),
|
||||
};
|
||||
constexpr float stops[] = {
|
||||
constexpr float kStops[] = {
|
||||
0.0,
|
||||
0.5,
|
||||
1.0,
|
||||
};
|
||||
std::vector<uint32_t> color_vector(colors, colors + 3);
|
||||
std::vector<float> stops_vector(stops, stops + 3);
|
||||
std::vector<uint32_t> color_vector(kColors, kColors + 3);
|
||||
std::vector<float> stops_vector(kStops, kStops + 3);
|
||||
|
||||
// clang-format off
|
||||
constexpr float rotate_color_matrix[20] = {
|
||||
constexpr float kRotateColorMatrix[20] = {
|
||||
0, 1, 0, 0, 0,
|
||||
0, 0, 1, 0, 0,
|
||||
1, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 0,
|
||||
};
|
||||
constexpr float invert_color_matrix[20] = {
|
||||
constexpr float kInvertColorMatrix[20] = {
|
||||
-1.0, 0, 0, 1.0, 0,
|
||||
0, -1.0, 0, 1.0, 0,
|
||||
0, 0, -1.0, 1.0, 0,
|
||||
@@ -52,8 +52,8 @@ constexpr float invert_color_matrix[20] = {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
const SkScalar TestDashes1[] = {4.0, 2.0};
|
||||
const SkScalar TestDashes2[] = {1.0, 1.5};
|
||||
const SkScalar kTestDashes1[] = {4.0, 2.0};
|
||||
const SkScalar kTestDashes2[] = {1.0, 1.5};
|
||||
|
||||
constexpr SkPoint TestPoints[] = {
|
||||
{10, 10},
|
||||
@@ -63,9 +63,9 @@ constexpr SkPoint TestPoints[] = {
|
||||
};
|
||||
#define TestPointCount sizeof(TestPoints) / (sizeof(TestPoints[0]))
|
||||
|
||||
static const SkSamplingOptions NearestSampling =
|
||||
static const SkSamplingOptions kNearestSampling =
|
||||
SkSamplingOptions(SkFilterMode::kNearest, SkMipmapMode::kNone);
|
||||
static const SkSamplingOptions LinearSampling =
|
||||
static const SkSamplingOptions kLinearSampling =
|
||||
SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNone);
|
||||
|
||||
static sk_sp<DlImage> MakeTestImage(int w, int h, int checker_size) {
|
||||
@@ -90,132 +90,137 @@ static sk_sp<DlImage> MakeTestImage(int w, int h, int checker_size) {
|
||||
static auto TestImage1 = MakeTestImage(40, 40, 5);
|
||||
static auto TestImage2 = MakeTestImage(50, 50, 5);
|
||||
|
||||
static const sk_sp<SkBlender> TestBlender1 =
|
||||
static const sk_sp<SkBlender> kTestBlender1 =
|
||||
SkBlenders::Arithmetic(0.2, 0.2, 0.2, 0.2, false);
|
||||
static const sk_sp<SkBlender> TestBlender2 =
|
||||
static const sk_sp<SkBlender> kTestBlender2 =
|
||||
SkBlenders::Arithmetic(0.2, 0.2, 0.2, 0.2, true);
|
||||
static const sk_sp<SkBlender> TestBlender3 =
|
||||
static const sk_sp<SkBlender> kTestBlender3 =
|
||||
SkBlenders::Arithmetic(0.3, 0.3, 0.3, 0.3, true);
|
||||
static const DlImageColorSource TestSource1(TestImage1->skia_image(),
|
||||
DlTileMode::kClamp,
|
||||
DlTileMode::kMirror,
|
||||
LinearSampling);
|
||||
static const std::shared_ptr<DlColorSource> TestSource2 =
|
||||
DlColorSource::MakeLinear(end_points[0],
|
||||
end_points[1],
|
||||
static const DlImageColorSource kTestSource1(TestImage1->skia_image(),
|
||||
DlTileMode::kClamp,
|
||||
DlTileMode::kMirror,
|
||||
kLinearSampling);
|
||||
static const std::shared_ptr<DlColorSource> kTestSource2 =
|
||||
DlColorSource::MakeLinear(kEndPoints[0],
|
||||
kEndPoints[1],
|
||||
3,
|
||||
colors,
|
||||
stops,
|
||||
kColors,
|
||||
kStops,
|
||||
DlTileMode::kMirror);
|
||||
static const std::shared_ptr<DlColorSource> TestSource3 =
|
||||
DlColorSource::MakeRadial(end_points[0],
|
||||
static const std::shared_ptr<DlColorSource> kTestSource3 =
|
||||
DlColorSource::MakeRadial(kEndPoints[0],
|
||||
10.0,
|
||||
3,
|
||||
colors,
|
||||
stops,
|
||||
kColors,
|
||||
kStops,
|
||||
DlTileMode::kMirror);
|
||||
static const std::shared_ptr<DlColorSource> TestSource4 =
|
||||
DlColorSource::MakeConical(end_points[0],
|
||||
static const std::shared_ptr<DlColorSource> kTestSource4 =
|
||||
DlColorSource::MakeConical(kEndPoints[0],
|
||||
10.0,
|
||||
end_points[1],
|
||||
kEndPoints[1],
|
||||
200.0,
|
||||
3,
|
||||
colors,
|
||||
stops,
|
||||
kColors,
|
||||
kStops,
|
||||
DlTileMode::kDecal);
|
||||
static const std::shared_ptr<DlColorSource> TestSource5 =
|
||||
DlColorSource::MakeSweep(end_points[0],
|
||||
static const std::shared_ptr<DlColorSource> kTestSource5 =
|
||||
DlColorSource::MakeSweep(kEndPoints[0],
|
||||
0.0,
|
||||
360.0,
|
||||
3,
|
||||
colors,
|
||||
stops,
|
||||
kColors,
|
||||
kStops,
|
||||
DlTileMode::kDecal);
|
||||
static const DlBlendColorFilter TestBlendColorFilter1(DlColor::kRed(),
|
||||
DlBlendMode::kDstATop);
|
||||
static const DlBlendColorFilter TestBlendColorFilter2(DlColor::kBlue(),
|
||||
DlBlendMode::kDstATop);
|
||||
static const DlBlendColorFilter TestBlendColorFilter3(DlColor::kRed(),
|
||||
DlBlendMode::kDstIn);
|
||||
static const DlMatrixColorFilter TestMatrixColorFilter1(rotate_color_matrix);
|
||||
static const DlMatrixColorFilter TestMatrixColorFilter2(invert_color_matrix);
|
||||
static const DlBlurImageFilter TestBlurImageFilter1(5.0,
|
||||
5.0,
|
||||
DlTileMode::kClamp);
|
||||
static const DlBlurImageFilter TestBlurImageFilter2(6.0,
|
||||
5.0,
|
||||
DlTileMode::kClamp);
|
||||
static const DlBlurImageFilter TestBlurImageFilter3(5.0,
|
||||
6.0,
|
||||
DlTileMode::kClamp);
|
||||
static const DlBlurImageFilter TestBlurImageFilter4(5.0,
|
||||
5.0,
|
||||
DlTileMode::kDecal);
|
||||
static const DlDilateImageFilter TestDilateImageFilter1(5.0, 5.0);
|
||||
static const DlDilateImageFilter TestDilateImageFilter2(6.0, 5.0);
|
||||
static const DlDilateImageFilter TestDilateImageFilter3(5.0, 6.0);
|
||||
static const DlErodeImageFilter TestErodeImageFilter1(5.0, 5.0);
|
||||
static const DlErodeImageFilter TestErodeImageFilter2(6.0, 5.0);
|
||||
static const DlErodeImageFilter TestErodeImageFilter3(5.0, 6.0);
|
||||
static const DlMatrixImageFilter TestMatrixImageFilter1(SkMatrix::RotateDeg(45),
|
||||
NearestSampling);
|
||||
static const DlMatrixImageFilter TestMatrixImageFilter2(SkMatrix::RotateDeg(85),
|
||||
NearestSampling);
|
||||
static const DlMatrixImageFilter TestMatrixImageFilter3(SkMatrix::RotateDeg(45),
|
||||
LinearSampling);
|
||||
static const DlComposeImageFilter TestComposeImageFilter1(
|
||||
TestBlurImageFilter1,
|
||||
TestMatrixImageFilter1);
|
||||
static const DlComposeImageFilter TestComposeImageFilter2(
|
||||
TestBlurImageFilter2,
|
||||
TestMatrixImageFilter1);
|
||||
static const DlComposeImageFilter TestComposeImageFilter3(
|
||||
TestBlurImageFilter1,
|
||||
TestMatrixImageFilter2);
|
||||
static const DlColorFilterImageFilter TestCFImageFilter1(TestBlendColorFilter1);
|
||||
static const DlColorFilterImageFilter TestCFImageFilter2(TestBlendColorFilter2);
|
||||
static const std::shared_ptr<DlPathEffect> TestPathEffect1 =
|
||||
DlDashPathEffect::Make(TestDashes1, 2, 0.0f);
|
||||
static const std::shared_ptr<DlPathEffect> TestPathEffect2 =
|
||||
DlDashPathEffect::Make(TestDashes2, 2, 0.0f);
|
||||
static const DlBlurMaskFilter TestMaskFilter1(kNormal_SkBlurStyle, 3.0);
|
||||
static const DlBlurMaskFilter TestMaskFilter2(kNormal_SkBlurStyle, 5.0);
|
||||
static const DlBlurMaskFilter TestMaskFilter3(kSolid_SkBlurStyle, 3.0);
|
||||
static const DlBlurMaskFilter TestMaskFilter4(kInner_SkBlurStyle, 3.0);
|
||||
static const DlBlurMaskFilter TestMaskFilter5(kOuter_SkBlurStyle, 3.0);
|
||||
constexpr SkRect TestBounds = SkRect::MakeLTRB(10, 10, 50, 60);
|
||||
static const SkRRect TestRRect = SkRRect::MakeRectXY(TestBounds, 5, 5);
|
||||
static const SkRRect TestRRectRect = SkRRect::MakeRect(TestBounds);
|
||||
static const SkRRect TestInnerRRect =
|
||||
SkRRect::MakeRectXY(TestBounds.makeInset(5, 5), 2, 2);
|
||||
static const SkPath TestPathRect = SkPath::Rect(TestBounds);
|
||||
static const SkPath TestPathOval = SkPath::Oval(TestBounds);
|
||||
static const SkPath TestPath1 =
|
||||
static const DlBlendColorFilter kTestBlendColorFilter1(DlColor::kRed(),
|
||||
DlBlendMode::kDstATop);
|
||||
static const DlBlendColorFilter kTestBlendColorFilter2(DlColor::kBlue(),
|
||||
DlBlendMode::kDstATop);
|
||||
static const DlBlendColorFilter kTestBlendColorFilter3(DlColor::kRed(),
|
||||
DlBlendMode::kDstIn);
|
||||
static const DlMatrixColorFilter kTestMatrixColorFilter1(kRotateColorMatrix);
|
||||
static const DlMatrixColorFilter kTestMatrixColorFilter2(kInvertColorMatrix);
|
||||
static const DlBlurImageFilter kTestBlurImageFilter1(5.0,
|
||||
5.0,
|
||||
DlTileMode::kClamp);
|
||||
static const DlBlurImageFilter kTestBlurImageFilter2(6.0,
|
||||
5.0,
|
||||
DlTileMode::kClamp);
|
||||
static const DlBlurImageFilter kTestBlurImageFilter3(5.0,
|
||||
6.0,
|
||||
DlTileMode::kClamp);
|
||||
static const DlBlurImageFilter kTestBlurImageFilter4(5.0,
|
||||
5.0,
|
||||
DlTileMode::kDecal);
|
||||
static const DlDilateImageFilter kTestDilateImageFilter1(5.0, 5.0);
|
||||
static const DlDilateImageFilter kTestDilateImageFilter2(6.0, 5.0);
|
||||
static const DlDilateImageFilter kTestDilateImageFilter3(5.0, 6.0);
|
||||
static const DlErodeImageFilter kTestErodeImageFilter1(5.0, 5.0);
|
||||
static const DlErodeImageFilter kTestErodeImageFilter2(6.0, 5.0);
|
||||
static const DlErodeImageFilter kTestErodeImageFilter3(5.0, 6.0);
|
||||
static const DlMatrixImageFilter kTestMatrixImageFilter1(
|
||||
SkMatrix::RotateDeg(45),
|
||||
kNearestSampling);
|
||||
static const DlMatrixImageFilter kTestMatrixImageFilter2(
|
||||
SkMatrix::RotateDeg(85),
|
||||
kNearestSampling);
|
||||
static const DlMatrixImageFilter kTestMatrixImageFilter3(
|
||||
SkMatrix::RotateDeg(45),
|
||||
kLinearSampling);
|
||||
static const DlComposeImageFilter kTestComposeImageFilter1(
|
||||
kTestBlurImageFilter1,
|
||||
kTestMatrixImageFilter1);
|
||||
static const DlComposeImageFilter kTestComposeImageFilter2(
|
||||
kTestBlurImageFilter2,
|
||||
kTestMatrixImageFilter1);
|
||||
static const DlComposeImageFilter kTestComposeImageFilter3(
|
||||
kTestBlurImageFilter1,
|
||||
kTestMatrixImageFilter2);
|
||||
static const DlColorFilterImageFilter kTestCFImageFilter1(
|
||||
kTestBlendColorFilter1);
|
||||
static const DlColorFilterImageFilter kTestCFImageFilter2(
|
||||
kTestBlendColorFilter2);
|
||||
static const std::shared_ptr<DlPathEffect> kTestPathEffect1 =
|
||||
DlDashPathEffect::Make(kTestDashes1, 2, 0.0f);
|
||||
static const std::shared_ptr<DlPathEffect> kTestPathEffect2 =
|
||||
DlDashPathEffect::Make(kTestDashes2, 2, 0.0f);
|
||||
static const DlBlurMaskFilter kTestMaskFilter1(kNormal_SkBlurStyle, 3.0);
|
||||
static const DlBlurMaskFilter kTestMaskFilter2(kNormal_SkBlurStyle, 5.0);
|
||||
static const DlBlurMaskFilter kTestMaskFilter3(kSolid_SkBlurStyle, 3.0);
|
||||
static const DlBlurMaskFilter kTestMaskFilter4(kInner_SkBlurStyle, 3.0);
|
||||
static const DlBlurMaskFilter kTestMaskFilter5(kOuter_SkBlurStyle, 3.0);
|
||||
constexpr SkRect kTestBounds = SkRect::MakeLTRB(10, 10, 50, 60);
|
||||
static const SkRRect kTestRRect = SkRRect::MakeRectXY(kTestBounds, 5, 5);
|
||||
static const SkRRect kTestRRectRect = SkRRect::MakeRect(kTestBounds);
|
||||
static const SkRRect kTestInnerRRect =
|
||||
SkRRect::MakeRectXY(kTestBounds.makeInset(5, 5), 2, 2);
|
||||
static const SkPath kTestPathRect = SkPath::Rect(kTestBounds);
|
||||
static const SkPath kTestPathOval = SkPath::Oval(kTestBounds);
|
||||
static const SkPath kTestPath1 =
|
||||
SkPath::Polygon({{0, 0}, {10, 10}, {10, 0}, {0, 10}}, true);
|
||||
static const SkPath TestPath2 =
|
||||
static const SkPath kTestPath2 =
|
||||
SkPath::Polygon({{0, 0}, {10, 10}, {0, 10}, {10, 0}}, true);
|
||||
static const SkPath TestPath3 =
|
||||
static const SkPath kTestPath3 =
|
||||
SkPath::Polygon({{0, 0}, {10, 10}, {10, 0}, {0, 10}}, false);
|
||||
static const SkMatrix TestMatrix1 = SkMatrix::Scale(2, 2);
|
||||
static const SkMatrix TestMatrix2 = SkMatrix::RotateDeg(45);
|
||||
static const SkMatrix kTestMatrix1 = SkMatrix::Scale(2, 2);
|
||||
static const SkMatrix kTestMatrix2 = SkMatrix::RotateDeg(45);
|
||||
|
||||
static std::shared_ptr<const DlVertices> TestVertices1 =
|
||||
DlVertices::Make(DlVertexMode::kTriangles, //
|
||||
3,
|
||||
TestPoints,
|
||||
nullptr,
|
||||
colors);
|
||||
kColors);
|
||||
static std::shared_ptr<const DlVertices> TestVertices2 =
|
||||
DlVertices::Make(DlVertexMode::kTriangleFan, //
|
||||
3,
|
||||
TestPoints,
|
||||
nullptr,
|
||||
colors);
|
||||
kColors);
|
||||
|
||||
static constexpr int TestDivs1[] = {10, 20, 30};
|
||||
static constexpr int TestDivs2[] = {15, 20, 25};
|
||||
static constexpr int TestDivs3[] = {15, 25};
|
||||
static constexpr SkCanvas::Lattice::RectType TestRTypes[] = {
|
||||
static constexpr int kTestDivs1[] = {10, 20, 30};
|
||||
static constexpr int kTestDivs2[] = {15, 20, 25};
|
||||
static constexpr int kTestDivs3[] = {15, 25};
|
||||
static constexpr SkCanvas::Lattice::RectType kTestRTypes[] = {
|
||||
SkCanvas::Lattice::RectType::kDefault,
|
||||
SkCanvas::Lattice::RectType::kTransparent,
|
||||
SkCanvas::Lattice::RectType::kFixedColor,
|
||||
@@ -226,17 +231,17 @@ static constexpr SkCanvas::Lattice::RectType TestRTypes[] = {
|
||||
SkCanvas::Lattice::RectType::kTransparent,
|
||||
SkCanvas::Lattice::RectType::kFixedColor,
|
||||
};
|
||||
static constexpr SkColor TestLatticeColors[] = {
|
||||
static constexpr SkColor kTestLatticeColors[] = {
|
||||
SK_ColorBLUE, SK_ColorGREEN, SK_ColorYELLOW,
|
||||
SK_ColorBLUE, SK_ColorGREEN, SK_ColorYELLOW,
|
||||
SK_ColorBLUE, SK_ColorGREEN, SK_ColorYELLOW,
|
||||
};
|
||||
static constexpr SkIRect TestLatticeSrcRect = {1, 1, 39, 39};
|
||||
static constexpr SkIRect kTestLatticeSrcRect = {1, 1, 39, 39};
|
||||
|
||||
static sk_sp<SkPicture> MakeTestPicture(int w, int h, SkColor color) {
|
||||
SkPictureRecorder recorder;
|
||||
SkRTreeFactory rtree_factory;
|
||||
SkCanvas* cv = recorder.beginRecording(TestBounds, &rtree_factory);
|
||||
SkCanvas* cv = recorder.beginRecording(kTestBounds, &rtree_factory);
|
||||
SkPaint paint;
|
||||
paint.setColor(color);
|
||||
paint.setStyle(SkPaint::kFill_Style);
|
||||
@@ -378,51 +383,51 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
{ "SetBlendModeOrBlender", {
|
||||
{0, 8, 0, 0, [](DisplayListBuilder& b) {b.setBlendMode(DlBlendMode::kSrcIn);}},
|
||||
{0, 8, 0, 0, [](DisplayListBuilder& b) {b.setBlendMode(DlBlendMode::kDstIn);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setBlender(TestBlender1);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setBlender(TestBlender2);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setBlender(TestBlender3);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setBlender(kTestBlender1);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setBlender(kTestBlender2);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setBlender(kTestBlender3);}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setBlendMode(DlBlendMode::kSrcOver);}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setBlender(nullptr);}},
|
||||
}
|
||||
},
|
||||
{ "SetColorSource", {
|
||||
{0, 112, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(&TestSource1);}},
|
||||
{0, 112, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(&kTestSource1);}},
|
||||
// stop_count * (sizeof(float) + sizeof(uint32_t)) = 80
|
||||
{0, 80 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(TestSource2.get());}},
|
||||
{0, 80 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(TestSource3.get());}},
|
||||
{0, 88 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(TestSource4.get());}},
|
||||
{0, 80 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(TestSource5.get());}},
|
||||
{0, 80 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(kTestSource2.get());}},
|
||||
{0, 80 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(kTestSource3.get());}},
|
||||
{0, 88 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(kTestSource4.get());}},
|
||||
{0, 80 + 6 * 4, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(kTestSource5.get());}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setColorSource(nullptr);}},
|
||||
}
|
||||
},
|
||||
{ "SetImageFilter", {
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestBlurImageFilter1);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestBlurImageFilter2);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestBlurImageFilter3);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestBlurImageFilter4);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestDilateImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestDilateImageFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestDilateImageFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestErodeImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestErodeImageFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestErodeImageFilter3);}},
|
||||
{0, 80, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestMatrixImageFilter1);}},
|
||||
{0, 80, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestMatrixImageFilter2);}},
|
||||
{0, 80, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestMatrixImageFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestComposeImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestComposeImageFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestComposeImageFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestCFImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&TestCFImageFilter2);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestBlurImageFilter1);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestBlurImageFilter2);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestBlurImageFilter3);}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestBlurImageFilter4);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestDilateImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestDilateImageFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestDilateImageFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestErodeImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestErodeImageFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestErodeImageFilter3);}},
|
||||
{0, 80, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestMatrixImageFilter1);}},
|
||||
{0, 80, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestMatrixImageFilter2);}},
|
||||
{0, 80, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestMatrixImageFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestComposeImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestComposeImageFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestComposeImageFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestCFImageFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(&kTestCFImageFilter2);}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setImageFilter(nullptr);}},
|
||||
}
|
||||
},
|
||||
{ "SetColorFilter", {
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&TestBlendColorFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&TestBlendColorFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&TestBlendColorFilter3);}},
|
||||
{0, 96, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&TestMatrixColorFilter1);}},
|
||||
{0, 96, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&TestMatrixColorFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&kTestBlendColorFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&kTestBlendColorFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&kTestBlendColorFilter3);}},
|
||||
{0, 96, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&kTestMatrixColorFilter1);}},
|
||||
{0, 96, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(&kTestMatrixColorFilter2);}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(DlSrgbToLinearGammaColorFilter::instance.get());}},
|
||||
{0, 16, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(DlLinearToSrgbGammaColorFilter::instance.get());}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setColorFilter(nullptr);}},
|
||||
@@ -430,17 +435,17 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
},
|
||||
{ "SetPathEffect", {
|
||||
// sizeof(DlDashPathEffect) + 2 * sizeof(SkScalar)
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setPathEffect(TestPathEffect1.get());}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setPathEffect(TestPathEffect2.get());}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setPathEffect(kTestPathEffect1.get());}},
|
||||
{0, 32, 0, 0, [](DisplayListBuilder& b) {b.setPathEffect(kTestPathEffect2.get());}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setPathEffect(nullptr);}},
|
||||
}
|
||||
},
|
||||
{ "SetMaskFilter", {
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&TestMaskFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&TestMaskFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&TestMaskFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&TestMaskFilter4);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&TestMaskFilter5);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&kTestMaskFilter1);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&kTestMaskFilter2);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&kTestMaskFilter3);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&kTestMaskFilter4);}},
|
||||
{0, 24, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(&kTestMaskFilter5);}},
|
||||
{0, 0, 0, 0, [](DisplayListBuilder& b) {b.setMaskFilter(nullptr);}},
|
||||
}
|
||||
},
|
||||
@@ -473,14 +478,14 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
b.restore();
|
||||
}},
|
||||
{5, 104, 5, 104, [](DisplayListBuilder& b) {
|
||||
b.saveLayer(&TestBounds, false);
|
||||
b.saveLayer(&kTestBounds, false);
|
||||
b.clipRect({0, 0, 25, 25}, SkClipOp::kIntersect, true);
|
||||
b.drawRect({5, 5, 15, 15});
|
||||
b.drawRect({10, 10, 20, 20});
|
||||
b.restore();
|
||||
}},
|
||||
{5, 104, 5, 104, [](DisplayListBuilder& b) {
|
||||
b.saveLayer(&TestBounds, true);
|
||||
b.saveLayer(&kTestBounds, true);
|
||||
b.clipRect({0, 0, 25, 25}, SkClipOp::kIntersect, true);
|
||||
b.drawRect({5, 5, 15, 15});
|
||||
b.drawRect({10, 10, 20, 20});
|
||||
@@ -544,34 +549,34 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
}
|
||||
},
|
||||
{ "ClipRect", {
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(TestBounds, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(TestBounds.makeOffset(1, 1),
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(kTestBounds, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(kTestBounds.makeOffset(1, 1),
|
||||
SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(TestBounds, SkClipOp::kIntersect, false);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(TestBounds, SkClipOp::kDifference, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(TestBounds, SkClipOp::kDifference, false);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(kTestBounds, SkClipOp::kIntersect, false);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(kTestBounds, SkClipOp::kDifference, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipRect(kTestBounds, SkClipOp::kDifference, false);}},
|
||||
}
|
||||
},
|
||||
{ "ClipRRect", {
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(TestRRect, SkClipOp::kIntersect, true);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(TestRRect.makeOffset(1, 1),
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(kTestRRect, SkClipOp::kIntersect, true);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(kTestRRect.makeOffset(1, 1),
|
||||
SkClipOp::kIntersect, true);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(TestRRect, SkClipOp::kIntersect, false);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(TestRRect, SkClipOp::kDifference, true);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(TestRRect, SkClipOp::kDifference, false);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(kTestRRect, SkClipOp::kIntersect, false);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(kTestRRect, SkClipOp::kDifference, true);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipRRect(kTestRRect, SkClipOp::kDifference, false);}},
|
||||
}
|
||||
},
|
||||
{ "ClipPath", {
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPath1, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPath2, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPath3, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPath1, SkClipOp::kIntersect, false);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPath1, SkClipOp::kDifference, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPath1, SkClipOp::kDifference, false);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPath1, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPath2, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPath3, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPath1, SkClipOp::kIntersect, false);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPath1, SkClipOp::kDifference, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPath1, SkClipOp::kDifference, false);}},
|
||||
// clipPath(rect) becomes clipRect
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(TestPathRect, SkClipOp::kIntersect, true);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.clipPath(kTestPathRect, SkClipOp::kIntersect, true);}},
|
||||
// clipPath(oval) becomes clipRRect
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipPath(TestPathOval, SkClipOp::kIntersect, true);}},
|
||||
{1, 64, 1, 64, [](DisplayListBuilder& b) {b.clipPath(kTestPathOval, SkClipOp::kIntersect, true);}},
|
||||
}
|
||||
},
|
||||
{ "DrawPaint", {
|
||||
@@ -614,31 +619,31 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
}
|
||||
},
|
||||
{ "DrawRRect", {
|
||||
{1, 56, 1, 56, [](DisplayListBuilder& b) {b.drawRRect(TestRRect);}},
|
||||
{1, 56, 1, 56, [](DisplayListBuilder& b) {b.drawRRect(TestRRect.makeOffset(5, 5));}},
|
||||
{1, 56, 1, 56, [](DisplayListBuilder& b) {b.drawRRect(kTestRRect);}},
|
||||
{1, 56, 1, 56, [](DisplayListBuilder& b) {b.drawRRect(kTestRRect.makeOffset(5, 5));}},
|
||||
}
|
||||
},
|
||||
{ "DrawDRRect", {
|
||||
{1, 112, 1, 112, [](DisplayListBuilder& b) {b.drawDRRect(TestRRect, TestInnerRRect);}},
|
||||
{1, 112, 1, 112, [](DisplayListBuilder& b) {b.drawDRRect(TestRRect.makeOffset(5, 5),
|
||||
TestInnerRRect.makeOffset(4, 4));}},
|
||||
{1, 112, 1, 112, [](DisplayListBuilder& b) {b.drawDRRect(kTestRRect, kTestInnerRRect);}},
|
||||
{1, 112, 1, 112, [](DisplayListBuilder& b) {b.drawDRRect(kTestRRect.makeOffset(5, 5),
|
||||
kTestInnerRRect.makeOffset(4, 4));}},
|
||||
}
|
||||
},
|
||||
{ "DrawPath", {
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(TestPath1);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(TestPath2);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(TestPath3);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(TestPathRect);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(TestPathOval);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(kTestPath1);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(kTestPath2);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(kTestPath3);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(kTestPathRect);}},
|
||||
{1, 24, 1, 24, [](DisplayListBuilder& b) {b.drawPath(kTestPathOval);}},
|
||||
}
|
||||
},
|
||||
{ "DrawArc", {
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(TestBounds, 45, 270, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(TestBounds.makeOffset(1, 1),
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(kTestBounds, 45, 270, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(kTestBounds.makeOffset(1, 1),
|
||||
45, 270, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(TestBounds, 30, 270, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(TestBounds, 45, 260, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(TestBounds, 45, 270, true);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(kTestBounds, 30, 270, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(kTestBounds, 45, 260, false);}},
|
||||
{1, 32, 1, 32, [](DisplayListBuilder& b) {b.drawArc(kTestBounds, 45, 270, true);}},
|
||||
}
|
||||
},
|
||||
{ "DrawPoints", {
|
||||
@@ -667,30 +672,30 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
}
|
||||
},
|
||||
{ "DrawImage", {
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 10}, NearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 10}, NearestSampling, true);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {20, 10}, NearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 20}, NearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 10}, LinearSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage2, {10, 10}, NearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 10}, kNearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 10}, kNearestSampling, true);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {20, 10}, kNearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 20}, kNearestSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage1, {10, 10}, kLinearSampling, false);}},
|
||||
{1, 48, -1, 48, [](DisplayListBuilder& b) {b.drawImage(TestImage2, {10, 10}, kNearestSampling, false);}},
|
||||
}
|
||||
},
|
||||
{ "DrawImageRect", {
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
|
||||
NearestSampling, false);}},
|
||||
kNearestSampling, false);}},
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
|
||||
NearestSampling, true);}},
|
||||
kNearestSampling, true);}},
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
|
||||
NearestSampling, false,
|
||||
kNearestSampling, false,
|
||||
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint);}},
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage1, {10, 10, 25, 20}, {10, 10, 80, 80},
|
||||
NearestSampling, false);}},
|
||||
kNearestSampling, false);}},
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage1, {10, 10, 20, 20}, {10, 10, 85, 80},
|
||||
NearestSampling, false);}},
|
||||
kNearestSampling, false);}},
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage1, {10, 10, 20, 20}, {10, 10, 80, 80},
|
||||
LinearSampling, false);}},
|
||||
kLinearSampling, false);}},
|
||||
{1, 80, -1, 80, [](DisplayListBuilder& b) {b.drawImageRect(TestImage2, {10, 10, 15, 15}, {10, 10, 80, 80},
|
||||
NearestSampling, false);}},
|
||||
kNearestSampling, false);}},
|
||||
}
|
||||
},
|
||||
{ "DrawImageNine", {
|
||||
@@ -721,34 +726,34 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
// size = 64 + fXCount * 4 + fYCount * 4
|
||||
// if fColors and fRectTypes are not null, add (fXCount + 1) * (fYCount + 1) * 5
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);}},
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{10, 10, 40, 45}, SkFilterMode::kNearest, false);}},
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs2, TestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{kTestDivs2, kTestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);}},
|
||||
// One less yDiv does not change the allocation due to 8-byte alignment
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 2, nullptr, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 2, nullptr, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);}},
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kLinear, false);}},
|
||||
{1, 96, -1, 96, [](DisplayListBuilder& b) {b.setColor(SK_ColorMAGENTA);
|
||||
b.drawImageLattice(TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, true);}},
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage2,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, nullptr, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);}},
|
||||
// Supplying fBounds does not change size because the Op record always includes it
|
||||
{1, 88, -1, 88, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, &TestLatticeSrcRect, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, &kTestLatticeSrcRect, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);}},
|
||||
{1, 128, -1, 128, [](DisplayListBuilder& b) {b.drawImageLattice(TestImage1,
|
||||
{TestDivs3, TestDivs3, TestRTypes, 2, 2, nullptr, TestLatticeColors},
|
||||
{kTestDivs3, kTestDivs3, kTestRTypes, 2, 2, nullptr, kTestLatticeColors},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);}},
|
||||
}
|
||||
},
|
||||
@@ -757,51 +762,51 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
b.drawAtlas(TestImage1, xforms, texs, nullptr, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, nullptr, false);}},
|
||||
kNearestSampling, nullptr, false);}},
|
||||
{1, 48 + 32 + 32, -1, 48 + 32 + 32, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
b.drawAtlas(TestImage1, xforms, texs, nullptr, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, nullptr, true);}},
|
||||
kNearestSampling, nullptr, true);}},
|
||||
{1, 48 + 32 + 32, -1, 48 + 32 + 32, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {0, 1, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
b.drawAtlas(TestImage1, xforms, texs, nullptr, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, nullptr, false);}},
|
||||
kNearestSampling, nullptr, false);}},
|
||||
{1, 48 + 32 + 32, -1, 48 + 32 + 32, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 25, 30, 30} };
|
||||
b.drawAtlas(TestImage1, xforms, texs, nullptr, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, nullptr, false);}},
|
||||
kNearestSampling, nullptr, false);}},
|
||||
{1, 48 + 32 + 32, -1, 48 + 32 + 32, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
b.drawAtlas(TestImage1, xforms, texs, nullptr, 2, DlBlendMode::kSrcIn,
|
||||
LinearSampling, nullptr, false);}},
|
||||
kLinearSampling, nullptr, false);}},
|
||||
{1, 48 + 32 + 32, -1, 48 + 32 + 32, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
b.drawAtlas(TestImage1, xforms, texs, nullptr, 2, DlBlendMode::kDstIn,
|
||||
NearestSampling, nullptr, false);}},
|
||||
kNearestSampling, nullptr, false);}},
|
||||
{1, 64 + 32 + 32, -1, 64 + 32 + 32, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
static SkRect cullRect = { 0, 0, 200, 200 };
|
||||
b.drawAtlas(TestImage2, xforms, texs, nullptr, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, &cullRect, false);}},
|
||||
kNearestSampling, &cullRect, false);}},
|
||||
{1, 48 + 32 + 32 + 8, -1, 48 + 32 + 32 + 8, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
static DlColor colors[] = { DlColor::kBlue(), DlColor::kGreen() };
|
||||
b.drawAtlas(TestImage1, xforms, texs, colors, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, nullptr, false);}},
|
||||
kNearestSampling, nullptr, false);}},
|
||||
{1, 64 + 32 + 32 + 8, -1, 64 + 32 + 32 + 8, [](DisplayListBuilder& b) {
|
||||
static SkRSXform xforms[] = { {1, 0, 0, 0}, {0, 1, 0, 0} };
|
||||
static SkRect texs[] = { { 10, 10, 20, 20 }, {20, 20, 30, 30} };
|
||||
static DlColor colors[] = { DlColor::kBlue(), DlColor::kGreen() };
|
||||
static SkRect cullRect = { 0, 0, 200, 200 };
|
||||
b.drawAtlas(TestImage1, xforms, texs, colors, 2, DlBlendMode::kSrcIn,
|
||||
NearestSampling, &cullRect, false);}},
|
||||
kNearestSampling, &cullRect, false);}},
|
||||
}
|
||||
},
|
||||
{ "DrawPicture", {
|
||||
@@ -809,9 +814,9 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
{1, 16, -1, 16, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, nullptr, false);}},
|
||||
{1, 16, -1, 16, [](DisplayListBuilder& b) {b.drawPicture(TestPicture2, nullptr, false);}},
|
||||
{1, 16, -1, 16, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, nullptr, true);}},
|
||||
{1, 56, -1, 56, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, &TestMatrix1, false);}},
|
||||
{1, 56, -1, 56, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, &TestMatrix2, false);}},
|
||||
{1, 56, -1, 56, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, &TestMatrix1, true);}},
|
||||
{1, 56, -1, 56, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, &kTestMatrix1, false);}},
|
||||
{1, 56, -1, 56, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, &kTestMatrix2, false);}},
|
||||
{1, 56, -1, 56, [](DisplayListBuilder& b) {b.drawPicture(TestPicture1, &kTestMatrix1, true);}},
|
||||
}
|
||||
},
|
||||
{ "DrawDisplayList", {
|
||||
@@ -834,12 +839,12 @@ std::vector<DisplayListInvocationGroup> allGroups = {
|
||||
// See: https://bugs.chromium.org/p/skia/issues/detail?id=12125
|
||||
{ "DrawShadow", {
|
||||
// cv shadows are turned into an opaque ShadowRec which is not exposed
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(TestPath1, SK_ColorGREEN, 1.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(TestPath2, SK_ColorGREEN, 1.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(TestPath1, SK_ColorBLUE, 1.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(TestPath1, SK_ColorGREEN, 2.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(TestPath1, SK_ColorGREEN, 1.0, true, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(TestPath1, SK_ColorGREEN, 1.0, false, 2.5);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(kTestPath1, SK_ColorGREEN, 1.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(kTestPath2, SK_ColorGREEN, 1.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(kTestPath1, SK_ColorBLUE, 1.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(kTestPath1, SK_ColorGREEN, 2.0, false, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(kTestPath1, SK_ColorGREEN, 1.0, true, 1.0);}},
|
||||
{1, 32, -1, 32, [](DisplayListBuilder& b) {b.drawShadow(kTestPath1, SK_ColorGREEN, 1.0, false, 2.5);}},
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -1451,13 +1456,13 @@ TEST(DisplayList, SingleOpsMightSupportGroupOpacityWithOrWithoutBlendMode) {
|
||||
TestPoints);
|
||||
, false);
|
||||
RUN_TESTS2(builder.drawVertices(TestVertices1, DlBlendMode::kSrc);, false);
|
||||
RUN_TESTS(builder.drawImage(TestImage1, {0, 0}, LinearSampling, true););
|
||||
RUN_TESTS2(builder.drawImage(TestImage1, {0, 0}, LinearSampling, false);
|
||||
RUN_TESTS(builder.drawImage(TestImage1, {0, 0}, kLinearSampling, true););
|
||||
RUN_TESTS2(builder.drawImage(TestImage1, {0, 0}, kLinearSampling, false);
|
||||
, true);
|
||||
RUN_TESTS(builder.drawImageRect(TestImage1, {10, 10, 20, 20}, {0, 0, 10, 10},
|
||||
NearestSampling, true););
|
||||
kNearestSampling, true););
|
||||
RUN_TESTS2(builder.drawImageRect(TestImage1, {10, 10, 20, 20}, {0, 0, 10, 10},
|
||||
NearestSampling, false);
|
||||
kNearestSampling, false);
|
||||
, true);
|
||||
RUN_TESTS(builder.drawImageNine(TestImage2, {20, 20, 30, 30}, {0, 0, 20, 20},
|
||||
SkFilterMode::kLinear, true););
|
||||
@@ -1466,22 +1471,22 @@ TEST(DisplayList, SingleOpsMightSupportGroupOpacityWithOrWithoutBlendMode) {
|
||||
, true);
|
||||
RUN_TESTS(builder.drawImageLattice(
|
||||
TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, &TestLatticeSrcRect, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, &kTestLatticeSrcRect, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, true););
|
||||
RUN_TESTS2(builder.drawImageLattice(
|
||||
TestImage1,
|
||||
{TestDivs1, TestDivs1, nullptr, 3, 3, &TestLatticeSrcRect, nullptr},
|
||||
{kTestDivs1, kTestDivs1, nullptr, 3, 3, &kTestLatticeSrcRect, nullptr},
|
||||
{10, 10, 40, 40}, SkFilterMode::kNearest, false);
|
||||
, true);
|
||||
static SkRSXform xforms[] = {{1, 0, 0, 0}, {0, 1, 0, 0}};
|
||||
static SkRect texs[] = {{10, 10, 20, 20}, {20, 20, 30, 30}};
|
||||
RUN_TESTS2(
|
||||
builder.drawAtlas(TestImage1, xforms, texs, nullptr, 2,
|
||||
DlBlendMode::kSrcIn, NearestSampling, nullptr, true);
|
||||
DlBlendMode::kSrcIn, kNearestSampling, nullptr, true);
|
||||
, false);
|
||||
RUN_TESTS2(
|
||||
builder.drawAtlas(TestImage1, xforms, texs, nullptr, 2,
|
||||
DlBlendMode::kSrcIn, NearestSampling, nullptr, false);
|
||||
DlBlendMode::kSrcIn, kNearestSampling, nullptr, false);
|
||||
, false);
|
||||
RUN_TESTS(builder.drawPicture(TestPicture1, nullptr, true););
|
||||
RUN_TESTS2(builder.drawPicture(TestPicture1, nullptr, false);, true);
|
||||
@@ -1495,7 +1500,7 @@ TEST(DisplayList, SingleOpsMightSupportGroupOpacityWithOrWithoutBlendMode) {
|
||||
RUN_TESTS2(builder.drawDisplayList(display_list);, false);
|
||||
}
|
||||
RUN_TESTS(builder.drawTextBlob(TestBlob1, 0, 0););
|
||||
RUN_TESTS2(builder.drawShadow(TestPath1, SK_ColorBLACK, 1.0, false, 1.0);
|
||||
RUN_TESTS2(builder.drawShadow(kTestPath1, SK_ColorBLACK, 1.0, false, 1.0);
|
||||
, false);
|
||||
|
||||
#undef RUN_TESTS2
|
||||
@@ -1578,7 +1583,7 @@ TEST(DisplayList, SaveLayerBoundsSnapshotsImageFilter) {
|
||||
builder.saveLayer(nullptr, true);
|
||||
builder.drawRect({50, 50, 100, 100});
|
||||
// This image filter should be ignored since it was not set before saveLayer
|
||||
builder.setImageFilter(&TestBlurImageFilter1);
|
||||
builder.setImageFilter(&kTestBlurImageFilter1);
|
||||
builder.restore();
|
||||
SkRect bounds = builder.Build()->bounds();
|
||||
EXPECT_EQ(bounds, SkRect::MakeLTRB(50, 50, 100, 100));
|
||||
@@ -1702,7 +1707,7 @@ TEST(DisplayList, SaveLayerImageFilterPreventsOpacityOptimization) {
|
||||
|
||||
DisplayListBuilder builder;
|
||||
builder.setColor(SkColorSetARGB(127, 255, 255, 255));
|
||||
builder.setImageFilter(&TestBlurImageFilter1);
|
||||
builder.setImageFilter(&kTestBlurImageFilter1);
|
||||
builder.saveLayer(nullptr, true);
|
||||
builder.setImageFilter(nullptr);
|
||||
builder.drawRect({10, 10, 20, 20});
|
||||
@@ -1718,7 +1723,7 @@ TEST(DisplayList, SaveLayerColorFilterPreventsOpacityOptimization) {
|
||||
|
||||
DisplayListBuilder builder;
|
||||
builder.setColor(SkColorSetARGB(127, 255, 255, 255));
|
||||
builder.setColorFilter(&TestMatrixColorFilter1);
|
||||
builder.setColorFilter(&kTestMatrixColorFilter1);
|
||||
builder.saveLayer(nullptr, true);
|
||||
builder.setColorFilter(nullptr);
|
||||
builder.drawRect({10, 10, 20, 20});
|
||||
@@ -1752,7 +1757,7 @@ TEST(DisplayList, SaveLayerImageFilterOnChildSupportsOpacityOptimization) {
|
||||
DisplayListBuilder builder;
|
||||
builder.setColor(SkColorSetARGB(127, 255, 255, 255));
|
||||
builder.saveLayer(nullptr, true);
|
||||
builder.setImageFilter(&TestBlurImageFilter1);
|
||||
builder.setImageFilter(&kTestBlurImageFilter1);
|
||||
builder.drawRect({10, 10, 20, 20});
|
||||
builder.restore();
|
||||
|
||||
@@ -1767,7 +1772,7 @@ TEST(DisplayList, SaveLayerColorFilterOnChildPreventsOpacityOptimization) {
|
||||
DisplayListBuilder builder;
|
||||
builder.setColor(SkColorSetARGB(127, 255, 255, 255));
|
||||
builder.saveLayer(nullptr, true);
|
||||
builder.setColorFilter(&TestMatrixColorFilter1);
|
||||
builder.setColorFilter(&kTestMatrixColorFilter1);
|
||||
builder.drawRect({10, 10, 20, 20});
|
||||
builder.restore();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
namespace flutter {
|
||||
|
||||
// clang-format off
|
||||
constexpr float invert_color_matrix[20] = {
|
||||
constexpr float kInvertColorMatrix[20] = {
|
||||
-1.0, 0, 0, 1.0, 0,
|
||||
0, -1.0, 0, 1.0, 0,
|
||||
0, 0, -1.0, 1.0, 0,
|
||||
@@ -97,7 +97,7 @@ sk_sp<SkColorFilter> SkPaintDispatchHelper::makeColorFilter() const {
|
||||
return color_filter_ ? color_filter_->skia_object() : nullptr;
|
||||
}
|
||||
sk_sp<SkColorFilter> invert_filter =
|
||||
SkColorFilters::Matrix(invert_color_matrix);
|
||||
SkColorFilters::Matrix(kInvertColorMatrix);
|
||||
if (color_filter_) {
|
||||
invert_filter = invert_filter->makeComposed(color_filter_->skia_object());
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ DlVertices::DlVertices(DlVertexMode mode,
|
||||
offset += bytes;
|
||||
return ret;
|
||||
} else {
|
||||
return size_t(0);
|
||||
return static_cast<size_t>(0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ DlVertices::DlVertices(DlVertexMode mode,
|
||||
offset += bytes;
|
||||
return ret;
|
||||
} else {
|
||||
return size_t(0);
|
||||
return static_cast<size_t>(0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ static std::string GLESShaderNameToShaderKeyName(const std::string& name,
|
||||
}
|
||||
|
||||
ShaderLibraryGLES::ShaderLibraryGLES(
|
||||
std::vector<std::shared_ptr<fml::Mapping>> shader_libraries) {
|
||||
std::vector<std::shared_ptr<fml::Mapping>> shader_libraries)
|
||||
: is_valid_(true) {
|
||||
ShaderFunctionMap functions;
|
||||
UniqueID library_id;
|
||||
auto iterator = [&functions, &library_id](auto type, //
|
||||
@@ -81,7 +82,6 @@ ShaderLibraryGLES::ShaderLibraryGLES(
|
||||
}
|
||||
|
||||
functions_ = functions;
|
||||
is_valid_ = true;
|
||||
}
|
||||
|
||||
// |ShaderLibrary|
|
||||
|
||||
@@ -40,7 +40,7 @@ fml::RefPtr<ImageFilter> ImageFilter::Create() {
|
||||
return fml::MakeRefCounted<ImageFilter>();
|
||||
}
|
||||
|
||||
static const std::array<SkSamplingOptions, 4> filter_qualities = {
|
||||
static const std::array<SkSamplingOptions, 4> kFilterQualities = {
|
||||
SkSamplingOptions(SkFilterMode::kNearest, SkMipmapMode::kNone),
|
||||
SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kNone),
|
||||
SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear),
|
||||
@@ -49,12 +49,12 @@ static const std::array<SkSamplingOptions, 4> filter_qualities = {
|
||||
|
||||
SkSamplingOptions ImageFilter::SamplingFromIndex(int filterQualityIndex) {
|
||||
if (filterQualityIndex < 0) {
|
||||
return filter_qualities.front();
|
||||
return kFilterQualities.front();
|
||||
} else if (static_cast<size_t>(filterQualityIndex) >=
|
||||
filter_qualities.size()) {
|
||||
return filter_qualities.back();
|
||||
kFilterQualities.size()) {
|
||||
return kFilterQualities.back();
|
||||
} else {
|
||||
return filter_qualities[filterQualityIndex];
|
||||
return kFilterQualities[filterQualityIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ constexpr double kStrokeMiterLimitDefault = 4.0;
|
||||
|
||||
// A color matrix which inverts colors.
|
||||
// clang-format off
|
||||
constexpr float invert_colors[20] = {
|
||||
constexpr float kInvertColors[20] = {
|
||||
-1.0, 0, 0, 1.0, 0,
|
||||
0, -1.0, 0, 1.0, 0,
|
||||
0, 0, -1.0, 1.0, 0,
|
||||
@@ -156,7 +156,7 @@ const SkPaint* Paint::paint(SkPaint& paint) const {
|
||||
}
|
||||
|
||||
if (uint_data[kInvertColorIndex]) {
|
||||
sk_sp<SkColorFilter> invert_filter = SkColorFilters::Matrix(invert_colors);
|
||||
sk_sp<SkColorFilter> invert_filter = SkColorFilters::Matrix(kInvertColors);
|
||||
sk_sp<SkColorFilter> current_filter = paint.refColorFilter();
|
||||
if (current_filter) {
|
||||
invert_filter = invert_filter->makeComposed(current_filter);
|
||||
|
||||
@@ -32,75 +32,75 @@ namespace {
|
||||
|
||||
// TextStyle
|
||||
|
||||
const int tsLeadingDistributionIndex = 0;
|
||||
const int tsColorIndex = 1;
|
||||
const int tsTextDecorationIndex = 2;
|
||||
const int tsTextDecorationColorIndex = 3;
|
||||
const int tsTextDecorationStyleIndex = 4;
|
||||
const int tsFontWeightIndex = 5;
|
||||
const int tsFontStyleIndex = 6;
|
||||
const int tsTextBaselineIndex = 7;
|
||||
const int tsTextDecorationThicknessIndex = 8;
|
||||
const int tsFontFamilyIndex = 9;
|
||||
const int tsFontSizeIndex = 10;
|
||||
const int tsLetterSpacingIndex = 11;
|
||||
const int tsWordSpacingIndex = 12;
|
||||
const int tsHeightIndex = 13;
|
||||
const int tsLocaleIndex = 14;
|
||||
const int tsBackgroundIndex = 15;
|
||||
const int tsForegroundIndex = 16;
|
||||
const int tsTextShadowsIndex = 17;
|
||||
const int tsFontFeaturesIndex = 18;
|
||||
const int tsFontVariationsIndex = 19;
|
||||
const int kTSLeadingDistributionIndex = 0;
|
||||
const int kTSColorIndex = 1;
|
||||
const int kTSTextDecorationIndex = 2;
|
||||
const int kTSTextDecorationColorIndex = 3;
|
||||
const int kTSTextDecorationStyleIndex = 4;
|
||||
const int kTSFontWeightIndex = 5;
|
||||
const int kTSFontStyleIndex = 6;
|
||||
const int kTSTextBaselineIndex = 7;
|
||||
const int kTSTextDecorationThicknessIndex = 8;
|
||||
const int kTSFontFamilyIndex = 9;
|
||||
const int kTSFontSizeIndex = 10;
|
||||
const int kTSLetterSpacingIndex = 11;
|
||||
const int kTSWordSpacingIndex = 12;
|
||||
const int kTSHeightIndex = 13;
|
||||
const int kTSLocaleIndex = 14;
|
||||
const int kTSBackgroundIndex = 15;
|
||||
const int kTSForegroundIndex = 16;
|
||||
const int kTSTextShadowsIndex = 17;
|
||||
const int kTSFontFeaturesIndex = 18;
|
||||
const int kTSFontVariationsIndex = 19;
|
||||
|
||||
const int tsLeadingDistributionMask = 1 << tsLeadingDistributionIndex;
|
||||
const int tsColorMask = 1 << tsColorIndex;
|
||||
const int tsTextDecorationMask = 1 << tsTextDecorationIndex;
|
||||
const int tsTextDecorationColorMask = 1 << tsTextDecorationColorIndex;
|
||||
const int tsTextDecorationStyleMask = 1 << tsTextDecorationStyleIndex;
|
||||
const int tsTextDecorationThicknessMask = 1 << tsTextDecorationThicknessIndex;
|
||||
const int tsFontWeightMask = 1 << tsFontWeightIndex;
|
||||
const int tsFontStyleMask = 1 << tsFontStyleIndex;
|
||||
const int tsTextBaselineMask = 1 << tsTextBaselineIndex;
|
||||
const int tsFontFamilyMask = 1 << tsFontFamilyIndex;
|
||||
const int tsFontSizeMask = 1 << tsFontSizeIndex;
|
||||
const int tsLetterSpacingMask = 1 << tsLetterSpacingIndex;
|
||||
const int tsWordSpacingMask = 1 << tsWordSpacingIndex;
|
||||
const int tsHeightMask = 1 << tsHeightIndex;
|
||||
const int tsLocaleMask = 1 << tsLocaleIndex;
|
||||
const int tsBackgroundMask = 1 << tsBackgroundIndex;
|
||||
const int tsForegroundMask = 1 << tsForegroundIndex;
|
||||
const int tsTextShadowsMask = 1 << tsTextShadowsIndex;
|
||||
const int tsFontFeaturesMask = 1 << tsFontFeaturesIndex;
|
||||
const int tsFontVariationsMask = 1 << tsFontVariationsIndex;
|
||||
const int kTSLeadingDistributionMask = 1 << kTSLeadingDistributionIndex;
|
||||
const int kTSColorMask = 1 << kTSColorIndex;
|
||||
const int kTSTextDecorationMask = 1 << kTSTextDecorationIndex;
|
||||
const int kTSTextDecorationColorMask = 1 << kTSTextDecorationColorIndex;
|
||||
const int kTSTextDecorationStyleMask = 1 << kTSTextDecorationStyleIndex;
|
||||
const int kTSTextDecorationThicknessMask = 1 << kTSTextDecorationThicknessIndex;
|
||||
const int kTSFontWeightMask = 1 << kTSFontWeightIndex;
|
||||
const int kTSFontStyleMask = 1 << kTSFontStyleIndex;
|
||||
const int kTSTextBaselineMask = 1 << kTSTextBaselineIndex;
|
||||
const int kTSFontFamilyMask = 1 << kTSFontFamilyIndex;
|
||||
const int kTSFontSizeMask = 1 << kTSFontSizeIndex;
|
||||
const int kTSLetterSpacingMask = 1 << kTSLetterSpacingIndex;
|
||||
const int kTSWordSpacingMask = 1 << kTSWordSpacingIndex;
|
||||
const int kTSHeightMask = 1 << kTSHeightIndex;
|
||||
const int kTSLocaleMask = 1 << kTSLocaleIndex;
|
||||
const int kTSBackgroundMask = 1 << kTSBackgroundIndex;
|
||||
const int kTSForegroundMask = 1 << kTSForegroundIndex;
|
||||
const int kTSTextShadowsMask = 1 << kTSTextShadowsIndex;
|
||||
const int kTSFontFeaturesMask = 1 << kTSFontFeaturesIndex;
|
||||
const int kTSFontVariationsMask = 1 << kTSFontVariationsIndex;
|
||||
|
||||
// ParagraphStyle
|
||||
|
||||
const int psTextAlignIndex = 1;
|
||||
const int psTextDirectionIndex = 2;
|
||||
const int psFontWeightIndex = 3;
|
||||
const int psFontStyleIndex = 4;
|
||||
const int psMaxLinesIndex = 5;
|
||||
const int psTextHeightBehaviorIndex = 6;
|
||||
const int psFontFamilyIndex = 7;
|
||||
const int psFontSizeIndex = 8;
|
||||
const int psHeightIndex = 9;
|
||||
const int psStrutStyleIndex = 10;
|
||||
const int psEllipsisIndex = 11;
|
||||
const int psLocaleIndex = 12;
|
||||
const int kPSTextAlignIndex = 1;
|
||||
const int kPSTextDirectionIndex = 2;
|
||||
const int kPSFontWeightIndex = 3;
|
||||
const int kPSFontStyleIndex = 4;
|
||||
const int kPSMaxLinesIndex = 5;
|
||||
const int kPSTextHeightBehaviorIndex = 6;
|
||||
const int kPSFontFamilyIndex = 7;
|
||||
const int kPSFontSizeIndex = 8;
|
||||
const int kPSHeightIndex = 9;
|
||||
const int kPSStrutStyleIndex = 10;
|
||||
const int kPSEllipsisIndex = 11;
|
||||
const int kPSLocaleIndex = 12;
|
||||
|
||||
const int psTextAlignMask = 1 << psTextAlignIndex;
|
||||
const int psTextDirectionMask = 1 << psTextDirectionIndex;
|
||||
const int psFontWeightMask = 1 << psFontWeightIndex;
|
||||
const int psFontStyleMask = 1 << psFontStyleIndex;
|
||||
const int psMaxLinesMask = 1 << psMaxLinesIndex;
|
||||
const int psFontFamilyMask = 1 << psFontFamilyIndex;
|
||||
const int psFontSizeMask = 1 << psFontSizeIndex;
|
||||
const int psHeightMask = 1 << psHeightIndex;
|
||||
const int psTextHeightBehaviorMask = 1 << psTextHeightBehaviorIndex;
|
||||
const int psStrutStyleMask = 1 << psStrutStyleIndex;
|
||||
const int psEllipsisMask = 1 << psEllipsisIndex;
|
||||
const int psLocaleMask = 1 << psLocaleIndex;
|
||||
const int kPSTextAlignMask = 1 << kPSTextAlignIndex;
|
||||
const int kPSTextDirectionMask = 1 << kPSTextDirectionIndex;
|
||||
const int kPSFontWeightMask = 1 << kPSFontWeightIndex;
|
||||
const int kPSFontStyleMask = 1 << kPSFontStyleIndex;
|
||||
const int kPSMaxLinesMask = 1 << kPSMaxLinesIndex;
|
||||
const int kPSFontFamilyMask = 1 << kPSFontFamilyIndex;
|
||||
const int kPSFontSizeMask = 1 << kPSFontSizeIndex;
|
||||
const int kPSHeightMask = 1 << kPSHeightIndex;
|
||||
const int kPSTextHeightBehaviorMask = 1 << kPSTextHeightBehaviorIndex;
|
||||
const int kPSStrutStyleMask = 1 << kPSStrutStyleIndex;
|
||||
const int kPSEllipsisMask = 1 << kPSEllipsisIndex;
|
||||
const int kPSLocaleMask = 1 << kPSLocaleIndex;
|
||||
|
||||
// TextShadows decoding
|
||||
|
||||
@@ -121,23 +121,23 @@ constexpr uint32_t kBytesPerFontVariation = 8;
|
||||
constexpr uint32_t kFontVariationTagLength = 4;
|
||||
|
||||
// Strut decoding
|
||||
const int sFontWeightIndex = 0;
|
||||
const int sFontStyleIndex = 1;
|
||||
const int sFontFamilyIndex = 2;
|
||||
const int sLeadingDistributionIndex = 3;
|
||||
const int sFontSizeIndex = 4;
|
||||
const int sHeightIndex = 5;
|
||||
const int sLeadingIndex = 6;
|
||||
const int sForceStrutHeightIndex = 7;
|
||||
const int kSFontWeightIndex = 0;
|
||||
const int kSFontStyleIndex = 1;
|
||||
const int kSFontFamilyIndex = 2;
|
||||
const int kSLeadingDistributionIndex = 3;
|
||||
const int kSFontSizeIndex = 4;
|
||||
const int kSHeightIndex = 5;
|
||||
const int kSLeadingIndex = 6;
|
||||
const int kSForceStrutHeightIndex = 7;
|
||||
|
||||
const int sFontWeightMask = 1 << sFontWeightIndex;
|
||||
const int sFontStyleMask = 1 << sFontStyleIndex;
|
||||
const int sFontFamilyMask = 1 << sFontFamilyIndex;
|
||||
const int sLeadingDistributionMask = 1 << sLeadingDistributionIndex;
|
||||
const int sFontSizeMask = 1 << sFontSizeIndex;
|
||||
const int sHeightMask = 1 << sHeightIndex;
|
||||
const int sLeadingMask = 1 << sLeadingIndex;
|
||||
const int sForceStrutHeightMask = 1 << sForceStrutHeightIndex;
|
||||
const int kSFontWeightMask = 1 << kSFontWeightIndex;
|
||||
const int kSFontStyleMask = 1 << kSFontStyleIndex;
|
||||
const int kSFontFamilyMask = 1 << kSFontFamilyIndex;
|
||||
const int kSLeadingDistributionMask = 1 << kSLeadingDistributionIndex;
|
||||
const int kSFontSizeMask = 1 << kSFontSizeIndex;
|
||||
const int kSHeightMask = 1 << kSHeightIndex;
|
||||
const int kSLeadingMask = 1 << kSLeadingIndex;
|
||||
const int kSForceStrutHeightMask = 1 << kSForceStrutHeightIndex;
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -199,16 +199,16 @@ void decodeStrut(Dart_Handle strut_data,
|
||||
// any 32 bit ints. In addition, the order of decoding is the same order
|
||||
// as it is encoded, and the order is used to maintain consistency.
|
||||
size_t byte_count = 1;
|
||||
if (mask & sFontWeightMask) {
|
||||
if (mask & kSFontWeightMask) {
|
||||
paragraph_style.strut_font_weight =
|
||||
static_cast<txt::FontWeight>(uint8_data[byte_count++]);
|
||||
}
|
||||
if (mask & sFontStyleMask) {
|
||||
if (mask & kSFontStyleMask) {
|
||||
paragraph_style.strut_font_style =
|
||||
static_cast<txt::FontStyle>(uint8_data[byte_count++]);
|
||||
}
|
||||
|
||||
paragraph_style.strut_half_leading = mask & sLeadingDistributionMask;
|
||||
paragraph_style.strut_half_leading = mask & kSLeadingDistributionMask;
|
||||
|
||||
std::vector<float> float_data;
|
||||
float_data.resize((byte_data.length_in_bytes() - byte_count) / 4);
|
||||
@@ -216,22 +216,22 @@ void decodeStrut(Dart_Handle strut_data,
|
||||
static_cast<const char*>(byte_data.data()) + byte_count,
|
||||
byte_data.length_in_bytes() - byte_count);
|
||||
size_t float_count = 0;
|
||||
if (mask & sFontSizeMask) {
|
||||
if (mask & kSFontSizeMask) {
|
||||
paragraph_style.strut_font_size = float_data[float_count++];
|
||||
}
|
||||
if (mask & sHeightMask) {
|
||||
if (mask & kSHeightMask) {
|
||||
paragraph_style.strut_height = float_data[float_count++];
|
||||
paragraph_style.strut_has_height_override = true;
|
||||
}
|
||||
if (mask & sLeadingMask) {
|
||||
if (mask & kSLeadingMask) {
|
||||
paragraph_style.strut_leading = float_data[float_count++];
|
||||
}
|
||||
|
||||
// The boolean is stored as the last bit in the bitmask, as null
|
||||
// and false have the same behavior.
|
||||
paragraph_style.force_strut_height = mask & sForceStrutHeightMask;
|
||||
paragraph_style.force_strut_height = mask & kSForceStrutHeightMask;
|
||||
|
||||
if (mask & sFontFamilyMask) {
|
||||
if (mask & kSFontFamilyMask) {
|
||||
paragraph_style.strut_font_families = strut_font_families;
|
||||
} else {
|
||||
// Provide an empty font name so that the platform default font will be
|
||||
@@ -252,53 +252,54 @@ ParagraphBuilder::ParagraphBuilder(
|
||||
int32_t mask = encoded[0];
|
||||
txt::ParagraphStyle style;
|
||||
|
||||
if (mask & psTextAlignMask) {
|
||||
style.text_align = txt::TextAlign(encoded[psTextAlignIndex]);
|
||||
if (mask & kPSTextAlignMask) {
|
||||
style.text_align = static_cast<txt::TextAlign>(encoded[kPSTextAlignIndex]);
|
||||
}
|
||||
|
||||
if (mask & psTextDirectionMask) {
|
||||
style.text_direction = txt::TextDirection(encoded[psTextDirectionIndex]);
|
||||
if (mask & kPSTextDirectionMask) {
|
||||
style.text_direction =
|
||||
static_cast<txt::TextDirection>(encoded[kPSTextDirectionIndex]);
|
||||
}
|
||||
|
||||
if (mask & psFontWeightMask) {
|
||||
if (mask & kPSFontWeightMask) {
|
||||
style.font_weight =
|
||||
static_cast<txt::FontWeight>(encoded[psFontWeightIndex]);
|
||||
static_cast<txt::FontWeight>(encoded[kPSFontWeightIndex]);
|
||||
}
|
||||
|
||||
if (mask & psFontStyleMask) {
|
||||
style.font_style = static_cast<txt::FontStyle>(encoded[psFontStyleIndex]);
|
||||
if (mask & kPSFontStyleMask) {
|
||||
style.font_style = static_cast<txt::FontStyle>(encoded[kPSFontStyleIndex]);
|
||||
}
|
||||
|
||||
if (mask & psFontFamilyMask) {
|
||||
if (mask & kPSFontFamilyMask) {
|
||||
style.font_family = fontFamily;
|
||||
}
|
||||
|
||||
if (mask & psFontSizeMask) {
|
||||
if (mask & kPSFontSizeMask) {
|
||||
style.font_size = fontSize;
|
||||
}
|
||||
|
||||
if (mask & psHeightMask) {
|
||||
if (mask & kPSHeightMask) {
|
||||
style.height = height;
|
||||
style.has_height_override = true;
|
||||
}
|
||||
|
||||
if (mask & psTextHeightBehaviorMask) {
|
||||
style.text_height_behavior = encoded[psTextHeightBehaviorIndex];
|
||||
if (mask & kPSTextHeightBehaviorMask) {
|
||||
style.text_height_behavior = encoded[kPSTextHeightBehaviorIndex];
|
||||
}
|
||||
|
||||
if (mask & psStrutStyleMask) {
|
||||
if (mask & kPSStrutStyleMask) {
|
||||
decodeStrut(strutData, strutFontFamilies, style);
|
||||
}
|
||||
|
||||
if (mask & psMaxLinesMask) {
|
||||
style.max_lines = encoded[psMaxLinesIndex];
|
||||
if (mask & kPSMaxLinesMask) {
|
||||
style.max_lines = encoded[kPSMaxLinesIndex];
|
||||
}
|
||||
|
||||
if (mask & psEllipsisMask) {
|
||||
if (mask & kPSEllipsisMask) {
|
||||
style.ellipsis = ellipsis;
|
||||
}
|
||||
|
||||
if (mask & psLocaleMask) {
|
||||
if (mask & kPSLocaleMask) {
|
||||
style.locale = locale;
|
||||
}
|
||||
|
||||
@@ -412,70 +413,71 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded,
|
||||
// explicitly given.
|
||||
txt::TextStyle style = m_paragraphBuilder->PeekStyle();
|
||||
|
||||
style.half_leading = mask & tsLeadingDistributionMask;
|
||||
style.half_leading = mask & kTSLeadingDistributionMask;
|
||||
// Only change the style property from the previous value if a new explicitly
|
||||
// set value is available
|
||||
if (mask & tsColorMask) {
|
||||
style.color = encoded[tsColorIndex];
|
||||
if (mask & kTSColorMask) {
|
||||
style.color = encoded[kTSColorIndex];
|
||||
}
|
||||
|
||||
if (mask & tsTextDecorationMask) {
|
||||
if (mask & kTSTextDecorationMask) {
|
||||
style.decoration =
|
||||
static_cast<txt::TextDecoration>(encoded[tsTextDecorationIndex]);
|
||||
static_cast<txt::TextDecoration>(encoded[kTSTextDecorationIndex]);
|
||||
}
|
||||
|
||||
if (mask & tsTextDecorationColorMask) {
|
||||
style.decoration_color = encoded[tsTextDecorationColorIndex];
|
||||
if (mask & kTSTextDecorationColorMask) {
|
||||
style.decoration_color = encoded[kTSTextDecorationColorIndex];
|
||||
}
|
||||
|
||||
if (mask & tsTextDecorationStyleMask) {
|
||||
if (mask & kTSTextDecorationStyleMask) {
|
||||
style.decoration_style = static_cast<txt::TextDecorationStyle>(
|
||||
encoded[tsTextDecorationStyleIndex]);
|
||||
encoded[kTSTextDecorationStyleIndex]);
|
||||
}
|
||||
|
||||
if (mask & tsTextDecorationThicknessMask) {
|
||||
if (mask & kTSTextDecorationThicknessMask) {
|
||||
style.decoration_thickness_multiplier = decorationThickness;
|
||||
}
|
||||
|
||||
if (mask & tsTextBaselineMask) {
|
||||
if (mask & kTSTextBaselineMask) {
|
||||
// TODO(abarth): Implement TextBaseline. The CSS version of this
|
||||
// property wasn't wired up either.
|
||||
}
|
||||
|
||||
if (mask & (tsFontWeightMask | tsFontStyleMask | tsFontSizeMask |
|
||||
tsLetterSpacingMask | tsWordSpacingMask)) {
|
||||
if (mask & tsFontWeightMask) {
|
||||
if (mask & (kTSFontWeightMask | kTSFontStyleMask | kTSFontSizeMask |
|
||||
kTSLetterSpacingMask | kTSWordSpacingMask)) {
|
||||
if (mask & kTSFontWeightMask) {
|
||||
style.font_weight =
|
||||
static_cast<txt::FontWeight>(encoded[tsFontWeightIndex]);
|
||||
static_cast<txt::FontWeight>(encoded[kTSFontWeightIndex]);
|
||||
}
|
||||
|
||||
if (mask & tsFontStyleMask) {
|
||||
style.font_style = static_cast<txt::FontStyle>(encoded[tsFontStyleIndex]);
|
||||
if (mask & kTSFontStyleMask) {
|
||||
style.font_style =
|
||||
static_cast<txt::FontStyle>(encoded[kTSFontStyleIndex]);
|
||||
}
|
||||
|
||||
if (mask & tsFontSizeMask) {
|
||||
if (mask & kTSFontSizeMask) {
|
||||
style.font_size = fontSize;
|
||||
}
|
||||
|
||||
if (mask & tsLetterSpacingMask) {
|
||||
if (mask & kTSLetterSpacingMask) {
|
||||
style.letter_spacing = letterSpacing;
|
||||
}
|
||||
|
||||
if (mask & tsWordSpacingMask) {
|
||||
if (mask & kTSWordSpacingMask) {
|
||||
style.word_spacing = wordSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & tsHeightMask) {
|
||||
if (mask & kTSHeightMask) {
|
||||
style.height = height;
|
||||
style.has_height_override = true;
|
||||
}
|
||||
|
||||
if (mask & tsLocaleMask) {
|
||||
if (mask & kTSLocaleMask) {
|
||||
style.locale = locale;
|
||||
}
|
||||
|
||||
if (mask & tsBackgroundMask) {
|
||||
if (mask & kTSBackgroundMask) {
|
||||
Paint background(background_objects, background_data);
|
||||
if (background.isNotNull()) {
|
||||
SkPaint sk_paint;
|
||||
@@ -484,7 +486,7 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded,
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & tsForegroundMask) {
|
||||
if (mask & kTSForegroundMask) {
|
||||
Paint foreground(foreground_objects, foreground_data);
|
||||
if (foreground.isNotNull()) {
|
||||
SkPaint sk_paint;
|
||||
@@ -493,22 +495,22 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded,
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & tsTextShadowsMask) {
|
||||
if (mask & kTSTextShadowsMask) {
|
||||
decodeTextShadows(shadows_data, style.text_shadows);
|
||||
}
|
||||
|
||||
if (mask & tsFontFamilyMask) {
|
||||
if (mask & kTSFontFamilyMask) {
|
||||
// The child style's font families override the parent's font families.
|
||||
// If the child's fonts are not available, then the font collection will
|
||||
// use the system fallback fonts (not the parent's fonts).
|
||||
style.font_families = fontFamilies;
|
||||
}
|
||||
|
||||
if (mask & tsFontFeaturesMask) {
|
||||
if (mask & kTSFontFeaturesMask) {
|
||||
decodeFontFeatures(font_features_data, style.font_features);
|
||||
}
|
||||
|
||||
if (mask & tsFontVariationsMask) {
|
||||
if (mask & kTSFontVariationsMask) {
|
||||
decodeFontVariations(font_variations_data, style.font_variations);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
const std::string kernel_file_name = "plugin_registrant_kernel_blob.bin";
|
||||
const std::string elf_file_name = "plugin_registrant_app_elf_snapshot.so";
|
||||
const std::string kKernelFileName = "plugin_registrant_kernel_blob.bin";
|
||||
const std::string kElfFileName = "plugin_registrant_app_elf_snapshot.so";
|
||||
|
||||
class DartIsolateTest : public FixtureTest {
|
||||
public:
|
||||
DartIsolateTest() : FixtureTest(kernel_file_name, elf_file_name, "") {}
|
||||
DartIsolateTest() : FixtureTest(kKernelFileName, kElfFileName, "") {}
|
||||
|
||||
void OverrideDartPluginRegistrant(const std::string& override_value) {
|
||||
dart_plugin_registrant_library_ = override_value;
|
||||
@@ -84,7 +84,7 @@ TEST_F(DartIsolateTest, DartPluginRegistrantIsPresent) {
|
||||
);
|
||||
|
||||
auto kernel_path =
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kernel_file_name});
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kKernelFileName});
|
||||
auto isolate =
|
||||
RunDartCodeInIsolate(vm_ref, settings, task_runners,
|
||||
"mainForPluginRegistrantTest", {}, kernel_path);
|
||||
@@ -131,7 +131,7 @@ TEST_F(DartIsolateTest, DartPluginRegistrantFromBackgroundIsolate) {
|
||||
);
|
||||
|
||||
auto kernel_path =
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kernel_file_name});
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kKernelFileName});
|
||||
auto isolate = RunDartCodeInIsolate(
|
||||
vm_ref, settings, task_runners,
|
||||
"callDartPluginRegistrantFromBackgroundIsolate", {}, kernel_path);
|
||||
@@ -179,7 +179,7 @@ TEST_F(DartIsolateTest, DartPluginRegistrantNotFromBackgroundIsolate) {
|
||||
);
|
||||
|
||||
auto kernel_path =
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kernel_file_name});
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kKernelFileName});
|
||||
auto isolate = RunDartCodeInIsolate(
|
||||
vm_ref, settings, task_runners,
|
||||
"dontCallDartPluginRegistrantFromBackgroundIsolate", {}, kernel_path);
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
const std::string kernel_file_name = "no_plugin_registrant_kernel_blob.bin";
|
||||
const std::string elf_file_name = "no_plugin_registrant_app_elf_snapshot.so";
|
||||
const std::string kKernelFileName = "no_plugin_registrant_kernel_blob.bin";
|
||||
const std::string kElfFileName = "no_plugin_registrant_app_elf_snapshot.so";
|
||||
|
||||
class DartIsolateTest : public FixtureTest {
|
||||
public:
|
||||
DartIsolateTest() : FixtureTest(kernel_file_name, elf_file_name, "") {}
|
||||
DartIsolateTest() : FixtureTest(kKernelFileName, kElfFileName, "") {}
|
||||
};
|
||||
|
||||
TEST_F(DartIsolateTest, DartPluginRegistrantIsNotPresent) {
|
||||
@@ -58,7 +58,7 @@ TEST_F(DartIsolateTest, DartPluginRegistrantIsNotPresent) {
|
||||
);
|
||||
|
||||
auto kernel_path =
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kernel_file_name});
|
||||
fml::paths::JoinPaths({GetFixturesPath(), kKernelFileName});
|
||||
auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners, "main",
|
||||
{}, kernel_path);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ struct SwitchDesc {
|
||||
#if FLUTTER_RELEASE
|
||||
|
||||
// clang-format off
|
||||
static const std::string gAllowedDartFlags[] = {
|
||||
static const std::string kAllowedDartFlags[] = {
|
||||
"--enable-isolate-groups",
|
||||
"--no-enable-isolate-groups",
|
||||
"--lazy_async_stacks",
|
||||
@@ -50,7 +50,7 @@ static const std::string gAllowedDartFlags[] = {
|
||||
#else
|
||||
|
||||
// clang-format off
|
||||
static const std::string gAllowedDartFlags[] = {
|
||||
static const std::string kAllowedDartFlags[] = {
|
||||
"--enable-isolate-groups",
|
||||
"--no-enable-isolate-groups",
|
||||
"--enable_mirrors",
|
||||
@@ -167,8 +167,8 @@ static std::vector<std::string> ParseCommaDelimited(const std::string& input) {
|
||||
}
|
||||
|
||||
static bool IsAllowedDartVMFlag(const std::string& flag) {
|
||||
for (uint32_t i = 0; i < fml::size(gAllowedDartFlags); ++i) {
|
||||
const std::string& allowed = gAllowedDartFlags[i];
|
||||
for (uint32_t i = 0; i < fml::size(kAllowedDartFlags); ++i) {
|
||||
const std::string& allowed = kAllowedDartFlags[i];
|
||||
// Check that the prefix of the flag matches one of the allowed flags. This
|
||||
// is to handle cases where flags take arguments, such as in
|
||||
// "--max_profile_depth 1".
|
||||
|
||||
@@ -98,7 +98,7 @@ EncodableValue StandardCodecSerializer::ReadValue(
|
||||
void StandardCodecSerializer::WriteValue(const EncodableValue& value,
|
||||
ByteStreamWriter* stream) const {
|
||||
stream->WriteByte(static_cast<uint8_t>(EncodedTypeForValue(value)));
|
||||
// TODO: Consider replacing this this with a std::visitor.
|
||||
// TODO(cbracken): Consider replacing this this with std::visit.
|
||||
switch (value.index()) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
||||
@@ -66,9 +66,9 @@ JsonMethodCodec::DecodeMethodCallInternal(const uint8_t* message,
|
||||
|
||||
std::unique_ptr<std::vector<uint8_t>> JsonMethodCodec::EncodeMethodCallInternal(
|
||||
const MethodCall<rapidjson::Document>& method_call) const {
|
||||
// TODO: Consider revisiting the codec APIs to avoid the need to copy
|
||||
// everything when doing encoding (e.g., by having a version that takes
|
||||
// owership of the object to encode, so that it can be moved instead).
|
||||
// TODO(stuartmorgan): Consider revisiting the codec APIs to avoid the need
|
||||
// to copy everything when doing encoding (e.g., by having a version that
|
||||
// takes owership of the object to encode, so that it can be moved instead).
|
||||
rapidjson::Document message(rapidjson::kObjectType);
|
||||
auto& allocator = message.GetAllocator();
|
||||
rapidjson::Value name(method_call.method_name(), allocator);
|
||||
|
||||
@@ -67,10 +67,15 @@ static void IOSPlatformThreadConfigSetter(const fml::Thread::ThreadConfig& confi
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Public exported constants
|
||||
|
||||
NSString* const FlutterDefaultDartEntrypoint = nil;
|
||||
NSString* const FlutterDefaultInitialRoute = nil;
|
||||
NSString* const FlutterEngineWillDealloc = @"FlutterEngineWillDealloc";
|
||||
NSString* const FlutterKeyDataChannel = @"flutter/keydata";
|
||||
|
||||
#pragma mark - Internal constants
|
||||
|
||||
NSString* const kFlutterEngineWillDealloc = @"FlutterEngineWillDealloc";
|
||||
NSString* const kFlutterKeyDataChannel = @"flutter/keydata";
|
||||
static constexpr int kNumProfilerSamplesPerSec = 5;
|
||||
|
||||
@interface FlutterEngineRegistrar : NSObject <FlutterPluginRegistrar>
|
||||
@@ -233,7 +238,7 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
|
||||
}
|
||||
}];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:FlutterEngineWillDealloc
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kFlutterEngineWillDealloc
|
||||
object:self
|
||||
userInfo:nil];
|
||||
|
||||
@@ -352,7 +357,7 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
|
||||
callback(handled, userData);
|
||||
};
|
||||
|
||||
[self sendOnChannel:FlutterKeyDataChannel message:message binaryReply:response];
|
||||
[self sendOnChannel:kFlutterKeyDataChannel message:message binaryReply:response];
|
||||
}
|
||||
|
||||
- (void)ensureSemanticsEnabled {
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
|
||||
[center addObserver:self
|
||||
selector:@selector(onEngineWillBeDealloced:)
|
||||
name:FlutterEngineWillDealloc
|
||||
name:kFlutterEngineWillDealloc
|
||||
object:engine];
|
||||
|
||||
return engine;
|
||||
|
||||
@@ -227,7 +227,7 @@ FLUTTER_ASSERT_ARC
|
||||
id<NSObject> observer;
|
||||
@autoreleasepool {
|
||||
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar"];
|
||||
observer = [center addObserverForName:FlutterEngineWillDealloc
|
||||
observer = [center addObserverForName:kFlutterEngineWillDealloc
|
||||
object:engine
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification* note) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
|
||||
#import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
|
||||
|
||||
extern NSString* _Nonnull const FlutterEngineWillDealloc;
|
||||
extern NSString* _Nonnull const kFlutterEngineWillDealloc;
|
||||
|
||||
@interface FlutterEngine () <FlutterViewEngineDelegate>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
|
||||
#import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
|
||||
|
||||
extern NSString* const FlutterEngineWillDealloc;
|
||||
extern NSString* const kFlutterEngineWillDealloc;
|
||||
|
||||
@class FlutterBinaryMessengerRelay;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
static const char* kCallbackCacheSubDir = "Library/Caches/";
|
||||
|
||||
static const SEL selectorsHandledByPlugins[] = {
|
||||
static const SEL kSelectorsHandledByPlugins[] = {
|
||||
@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:),
|
||||
@selector(application:performFetchWithCompletionHandler:)};
|
||||
|
||||
@@ -76,7 +76,7 @@ static BOOL IsPowerOfTwo(NSUInteger x) {
|
||||
}
|
||||
|
||||
- (BOOL)isSelectorAddedDynamically:(SEL)selector {
|
||||
for (const SEL& aSelector : selectorsHandledByPlugins) {
|
||||
for (const SEL& aSelector : kSelectorsHandledByPlugins) {
|
||||
if (selector == aSelector) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "flutter/fml/platform/darwin/string_range_sanitization.h"
|
||||
|
||||
static const char _kTextAffinityDownstream[] = "TextAffinity.downstream";
|
||||
static const char _kTextAffinityUpstream[] = "TextAffinity.upstream";
|
||||
static const char kTextAffinityDownstream[] = "TextAffinity.downstream";
|
||||
static const char kTextAffinityUpstream[] = "TextAffinity.upstream";
|
||||
// A delay before enabling the accessibility of FlutterTextInputView after
|
||||
// it is activated.
|
||||
static constexpr double kUITextInputAccessibilityEnablingDelaySeconds = 0.5;
|
||||
@@ -744,7 +744,7 @@ static BOOL IsSelectionRectCloserToPoint(CGPoint point,
|
||||
if (self) {
|
||||
_textInputPlugin = textInputPlugin.weakPtr;
|
||||
_textInputClient = 0;
|
||||
_selectionAffinity = _kTextAffinityUpstream;
|
||||
_selectionAffinity = kTextAffinityUpstream;
|
||||
|
||||
// UITextInput
|
||||
_text = [[NSMutableString alloc] init];
|
||||
@@ -952,9 +952,9 @@ static BOOL IsSelectionRectCloserToPoint(CGPoint point,
|
||||
|
||||
[self setSelectedTextRangeLocal:[FlutterTextRange rangeWithNSRange:selectedRange]];
|
||||
|
||||
_selectionAffinity = _kTextAffinityDownstream;
|
||||
if ([state[@"selectionAffinity"] isEqualToString:@(_kTextAffinityUpstream)]) {
|
||||
_selectionAffinity = _kTextAffinityUpstream;
|
||||
_selectionAffinity = kTextAffinityDownstream;
|
||||
if ([state[@"selectionAffinity"] isEqualToString:@(kTextAffinityUpstream)]) {
|
||||
_selectionAffinity = kTextAffinityUpstream;
|
||||
}
|
||||
[self.inputDelegate selectionDidChange:self];
|
||||
}
|
||||
@@ -1848,7 +1848,7 @@ static BOOL IsSelectionRectCloserToPoint(CGPoint point,
|
||||
[self resetScribbleInteractionStatusIfEnding];
|
||||
self.selectionRects = copiedRects;
|
||||
[copiedRects release];
|
||||
_selectionAffinity = _kTextAffinityDownstream;
|
||||
_selectionAffinity = kTextAffinityDownstream;
|
||||
[self replaceRange:_selectedTextRange withText:text];
|
||||
}
|
||||
|
||||
@@ -1866,7 +1866,7 @@ static BOOL IsSelectionRectCloserToPoint(CGPoint point,
|
||||
}
|
||||
|
||||
- (void)deleteBackward {
|
||||
_selectionAffinity = _kTextAffinityDownstream;
|
||||
_selectionAffinity = kTextAffinityDownstream;
|
||||
_scribbleFocusStatus = FlutterScribbleFocusStatusUnfocused;
|
||||
[self resetScribbleInteractionStatusIfEnding];
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h"
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h"
|
||||
|
||||
static const UIAccessibilityTraits UIAccessibilityTraitUndocumentedEmptyLine = 0x800000000000;
|
||||
static const UIAccessibilityTraits kUIAccessibilityTraitUndocumentedEmptyLine = 0x800000000000;
|
||||
|
||||
@implementation FlutterInactiveTextInput {
|
||||
}
|
||||
@@ -313,7 +313,7 @@ static const UIAccessibilityTraits UIAccessibilityTraitUndocumentedEmptyLine = 0
|
||||
// We remove an undocumented flag to get rid of a bug where single-tapping
|
||||
// a text input field incorrectly says "empty line".
|
||||
// See also: https://github.com/flutter/flutter/issues/52487
|
||||
return results & (~UIAccessibilityTraitUndocumentedEmptyLine);
|
||||
return results & (~kUIAccessibilityTraitUndocumentedEmptyLine);
|
||||
}
|
||||
|
||||
#pragma mark - UITextInput overrides
|
||||
|
||||
@@ -199,4 +199,4 @@ TEST(AccessibilityBridgeMacDelegateTest, doesNotSendAccessibilityCreateNotificat
|
||||
[engine shutDownEngine];
|
||||
}
|
||||
|
||||
} // flutter::testing
|
||||
} // namespace flutter::testing
|
||||
|
||||
@@ -713,7 +713,7 @@ static flutter::TextRange RangeFromBaseExtent(NSNumber* base,
|
||||
}
|
||||
|
||||
- (NSUInteger)characterIndexForPoint:(NSPoint)point {
|
||||
// TODO: Implement.
|
||||
// TODO(cbracken): Implement.
|
||||
// Note: This function can't easily be implemented under the system-message architecture.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -214,4 +214,4 @@ void FlutterTextPlatformNode::EnsureDetachedFromView() {
|
||||
[appkit_text_field_ removeFromSuperview];
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace flutter
|
||||
|
||||
@@ -1201,7 +1201,7 @@ TEST_F(EmbedderTest, InvalidAOTDataSourcesMustReturnError) {
|
||||
ASSERT_EQ(FlutterEngineCreateAOTData(&data_in, nullptr), kInvalidArguments);
|
||||
|
||||
// Invalid FlutterEngineAOTDataSourceType type specified.
|
||||
data_in.type = FlutterEngineAOTDataSourceType(-1);
|
||||
data_in.type = static_cast<FlutterEngineAOTDataSourceType>(-1);
|
||||
ASSERT_EQ(FlutterEngineCreateAOTData(&data_in, &data_out), kInvalidArguments);
|
||||
ASSERT_EQ(data_out, nullptr);
|
||||
|
||||
@@ -1384,8 +1384,9 @@ TEST_F(EmbedderTest, KeyDataIsCorrectlySerialized) {
|
||||
echoed_event.type =
|
||||
UnserializeKeyEventKind(tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 0)));
|
||||
echoed_event.timestamp = (double)tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 1));
|
||||
echoed_event.timestamp =
|
||||
static_cast<double>(tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 1)));
|
||||
echoed_event.physical = tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 2));
|
||||
echoed_event.logical = tonic::DartConverter<uint64_t>::FromDart(
|
||||
@@ -1472,8 +1473,9 @@ TEST_F(EmbedderTest, KeyDataAreBuffered) {
|
||||
|
||||
auto native_echo_event = [&](Dart_NativeArguments args) {
|
||||
echoed_events.push_back(FlutterKeyEvent{
|
||||
.timestamp = (double)tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 1)),
|
||||
.timestamp =
|
||||
static_cast<double>(tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 1))),
|
||||
.type =
|
||||
UnserializeKeyEventKind(tonic::DartConverter<uint64_t>::FromDart(
|
||||
Dart_GetNativeArgument(args, 0))),
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
constexpr uint64_t kMicrosecondsPerMillisecond = 1000;
|
||||
|
||||
static const FlutterKeyEvent empty_event{
|
||||
static const FlutterKeyEvent kEmptyEvent{
|
||||
.struct_size = sizeof(FlutterKeyEvent),
|
||||
.timestamp = 0,
|
||||
.type = kFlutterKeyEventTypeDown,
|
||||
@@ -791,6 +791,6 @@ static void fl_key_embedder_responder_handle_event(
|
||||
fl_key_embedder_responder_handle_event_impl(
|
||||
responder, event, specified_logical_key, callback, user_data);
|
||||
if (!self->sent_any_events) {
|
||||
self->send_key_event(&empty_event, nullptr, nullptr);
|
||||
self->send_key_event(&kEmptyEvent, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
static constexpr uint32_t BUFFER_WIDTH = 4u;
|
||||
static constexpr uint32_t BUFFER_HEIGHT = 4u;
|
||||
static constexpr uint32_t REAL_BUFFER_WIDTH = 2u;
|
||||
static constexpr uint32_t REAL_BUFFER_HEIGHT = 2u;
|
||||
static constexpr uint32_t kBufferWidth = 4u;
|
||||
static constexpr uint32_t kBufferHeight = 4u;
|
||||
static constexpr uint32_t kRealBufferWidth = 2u;
|
||||
static constexpr uint32_t kRealBufferHeight = 2u;
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlTestPixelBufferTexture,
|
||||
fl_test_pixel_buffer_texture,
|
||||
@@ -44,11 +44,11 @@ static gboolean fl_test_pixel_buffer_texture_copy_pixels(
|
||||
static const uint8_t buffer[] = {0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a,
|
||||
0x6a, 0x7a, 0x8a, 0x9a, 0xaa, 0xba,
|
||||
0xca, 0xda, 0xea, 0xfa};
|
||||
EXPECT_EQ(*width, BUFFER_WIDTH);
|
||||
EXPECT_EQ(*height, BUFFER_HEIGHT);
|
||||
EXPECT_EQ(*width, kBufferWidth);
|
||||
EXPECT_EQ(*height, kBufferHeight);
|
||||
*out_buffer = buffer;
|
||||
*width = REAL_BUFFER_WIDTH;
|
||||
*height = REAL_BUFFER_HEIGHT;
|
||||
*width = kRealBufferWidth;
|
||||
*height = kRealBufferHeight;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -81,8 +81,8 @@ TEST(FlPixelBufferTextureTest, PopulateTexture) {
|
||||
FlutterOpenGLTexture opengl_texture = {0};
|
||||
g_autoptr(GError) error = nullptr;
|
||||
EXPECT_TRUE(fl_pixel_buffer_texture_populate(
|
||||
texture, BUFFER_WIDTH, BUFFER_HEIGHT, &opengl_texture, &error));
|
||||
texture, kBufferWidth, kBufferHeight, &opengl_texture, &error));
|
||||
EXPECT_EQ(error, nullptr);
|
||||
EXPECT_EQ(opengl_texture.width, REAL_BUFFER_WIDTH);
|
||||
EXPECT_EQ(opengl_texture.height, REAL_BUFFER_HEIGHT);
|
||||
EXPECT_EQ(opengl_texture.width, kRealBufferWidth);
|
||||
EXPECT_EQ(opengl_texture.height, kRealBufferHeight);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
static constexpr char kPortalName[] = "org.freedesktop.portal.Desktop";
|
||||
static constexpr char kPortalPath[] = "/org/freedesktop/portal/desktop";
|
||||
static constexpr char pPortalSettings[] = "org.freedesktop.portal.Settings";
|
||||
static constexpr char kPortalSettings[] = "org.freedesktop.portal.Settings";
|
||||
|
||||
struct FlSetting {
|
||||
const gchar* ns;
|
||||
@@ -41,7 +41,7 @@ static const FlSetting kTextScalingFactor = {
|
||||
G_VARIANT_TYPE_DOUBLE,
|
||||
};
|
||||
|
||||
static const FlSetting all_settings[] = {
|
||||
static const FlSetting kAllSettings[] = {
|
||||
kClockFormat,
|
||||
kColorScheme,
|
||||
kGtkTheme,
|
||||
@@ -240,13 +240,13 @@ gboolean fl_settings_portal_start(FlSettingsPortal* self, GError** error) {
|
||||
|
||||
self->dbus_proxy = g_dbus_proxy_new_for_bus_sync(
|
||||
G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, nullptr, kPortalName,
|
||||
kPortalPath, pPortalSettings, nullptr, error);
|
||||
kPortalPath, kPortalSettings, nullptr, error);
|
||||
|
||||
if (self->dbus_proxy == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FlSetting setting : all_settings) {
|
||||
for (const FlSetting setting : kAllSettings) {
|
||||
g_autoptr(GVariant) value = nullptr;
|
||||
if (settings_portal_read(self->dbus_proxy, setting.ns, setting.key,
|
||||
&value)) {
|
||||
@@ -256,7 +256,7 @@ gboolean fl_settings_portal_start(FlSettingsPortal* self, GError** error) {
|
||||
|
||||
g_signal_connect_object(self->dbus_proxy, "g-signal",
|
||||
G_CALLBACK(settings_portal_changed_cb), self,
|
||||
GConnectFlags(0));
|
||||
static_cast<GConnectFlags>(0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
static constexpr uint32_t BUFFER_WIDTH = 4u;
|
||||
static constexpr uint32_t BUFFER_HEIGHT = 4u;
|
||||
static constexpr uint32_t REAL_BUFFER_WIDTH = 2u;
|
||||
static constexpr uint32_t REAL_BUFFER_HEIGHT = 2u;
|
||||
static constexpr uint32_t kBufferWidth = 4u;
|
||||
static constexpr uint32_t kBufferHeight = 4u;
|
||||
static constexpr uint32_t kRealBufferWidth = 2u;
|
||||
static constexpr uint32_t kRealBufferHeight = 2u;
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlTestTexture,
|
||||
fl_test_texture,
|
||||
@@ -38,12 +38,12 @@ static gboolean fl_test_texture_populate(FlTextureGL* texture,
|
||||
GError** error) {
|
||||
EXPECT_TRUE(FL_IS_TEST_TEXTURE(texture));
|
||||
|
||||
EXPECT_EQ(*width, BUFFER_WIDTH);
|
||||
EXPECT_EQ(*height, BUFFER_HEIGHT);
|
||||
EXPECT_EQ(*width, kBufferWidth);
|
||||
EXPECT_EQ(*height, kBufferHeight);
|
||||
*target = GL_TEXTURE_2D;
|
||||
*name = 1;
|
||||
*width = REAL_BUFFER_WIDTH;
|
||||
*height = REAL_BUFFER_HEIGHT;
|
||||
*width = kRealBufferWidth;
|
||||
*height = kRealBufferHeight;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -71,9 +71,9 @@ TEST(FlTextureTest, PopulateTexture) {
|
||||
g_autoptr(FlTextureGL) texture = FL_TEXTURE_GL(fl_test_texture_new());
|
||||
FlutterOpenGLTexture opengl_texture = {0};
|
||||
g_autoptr(GError) error = nullptr;
|
||||
EXPECT_TRUE(fl_texture_gl_populate(texture, BUFFER_WIDTH, BUFFER_HEIGHT,
|
||||
EXPECT_TRUE(fl_texture_gl_populate(texture, kBufferWidth, kBufferHeight,
|
||||
&opengl_texture, &error));
|
||||
EXPECT_EQ(error, nullptr);
|
||||
EXPECT_EQ(opengl_texture.width, REAL_BUFFER_WIDTH);
|
||||
EXPECT_EQ(opengl_texture.height, REAL_BUFFER_HEIGHT);
|
||||
EXPECT_EQ(opengl_texture.width, kRealBufferWidth);
|
||||
EXPECT_EQ(opengl_texture.height, kRealBufferHeight);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
static constexpr uint32_t BUFFER_WIDTH = 4u;
|
||||
static constexpr uint32_t BUFFER_HEIGHT = 4u;
|
||||
static constexpr uint32_t REAL_BUFFER_WIDTH = 2u;
|
||||
static constexpr uint32_t REAL_BUFFER_HEIGHT = 2u;
|
||||
static constexpr uint32_t kBufferWidth = 4u;
|
||||
static constexpr uint32_t kBufferHeight = 4u;
|
||||
static constexpr uint32_t kRealBufferWidth = 2u;
|
||||
static constexpr uint32_t kRealBufferHeight = 2u;
|
||||
|
||||
G_DECLARE_FINAL_TYPE(FlTestRegistrarTexture,
|
||||
fl_test_registrar_texture,
|
||||
@@ -43,12 +43,12 @@ static gboolean fl_test_registrar_texture_populate(FlTextureGL* texture,
|
||||
GError** error) {
|
||||
EXPECT_TRUE(FL_IS_TEST_REGISTRAR_TEXTURE(texture));
|
||||
|
||||
EXPECT_EQ(*width, BUFFER_WIDTH);
|
||||
EXPECT_EQ(*height, BUFFER_HEIGHT);
|
||||
EXPECT_EQ(*width, kBufferWidth);
|
||||
EXPECT_EQ(*height, kBufferHeight);
|
||||
*target = GL_TEXTURE_2D;
|
||||
*format = GL_R8;
|
||||
*width = REAL_BUFFER_WIDTH;
|
||||
*height = REAL_BUFFER_HEIGHT;
|
||||
*width = kRealBufferWidth;
|
||||
*height = kRealBufferHeight;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class ImModuleEnv : public ::testing::Environment {
|
||||
}
|
||||
};
|
||||
|
||||
testing::Environment* const env =
|
||||
testing::Environment* const kEnv =
|
||||
testing::AddGlobalTestEnvironment(new ImModuleEnv);
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// This is a stub file used to create App.framework for JIT mode.
|
||||
__attribute__((unused)) static const int Moo = 88;
|
||||
__attribute__((unused)) static const int kMoo = 88;
|
||||
|
||||
Reference in New Issue
Block a user