#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include "build/build_config.h"
#include "cc/layers/content_layer_client.h"
#include "cc/layers/picture_layer.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_image.h"
#include "cc/paint/paint_image_builder.h"
#include "cc/paint/paint_op_buffer.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_picture_layer.h"
#include "cc/test/layer_tree_pixel_resource_test.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/solid_color_content_layer_client.h"
#include "cc/test/test_layer_tree_frame_sink.h"
#include "components/viz/test/buildflags.h"
#include "third_party/skia/include/core/SkImage.h"
#if !BUILDFLAG(IS_ANDROID)
namespace cc {
namespace {
std::vector<RasterTestConfig> const kTestCases = {
{viz::RendererType::kSoftware, TestRasterType::kBitmap},
#if BUILDFLAG(ENABLE_GL_BACKEND_TESTS)
{viz::RendererType::kSkiaGL, TestRasterType::kGpu},
{viz::RendererType::kSkiaGL, TestRasterType::kOneCopy},
{viz::RendererType::kSkiaGL, TestRasterType::kZeroCopy},
#endif
#if BUILDFLAG(ENABLE_VULKAN_BACKEND_TESTS)
{viz::RendererType::kSkiaVk, TestRasterType::kGpu},
#if !BUILDFLAG(IS_FUCHSIA)
{viz::RendererType::kSkiaVk, TestRasterType::kZeroCopy},
#endif
#endif
};
LayerTreeHostMasksPixelTest;
INSTANTIATE_TEST_SUITE_P(…);
class MaskContentLayerClient : public ContentLayerClient { … };
TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { … }
class LayerTreeHostMaskPixelTestWithLayerList
: public ParameterizedPixelResourceTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMaskPixelTestWithLayerList, MaskWithEffect) { … }
TEST_P(LayerTreeHostMaskPixelTestWithLayerList,
SolidColorLayerEmptyMaskWithEffect) { … }
class SolidColorEmptyMaskContentLayerClient : public ContentLayerClient { … };
TEST_P(LayerTreeHostMaskPixelTestWithLayerList, SolidColorEmptyMaskWithEffect) { … }
class LayerTreeHostMaskPixelTest_SolidColorEmptyMaskWithEffectAndRenderSurface
: public LayerTreeHostMaskPixelTestWithLayerList { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMaskPixelTest_SolidColorEmptyMaskWithEffectAndRenderSurface,
Test) { … }
class LayerTreeHostMaskPixelTest_MaskWithEffectNoContentToMask
: public LayerTreeHostMaskPixelTestWithLayerList { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMaskPixelTest_MaskWithEffectNoContentToMask, Test) { … }
class LayerTreeHostMaskPixelTest_ScaledMaskWithEffect
: public LayerTreeHostMaskPixelTestWithLayerList { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMaskPixelTest_ScaledMaskWithEffect, Test) { … }
TEST_P(LayerTreeHostMaskPixelTestWithLayerList, MaskWithEffectDifferentSize) { … }
TEST_P(LayerTreeHostMaskPixelTestWithLayerList, ImageMaskWithEffect) { … }
TEST_P(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) { … }
TEST_P(LayerTreeHostMasksPixelTest, MaskOfClippedLayer) { … }
TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayerNonExactTextureSize) { … }
class CheckerContentLayerClient : public ContentLayerClient { … };
class CircleContentLayerClient : public ContentLayerClient { … };
class LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerList
: public ParameterizedPixelResourceTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerList, Test) { … }
LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerTree;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMasksForBackdropFiltersPixelTestWithLayerTree, Test) { … }
TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayerWithBlend) { … }
class StaticPictureLayer : private ContentLayerClient, public PictureLayer { … };
constexpr uint32_t kUseAntialiasing = …;
constexpr uint32_t kForceShaders = …;
struct MaskTestConfig { … };
void PrintTo(const MaskTestConfig& config, std::ostream* os) { … }
class LayerTreeHostMaskAsBlendingPixelTest
: public LayerTreeHostPixelResourceTest,
public ::testing::WithParamInterface<MaskTestConfig> { … };
MaskTestConfig const kTestConfigs[] = …;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, PixelAlignedNoop) { … }
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, PixelAlignedClippedCircle) { … }
TEST_P(LayerTreeHostMaskAsBlendingPixelTest,
PixelAlignedClippedCircleUnderflow) { … }
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircle) { … }
TEST_P(LayerTreeHostMaskAsBlendingPixelTest, RotatedClippedCircleUnderflow) { … }
class LayerTreeHostMasksForBackdropFiltersAndBlendPixelTest
: public ParameterizedPixelResourceTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LayerTreeHostMasksForBackdropFiltersAndBlendPixelTest, Test) { … }
}
}
#endif