#include "third_party/blink/renderer/modules/webgpu/gpu_canvas_context.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/config/gpu_finch_features.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_htmlcanvaselement_offscreencanvas.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_canvas_alpha_mode.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_canvas_configuration.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_canvas_tone_mapping.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_canvas_tone_mapping_mode.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_canvasrenderingcontext2d_gpucanvascontext_imagebitmaprenderingcontext_webgl2renderingcontext_webglrenderingcontext.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_gpucanvascontext_imagebitmaprenderingcontext_offscreencanvasrenderingcontext2d_webgl2renderingcontext_webglrenderingcontext.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/canvas/predefined_color_space.h"
#include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h"
#include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h"
#include "third_party/blink/renderer/modules/webgpu/gpu.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_adapter.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_queue.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_supported_features.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/canvas_color_params.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h"
#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"
#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_mailbox_texture.h"
#include "third_party/blink/renderer/platform/graphics/gpu/webgpu_texture_alpha_clearer.h"
#include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/skia/include/core/SkImage.h"
namespace blink {
GPUCanvasContext::Factory::~Factory() = default;
CanvasRenderingContext* GPUCanvasContext::Factory::Create(
CanvasRenderingContextHost* host,
const CanvasContextCreationAttributesCore& attrs) { … }
CanvasRenderingContext::CanvasRenderingAPI
GPUCanvasContext::Factory::GetRenderingAPI() const { … }
GPUCanvasContext::GPUCanvasContext(
CanvasRenderingContextHost* host,
const CanvasContextCreationAttributesCore& attrs)
: … { … }
GPUCanvasContext::~GPUCanvasContext() { … }
void GPUCanvasContext::Trace(Visitor* visitor) const { … }
V8RenderingContext* GPUCanvasContext::AsV8RenderingContext() { … }
V8OffscreenRenderingContext* GPUCanvasContext::AsV8OffscreenRenderingContext() { … }
SkColorInfo GPUCanvasContext::CanvasRenderingContextSkColorInfo() const { … }
void GPUCanvasContext::Stop() { … }
cc::Layer* GPUCanvasContext::CcLayer() const { … }
void GPUCanvasContext::Reshape(int width, int height) { … }
scoped_refptr<StaticBitmapImage> GPUCanvasContext::GetImage(FlushReason) { … }
bool GPUCanvasContext::PaintRenderingResultsToCanvas(
SourceDrawingBuffer source_buffer) { … }
bool GPUCanvasContext::CopyRenderingResultsFromDrawingBuffer(
CanvasResourceProvider* resource_provider,
SourceDrawingBuffer source_buffer) { … }
bool GPUCanvasContext::CopyRenderingResultsToVideoFrame(
WebGraphicsContext3DVideoFramePool* frame_pool,
SourceDrawingBuffer src_buffer,
const gfx::ColorSpace& dst_color_space,
VideoFrameCopyCompletedCallback callback) { … }
void GPUCanvasContext::SetFilterQuality(
cc::PaintFlags::FilterQuality filter_quality) { … }
bool GPUCanvasContext::PushFrame() { … }
ImageBitmap* GPUCanvasContext::TransferToImageBitmap(
ScriptState* script_state,
ExceptionState& exception_state) { … }
V8UnionHTMLCanvasElementOrOffscreenCanvas*
GPUCanvasContext::getHTMLOrOffscreenCanvas() const { … }
void GPUCanvasContext::configure(const GPUCanvasConfiguration* descriptor,
ExceptionState& exception_state) { … }
void GPUCanvasContext::unconfigure() { … }
GPUTexture* GPUCanvasContext::getCurrentTexture(
ScriptState* script_state,
ExceptionState& exception_state) { … }
void GPUCanvasContext::ReplaceDrawingBuffer(bool destroy_swap_buffers) { … }
void GPUCanvasContext::FinalizeFrame(FlushReason) { … }
void GPUCanvasContext::OnTextureTransferred() { … }
void GPUCanvasContext::SetNeedsCompositingUpdate() { … }
void GPUCanvasContext::CopyToSwapTexture() { … }
bool GPUCanvasContext::CopyTextureToResourceProvider(
const wgpu::Texture& texture,
const gfx::Size& size,
CanvasResourceProvider* resource_provider) const { … }
scoped_refptr<StaticBitmapImage> GPUCanvasContext::SnapshotInternal(
const wgpu::Texture& texture,
const gfx::Size& size) const { … }
base::WeakPtr<WebGraphicsContext3DProviderWrapper>
GPUCanvasContext::GetContextProviderWeakPtr() const { … }
}