Commit d50bc5e1 authored by Jonah Chin's avatar Jonah Chin Committed by Commit Bot

Create TextureBacking interface

This change introduces the TextureBacking interface that will be used
on PaintImage. This CL simply introduces the cc interface. Follow up
changes will introduce the blink-side implementation.

This is being done as part of the OOPR-Canvas2D project. For more info
about the project see the tracking bug here: crbug.com/1018894

Bug: 1031050
Change-Id: I844c441bea308507a541fd3e131159f7c1d16b8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131216Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: Jonah Chin <jochin@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#756058}
parent 4590b883
......@@ -83,6 +83,7 @@ cc_component("paint") {
"skottie_wrapper.h",
"solid_color_analyzer.cc",
"solid_color_analyzer.h",
"texture_backing.h",
"transfer_cache_deserialize_helper.h",
"transfer_cache_entry.cc",
"transfer_cache_entry.h",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_PAINT_TEXTURE_BACKING_H_
#define CC_PAINT_TEXTURE_BACKING_H_
#include "cc/paint/paint_export.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
namespace gpu {
class Mailbox;
} // namespace gpu
namespace cc {
// Used for storing mailboxes in a PaintImage.
// This class must be created, used and destroyed on the same thread.
class CC_PAINT_EXPORT TextureBacking : public SkRefCnt {
public:
TextureBacking(const TextureBacking&) = delete;
~TextureBacking() override = default;
TextureBacking& operator=(const TextureBacking&) = delete;
// Returns the metadata for the associated texture.
virtual const SkImageInfo& GetSkImageInfo() = 0;
// Returns the shared image mailbox backing for this texture.
virtual gpu::Mailbox GetMailbox() const = 0;
// Returns a texture backed SkImage wrapping the mailbox. Only supported if
// the context used to create this image has a valid GrContext.
virtual sk_sp<SkImage> GetAcceleratedSkImage() = 0;
};
} // namespace cc
#endif // CC_PAINT_TEXTURE_BACKING_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment