blob: c940fd25614ebca4d19ece1dc059b923b1b21cfd [file] [log] [blame]
Jonathan Backerea00a4012019-08-07 22:25:121// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/viz/service/display/external_use_client.h"
Hans Wennborgdf87046c2020-04-28 11:06:246#include "base/check.h"
7#include "base/notreached.h"
Jonathan Backerea00a4012019-08-07 22:25:128
9namespace viz {
10
11ExternalUseClient::ImageContext::ImageContext(
12 const gpu::MailboxHolder& mailbox_holder,
13 const gfx::Size& size,
14 ResourceFormat resource_format,
Anton Bikineev1156b5f2021-05-15 22:35:3615 const absl::optional<gpu::VulkanYCbCrInfo>& ycbcr_info,
Jonathan Backerea00a4012019-08-07 22:25:1216 sk_sp<SkColorSpace> color_space)
17 : mailbox_holder_(mailbox_holder),
18 size_(size),
19 resource_format_(resource_format),
Sergey Ulanov54d1c18d2019-09-27 21:15:5720 color_space_(std::move(color_space)),
21 ycbcr_info_(ycbcr_info) {}
Jonathan Backerea00a4012019-08-07 22:25:1222
23ExternalUseClient::ImageContext::~ImageContext() = default;
24
Jonathan Backer2814d322019-10-17 15:27:3925void ExternalUseClient::ImageContext::OnContextLost() {
26 NOTREACHED();
27}
28
Vasiliy Telezhnikov4a2f873b2019-08-29 18:49:5029void ExternalUseClient::ImageContext::SetImage(sk_sp<SkImage> image,
30 GrBackendFormat backend_format) {
31 DCHECK(!image_);
32 image_ = std::move(image);
33 backend_format_ = backend_format;
34}
35
Jonathan Backerea00a4012019-08-07 22:25:1236} // namespace viz