#include "components/viz/test/compositor_frame_helpers.h"
#include <memory>
#include <set>
#include <utility>
#include "base/functional/bind.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/shared_element_draw_quad.h"
#include "components/viz/common/quads/shared_quad_state.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/surface_draw_quad.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/quads/yuv_video_draw_quad.h"
#include "components/viz/common/resources/resource_id.h"
namespace viz {
namespace {
constexpr gfx::Rect kDefaultOutputRect(20, 20);
constexpr gfx::Rect kDefaultDamageRect(0, 0);
constexpr CompositorRenderPassId kInvalidRenderPassId;
class StubCopyOutputRequest : public CopyOutputRequest { … };
}
RenderPassBuilder::RenderPassBuilder(CompositorRenderPassId id,
const gfx::Size& output_size)
: … { … }
RenderPassBuilder::RenderPassBuilder(CompositorRenderPassId id,
const gfx::Rect& output_rect)
: … { … }
RenderPassBuilder::RenderPassBuilder(const gfx::Size& output_size)
: … { … }
RenderPassBuilder::RenderPassBuilder(const gfx::Rect& output_rect)
: … { … }
RenderPassBuilder::~RenderPassBuilder() = default;
bool RenderPassBuilder::IsValid() const { … }
std::unique_ptr<CompositorRenderPass> RenderPassBuilder::Build() { … }
RenderPassBuilder& RenderPassBuilder::SetDamageRect(
const gfx::Rect& damage_rect) { … }
RenderPassBuilder& RenderPassBuilder::SetCacheRenderPass(bool val) { … }
RenderPassBuilder& RenderPassBuilder::SetHasDamageFromContributingContent(
bool val) { … }
RenderPassBuilder& RenderPassBuilder::AddFilter(
const cc::FilterOperation& filter) { … }
RenderPassBuilder& RenderPassBuilder::AddBackdropFilter(
const cc::FilterOperation& filter) { … }
RenderPassBuilder& RenderPassBuilder::SetTransformToRootTarget(
const gfx::Transform& transform) { … }
RenderPassBuilder& RenderPassBuilder::AddStubCopyOutputRequest(
base::WeakPtr<CopyOutputRequest>* request_out) { … }
RenderPassBuilder& RenderPassBuilder::AddSharedElementQuad(
const gfx::Rect& rect,
const ViewTransitionElementResourceId& id) { … }
RenderPassBuilder& RenderPassBuilder::AddSolidColorQuad(
const gfx::Rect& rect,
SkColor4f color,
SolidColorQuadParms params) { … }
RenderPassBuilder& RenderPassBuilder::AddSolidColorQuad(
const gfx::Rect& rect,
const gfx::Rect& visible_rect,
SkColor4f color,
SolidColorQuadParms params) { … }
RenderPassBuilder& RenderPassBuilder::AddSurfaceQuad(
const gfx::Rect& rect,
const SurfaceRange& surface_range,
const SurfaceQuadParams& params) { … }
RenderPassBuilder& RenderPassBuilder::AddSurfaceQuad(
const gfx::Rect& rect,
const gfx::Rect& visible_rect,
const SurfaceRange& surface_range,
const SurfaceQuadParams& params) { … }
RenderPassBuilder& RenderPassBuilder::AddRenderPassQuad(
const gfx::Rect& rect,
CompositorRenderPassId id,
const RenderPassQuadParams& params) { … }
RenderPassBuilder& RenderPassBuilder::AddRenderPassQuad(
const gfx::Rect& rect,
const gfx::Rect& visible_rect,
CompositorRenderPassId id,
const RenderPassQuadParams& params) { … }
RenderPassBuilder& RenderPassBuilder::AddTextureQuad(
const gfx::Rect& rect,
ResourceId resource_id,
const TextureQuadParams& params) { … }
RenderPassBuilder& RenderPassBuilder::AddTextureQuad(
const gfx::Rect& rect,
const gfx::Rect& visible_rect,
ResourceId resource_id,
const TextureQuadParams& params) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadToTargetTransform(
const gfx::Transform& transform) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadToTargetTranslation(
int translate_x,
int translate_y) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadOpacity(float opacity) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadClipRect(
std::optional<gfx::Rect> clip_rect) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadDamageRect(
const gfx::Rect& damage_rect) { … }
RenderPassBuilder& RenderPassBuilder::SetBlendMode(SkBlendMode blend_mode) { … }
RenderPassBuilder& RenderPassBuilder::SetMaskFilter(
const gfx::MaskFilterInfo& mask_filter_info,
bool is_fast_rounded_corner) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadLayerId(uint32_t layer_id) { … }
RenderPassBuilder& RenderPassBuilder::SetQuadOffsetTag(const OffsetTag& tag) { … }
SharedQuadState* RenderPassBuilder::AppendDefaultSharedQuadState(
const gfx::Rect rect,
const gfx::Rect visible_rect) { … }
SharedQuadState* RenderPassBuilder::GetLastQuadSharedQuadState() { … }
CompositorFrameBuilder::CompositorFrameBuilder() { … }
CompositorFrameBuilder::~CompositorFrameBuilder() = default;
CompositorFrame CompositorFrameBuilder::Build() { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddDefaultRenderPass() { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddRenderPass(
const gfx::Rect& output_rect,
const gfx::Rect& damage_rect) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddRenderPass(
std::unique_ptr<CompositorRenderPass> render_pass) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddRenderPass(
RenderPassBuilder& builder) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetRenderPassList(
CompositorRenderPassList render_pass_list) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddTransferableResource(
TransferableResource resource) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetTransferableResources(
std::vector<TransferableResource> resource_list) { … }
CompositorFrameBuilder& CompositorFrameBuilder::PopulateResources() { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetBeginFrameAck(
const BeginFrameAck& ack) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetBeginFrameSourceId(
uint64_t source_id) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetDeviceScaleFactor(
float device_scale_factor) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddLatencyInfo(
ui::LatencyInfo latency_info) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddLatencyInfos(
std::vector<ui::LatencyInfo> latency_info) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetActivationDependencies(
std::vector<SurfaceId> activation_dependencies) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetDeadline(
const FrameDeadline& deadline) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetReferencedSurfaces(
std::vector<SurfaceRange> referenced_surfaces) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetSendFrameTokenToEmbedder(
bool send) { … }
CompositorFrameBuilder& CompositorFrameBuilder::SetIsHandlingInteraction(
bool is_handling_interaction) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddDelegatedInkMetadata(
const gfx::DelegatedInkMetadata& metadata) { … }
CompositorFrameBuilder& CompositorFrameBuilder::AddOffsetTagDefinition(
const OffsetTagDefinition& definition) { … }
CompositorFrame CompositorFrameBuilder::MakeInitCompositorFrame() const { … }
CompositorRenderPassList CopyRenderPasses(
const CompositorRenderPassList& render_pass_list) { … }
CompositorFrame MakeDefaultCompositorFrame(uint64_t source_id) { … }
CompositorFrame MakeCompositorFrame(
std::unique_ptr<CompositorRenderPass> render_pass) { … }
CompositorFrame MakeCompositorFrame(CompositorRenderPassList render_pass_list) { … }
AggregatedFrame MakeDefaultAggregatedFrame(size_t num_render_passes) { … }
CompositorFrame MakeDefaultInteractiveCompositorFrame(uint64_t source_id) { … }
CompositorFrame MakeEmptyCompositorFrame() { … }
void PopulateTransferableResources(CompositorFrame& frame) { … }
}