[Impeller] Remove Skia dependency from the impeller/image interface (flutter/engine#40403)
* [Impeller] Remove Skia dependency from the impeller/image interface * Separate Skia backend target
This commit is contained in:
@@ -54,7 +54,7 @@ group("impeller") {
|
||||
"aiks",
|
||||
"display_list",
|
||||
"entity",
|
||||
"image",
|
||||
"image:image_skia_backend",
|
||||
"renderer",
|
||||
"renderer/backend",
|
||||
"typographer",
|
||||
|
||||
@@ -217,7 +217,7 @@ impeller_component("entity") {
|
||||
":framebuffer_blend_entity_shaders",
|
||||
":modern_entity_shaders",
|
||||
"../archivist",
|
||||
"../image",
|
||||
"../image:image_skia_backend",
|
||||
"../renderer",
|
||||
"../scene",
|
||||
"../typographer",
|
||||
|
||||
@@ -11,8 +11,6 @@ impeller_component("image") {
|
||||
]
|
||||
|
||||
sources = [
|
||||
"backends/skia/compressed_image_skia.cc",
|
||||
"backends/skia/compressed_image_skia.h",
|
||||
"compressed_image.cc",
|
||||
"decompressed_image.cc",
|
||||
]
|
||||
@@ -22,6 +20,20 @@ impeller_component("image") {
|
||||
"../geometry",
|
||||
]
|
||||
|
||||
deps = [ "//flutter/fml" ]
|
||||
}
|
||||
|
||||
impeller_component("image_skia_backend") {
|
||||
public = [ "backends/skia/compressed_image_skia.h" ]
|
||||
|
||||
sources = [ "backends/skia/compressed_image_skia.cc" ]
|
||||
|
||||
public_deps = [
|
||||
":image",
|
||||
"../base",
|
||||
"../geometry",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//flutter/fml",
|
||||
"//third_party/skia",
|
||||
@@ -32,7 +44,7 @@ impeller_component("image_unittests") {
|
||||
testonly = true
|
||||
sources = []
|
||||
deps = [
|
||||
":image",
|
||||
":image_skia_backend",
|
||||
"//flutter/testing",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -14,6 +14,15 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
std::shared_ptr<CompressedImage> CompressedImageSkia::Create(
|
||||
std::shared_ptr<const fml::Mapping> allocation) {
|
||||
// There is only one backend today.
|
||||
if (!allocation) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<CompressedImageSkia>(std::move(allocation));
|
||||
}
|
||||
|
||||
CompressedImageSkia::CompressedImageSkia(
|
||||
std::shared_ptr<const fml::Mapping> allocation)
|
||||
: CompressedImage(std::move(allocation)) {}
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace impeller {
|
||||
|
||||
class CompressedImageSkia final : public CompressedImage {
|
||||
public:
|
||||
static std::shared_ptr<CompressedImage> Create(
|
||||
std::shared_ptr<const fml::Mapping> allocation);
|
||||
|
||||
CompressedImageSkia(std::shared_ptr<const fml::Mapping> allocation);
|
||||
|
||||
~CompressedImageSkia() override;
|
||||
|
||||
@@ -4,19 +4,8 @@
|
||||
|
||||
#include "impeller/image/compressed_image.h"
|
||||
|
||||
#include "impeller/image/backends/skia/compressed_image_skia.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
std::shared_ptr<CompressedImage> CompressedImage::Create(
|
||||
std::shared_ptr<const fml::Mapping> allocation) {
|
||||
// There is only one backend today.
|
||||
if (!allocation) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<CompressedImageSkia>(std::move(allocation));
|
||||
}
|
||||
|
||||
CompressedImage::CompressedImage(std::shared_ptr<const fml::Mapping> allocation)
|
||||
: source_(std::move(allocation)) {}
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@ class ImageSource;
|
||||
|
||||
class CompressedImage {
|
||||
public:
|
||||
static std::shared_ptr<CompressedImage> Create(
|
||||
std::shared_ptr<const fml::Mapping> allocation);
|
||||
|
||||
virtual ~CompressedImage();
|
||||
|
||||
[[nodiscard]] virtual DecompressedImage Decode() const = 0;
|
||||
|
||||
@@ -45,6 +45,7 @@ impeller_component("playground") {
|
||||
"../entity:framebuffer_blend_entity_shaders",
|
||||
"../entity:modern_entity_shaders",
|
||||
"../fixtures:shader_fixtures",
|
||||
"../image:image_skia_backend",
|
||||
"../renderer",
|
||||
"../scene/shaders",
|
||||
"imgui:imgui_impeller_backend",
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "fml/time/time_point.h"
|
||||
#include "impeller/image/backends/skia/compressed_image_skia.h"
|
||||
#include "impeller/image/decompressed_image.h"
|
||||
#include "impeller/renderer/command_buffer.h"
|
||||
#include "impeller/runtime_stage/runtime_stage.h"
|
||||
@@ -340,7 +341,7 @@ bool Playground::OpenPlaygroundHere(SinglePassCallback pass_callback) {
|
||||
|
||||
std::shared_ptr<CompressedImage> Playground::LoadFixtureImageCompressed(
|
||||
std::shared_ptr<fml::Mapping> mapping) const {
|
||||
auto compressed_image = CompressedImage::Create(std::move(mapping));
|
||||
auto compressed_image = CompressedImageSkia::Create(std::move(mapping));
|
||||
if (!compressed_image) {
|
||||
VALIDATION_LOG << "Could not create compressed image.";
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user