chromium/cc/trees/layer_tree_host_pixeltest_masks.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#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 {

// TODO(penghuang): Fix vulkan with one copy or zero copy
// https://crbug.com/979703
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  // BUILDFLAG(ENABLE_GL_BACKEND_TESTS)
#if BUILDFLAG(ENABLE_VULKAN_BACKEND_TESTS)
    {viz::RendererType::kSkiaVk, TestRasterType::kGpu},
#if !BUILDFLAG(IS_FUCHSIA)
    // TODO(crbug.com/40282729): Fix NativePixmap creation when running GPU
    // service in process and re-enable these tests.
    {viz::RendererType::kSkiaVk, TestRasterType::kZeroCopy},
#endif
#endif  // BUILDFLAG(ENABLE_VULKAN_BACKEND_TESTS)
};

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) {}

// This tests that a solid color empty layer with mask effect works correctly.
TEST_P(LayerTreeHostMaskPixelTestWithLayerList,
       SolidColorLayerEmptyMaskWithEffect) {}

class SolidColorEmptyMaskContentLayerClient : public ContentLayerClient {};

TEST_P(LayerTreeHostMaskPixelTestWithLayerList, SolidColorEmptyMaskWithEffect) {}

// Same as SolidColorEmptyMaskWithEffect, except the mask has a render surface.
class LayerTreeHostMaskPixelTest_SolidColorEmptyMaskWithEffectAndRenderSurface
    : public LayerTreeHostMaskPixelTestWithLayerList {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(LayerTreeHostMaskPixelTest_SolidColorEmptyMaskWithEffectAndRenderSurface,
       Test) {}

// Tests a situation in which there is no other content in the target
// render surface that the mask applies to. In this situation, the mask
// should have no effect on the rendered output.
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) {}

}  // namespace
}  // namespace cc

#endif  // !BUILDFLAG(IS_ANDROID)