# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//cc/cc.gni")
import("//skia/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
cc_component("paint") {
output_name = "cc_paint"
sources = [
"clear_for_opaque_raster.cc",
"clear_for_opaque_raster.h",
"color_filter.cc",
"color_filter.h",
"decode_stashing_image_provider.cc",
"decode_stashing_image_provider.h",
"decoded_draw_image.cc",
"decoded_draw_image.h",
"directly_composited_image_info.h",
"discardable_image_map.cc",
"discardable_image_map.h",
"display_item_list.cc",
"display_item_list.h",
"draw_image.cc",
"draw_image.h",
"draw_looper.cc",
"draw_looper.h",
"element_id.cc",
"element_id.h",
"filter_operation.cc",
"filter_operation.h",
"filter_operations.cc",
"filter_operations.h",
"image_analysis_state.h",
"image_animation_count.h",
"image_id.h",
"image_provider.cc",
"image_provider.h",
"image_transfer_cache_entry.cc",
"image_transfer_cache_entry.h",
"node_id.h",
"paint_cache.cc",
"paint_cache.h",
"paint_canvas.h",
"paint_export.h",
"paint_filter.cc",
"paint_filter.h",
"paint_flags.cc",
"paint_flags.h",
"paint_image.cc",
"paint_image.h",
"paint_image_builder.cc",
"paint_image_builder.h",
"paint_image_generator.cc",
"paint_image_generator.h",
"paint_op.cc",
"paint_op.h",
"paint_op_buffer.cc",
"paint_op_buffer.h",
"paint_op_buffer_iterator.cc",
"paint_op_buffer_iterator.h",
"paint_op_buffer_serializer.cc",
"paint_op_buffer_serializer.h",
"paint_op_reader.cc",
"paint_op_reader.h",
"paint_op_writer.cc",
"paint_op_writer.h",
"paint_record.cc",
"paint_record.h",
"paint_recorder.cc",
"paint_recorder.h",
"paint_shader.cc",
"paint_shader.h",
"paint_worklet_input.cc",
"paint_worklet_input.h",
"paint_worklet_job.cc",
"paint_worklet_job.h",
"paint_worklet_layer_painter.h",
"path_effect.cc",
"path_effect.h",
"raw_memory_transfer_cache_entry.cc",
"raw_memory_transfer_cache_entry.h",
"record_paint_canvas.cc",
"record_paint_canvas.h",
"refcounted_buffer.h",
"render_surface_filters.cc",
"render_surface_filters.h",
"scoped_raster_flags.cc",
"scoped_raster_flags.h",
"scroll_offset_map.h",
"shader_transfer_cache_entry.cc",
"shader_transfer_cache_entry.h",
"skia_paint_canvas.cc",
"skia_paint_canvas.h",
"skia_paint_image_generator.cc",
"skia_paint_image_generator.h",
"skottie_color_map.h",
"skottie_frame_data.h",
"skottie_frame_data_provider.h",
"skottie_marker.h",
"skottie_resource_metadata.cc",
"skottie_resource_metadata.h",
"skottie_serialization_history.cc",
"skottie_serialization_history.h",
"skottie_text_property_value.cc",
"skottie_text_property_value.h",
"skottie_transfer_cache_entry.cc",
"skottie_transfer_cache_entry.h",
"skottie_transform_property_value.cc",
"skottie_transform_property_value.h",
"skottie_wrapper.cc",
"skottie_wrapper.h",
"solid_color_analyzer.cc",
"solid_color_analyzer.h",
"target_color_params.cc",
"target_color_params.h",
"texture_backing.h",
"transfer_cache_deserialize_helper.h",
"transfer_cache_entry.cc",
"transfer_cache_entry.h",
"transfer_cache_serialize_helper.cc",
"transfer_cache_serialize_helper.h",
]
defines = [ "CC_PAINT_IMPLEMENTATION=1" ]
# cc/paint is intended to be a separate component from cc that can be
# included in Blink. This component should never publicly include
# anything that Blink core wouldn't include (e.g. base).
public_deps = [
"//cc/base",
"//cc/debug",
"//skia",
"//skia:skcms",
"//third_party/abseil-cpp:absl",
"//ui/gfx:color_space",
"//ui/gfx/geometry",
"//ui/gfx/geometry:geometry_skia",
"//ui/gfx/mojom:hdr_metadata",
]
deps = [
"//base",
"//components/crash/core/common:crash_key",
"//gpu/command_buffer/common:mailbox",
"//ui/gfx/animation",
]
if (skia_support_skottie) {
# All source files that depend on the actual Skottie module within Skia
# should go here. If a source file is Skottie-related but depends only on
# Chromium and/or "common" Skia dependencies, it is fine to include that
# in the main "sources" list. Note that ultimately, all dependencies on
# the Skottie library should be contained in some way/shape/form within
# skottie_wrapper_impl.cc
sources += [
"skottie_mru_resource_provider.cc",
"skottie_mru_resource_provider.h",
"skottie_wrapper_impl.cc",
]
} else {
sources += [ "skottie_wrapper_stub.cc" ]
}
}
fuzzer_test("paint_op_raster_fuzzer") {
sources = [ "paint_op_raster_fuzzer.cc" ]
libfuzzer_options = [ "max_len=4096" ]
deps = [
"//base/test:test_support",
"//cc:test_support",
"//cc/paint",
"//components/viz/test:test_support",
"//gpu/command_buffer/service:gles2",
]
}
fuzzer_test("paint_op_buffer_fuzzer") {
sources = [ "paint_op_buffer_fuzzer.cc" ]
libfuzzer_options = [ "max_len=4096" ]
deps = [
"//cc:test_support",
"//cc/paint",
]
}
fuzzer_test("transfer_cache_fuzzer") {
sources = [ "transfer_cache_fuzzer.cc" ]
libfuzzer_options = [ "max_len=4096" ]
deps = [
"//cc:test_support",
"//cc/paint",
"//components/viz/test:test_support",
]
}
fuzzer_test("paint_op_reader_security_constrainted_fuzzer") {
sources = [ "paint_op_reader_fuzzer.cc" ]
deps = [ "//cc/paint" ]
}