Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Move impeller/image to impeller/playground/image #50480

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@
../../../flutter/impeller/geometry/size_unittests.cc
../../../flutter/impeller/geometry/trig_unittests.cc
../../../flutter/impeller/golden_tests/README.md
../../../flutter/impeller/image/README.md
../../../flutter/impeller/playground
../../../flutter/impeller/renderer/backend/gles/test
../../../flutter/impeller/renderer/backend/metal/texture_mtl_unittests.mm
Expand Down
12 changes: 0 additions & 12 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -5307,12 +5307,6 @@ ORIGIN: ../../../flutter/impeller/golden_tests/vulkan_screenshotter.h + ../../..
ORIGIN: ../../../flutter/impeller/golden_tests/vulkan_screenshotter.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/golden_tests/working_directory.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/golden_tests/working_directory.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/image/backends/skia/compressed_image_skia.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/image/backends/skia/compressed_image_skia.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/image/compressed_image.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/image/compressed_image.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/image/decompressed_image.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/image/decompressed_image.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/gles/allocator_gles.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/gles/allocator_gles.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/gles/blit_command_gles.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -8147,12 +8141,6 @@ FILE: ../../../flutter/impeller/golden_tests/vulkan_screenshotter.h
FILE: ../../../flutter/impeller/golden_tests/vulkan_screenshotter.mm
FILE: ../../../flutter/impeller/golden_tests/working_directory.cc
FILE: ../../../flutter/impeller/golden_tests/working_directory.h
FILE: ../../../flutter/impeller/image/backends/skia/compressed_image_skia.cc
FILE: ../../../flutter/impeller/image/backends/skia/compressed_image_skia.h
FILE: ../../../flutter/impeller/image/compressed_image.cc
FILE: ../../../flutter/impeller/image/compressed_image.h
FILE: ../../../flutter/impeller/image/decompressed_image.cc
FILE: ../../../flutter/impeller/image/decompressed_image.h
FILE: ../../../flutter/impeller/renderer/backend/gles/allocator_gles.cc
FILE: ../../../flutter/impeller/renderer/backend/gles/allocator_gles.h
FILE: ../../../flutter/impeller/renderer/backend/gles/blit_command_gles.cc
Expand Down
2 changes: 0 additions & 2 deletions impeller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ group("impeller") {
"aiks",
"display_list",
"entity",
"image:image_skia_backend",
"renderer",
"renderer/backend",
"typographer/backends/skia:typographer_skia_backend",
Expand Down Expand Up @@ -99,7 +98,6 @@ impeller_component("impeller_unittests") {
"entity:entity_unittests",
"fixtures",
"geometry:geometry_unittests",
"image:image_unittests",
"playground",
"renderer:renderer_unittests",
"scene:scene_unittests",
Expand Down
1 change: 0 additions & 1 deletion impeller/core/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ impeller_component("core") {
deps = [
"../base",
"../geometry",
"../image",
"//flutter/fml",
]
}
Expand Down
1 change: 0 additions & 1 deletion impeller/entity/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ impeller_component("entity") {
":entity_shaders",
":framebuffer_blend_entity_shaders",
":modern_entity_shaders",
"../image:image_skia_backend",
"../renderer",
"../typographer",
]
Expand Down
4 changes: 3 additions & 1 deletion impeller/playground/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import("//flutter/impeller/tools/impeller.gni")
import("//flutter/testing/testing.gni")

impeller_component("playground") {
testonly = true

sources = [
"playground.cc",
"playground.h",
Expand Down Expand Up @@ -46,9 +48,9 @@ impeller_component("playground") {

public_deps = [
"../fixtures:shader_fixtures",
"../image:image_skia_backend",
"../renderer",
"../scene/shaders",
"image:image_skia_backend",
"imgui:imgui_impeller_backend",
"//flutter/fml",
"//flutter/third_party/glfw",
Expand Down
19 changes: 6 additions & 13 deletions impeller/image/BUILD.gn → impeller/playground/image/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import("//flutter/impeller/tools/impeller.gni")

impeller_component("image") {
testonly = true
public = [
"compressed_image.h",
"decompressed_image.h",
Expand All @@ -16,35 +17,27 @@ impeller_component("image") {
]

public_deps = [
"../base",
"../geometry",
"../../base",
"../../geometry",
]

deps = [ "//flutter/fml" ]
}

impeller_component("image_skia_backend") {
testonly = true
public = [ "backends/skia/compressed_image_skia.h" ]

sources = [ "backends/skia/compressed_image_skia.cc" ]

public_deps = [
":image",
"../base",
"../geometry",
"../../base",
"../../geometry",
]

deps = [
"//flutter/fml",
"//flutter/skia",
]
}

impeller_component("image_unittests") {
testonly = true
sources = []
deps = [
":image_skia_backend",
"//flutter/testing",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "impeller/image/backends/skia/compressed_image_skia.h"
#include "impeller/playground/image/backends/skia/compressed_image_skia.h"

#include <memory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_IMPELLER_IMAGE_BACKENDS_SKIA_COMPRESSED_IMAGE_SKIA_H_
#define FLUTTER_IMPELLER_IMAGE_BACKENDS_SKIA_COMPRESSED_IMAGE_SKIA_H_
#ifndef FLUTTER_IMPELLER_PLAYGROUND_IMAGE_BACKENDS_SKIA_COMPRESSED_IMAGE_SKIA_H_
#define FLUTTER_IMPELLER_PLAYGROUND_IMAGE_BACKENDS_SKIA_COMPRESSED_IMAGE_SKIA_H_

#include "flutter/fml/macros.h"
#include "impeller/image/compressed_image.h"
#include "impeller/playground/image/compressed_image.h"

namespace impeller {

Expand All @@ -30,4 +30,4 @@ class CompressedImageSkia final : public CompressedImage {

} // namespace impeller

#endif // FLUTTER_IMPELLER_IMAGE_BACKENDS_SKIA_COMPRESSED_IMAGE_SKIA_H_
#endif // FLUTTER_IMPELLER_PLAYGROUND_IMAGE_BACKENDS_SKIA_COMPRESSED_IMAGE_SKIA_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "impeller/image/compressed_image.h"
#include "impeller/playground/image/compressed_image.h"

namespace impeller {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_IMPELLER_IMAGE_COMPRESSED_IMAGE_H_
#define FLUTTER_IMPELLER_IMAGE_COMPRESSED_IMAGE_H_
#ifndef FLUTTER_IMPELLER_PLAYGROUND_IMAGE_COMPRESSED_IMAGE_H_
#define FLUTTER_IMPELLER_PLAYGROUND_IMAGE_COMPRESSED_IMAGE_H_

#include <memory>

#include "flutter/fml/macros.h"
#include "flutter/fml/mapping.h"
#include "impeller/geometry/size.h"
#include "impeller/image/decompressed_image.h"
#include "impeller/playground/image/decompressed_image.h"

namespace impeller {

Expand All @@ -32,4 +32,4 @@ class CompressedImage {

} // namespace impeller

#endif // FLUTTER_IMPELLER_IMAGE_COMPRESSED_IMAGE_H_
#endif // FLUTTER_IMPELLER_PLAYGROUND_IMAGE_COMPRESSED_IMAGE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "impeller/image/decompressed_image.h"
#include "impeller/playground/image/decompressed_image.h"

#include <limits>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_IMPELLER_IMAGE_DECOMPRESSED_IMAGE_H_
#define FLUTTER_IMPELLER_IMAGE_DECOMPRESSED_IMAGE_H_
#ifndef FLUTTER_IMPELLER_PLAYGROUND_IMAGE_DECOMPRESSED_IMAGE_H_
#define FLUTTER_IMPELLER_PLAYGROUND_IMAGE_DECOMPRESSED_IMAGE_H_

#include <memory>
#include <optional>
Expand Down Expand Up @@ -51,4 +51,4 @@ class DecompressedImage {

} // namespace impeller

#endif // FLUTTER_IMPELLER_IMAGE_DECOMPRESSED_IMAGE_H_
#endif // FLUTTER_IMPELLER_PLAYGROUND_IMAGE_DECOMPRESSED_IMAGE_H_
6 changes: 3 additions & 3 deletions impeller/playground/playground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#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/playground/image/backends/skia/compressed_image_skia.h"
#include "impeller/playground/image/decompressed_image.h"
#include "impeller/renderer/command_buffer.h"
#include "impeller/runtime_stage/runtime_stage.h"

Expand All @@ -20,8 +20,8 @@
#include "impeller/base/validation.h"
#include "impeller/core/allocator.h"
#include "impeller/core/formats.h"
#include "impeller/image/compressed_image.h"
#include "impeller/playground/backend/vulkan/swiftshader_utilities.h"
#include "impeller/playground/image/compressed_image.h"
#include "impeller/playground/imgui/imgui_impl_impeller.h"
#include "impeller/playground/playground.h"
#include "impeller/playground/playground_impl.h"
Expand Down
4 changes: 2 additions & 2 deletions impeller/playground/playground.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "impeller/core/runtime_types.h"
#include "impeller/core/texture.h"
#include "impeller/geometry/point.h"
#include "impeller/image/compressed_image.h"
#include "impeller/image/decompressed_image.h"
#include "impeller/playground/image/compressed_image.h"
#include "impeller/playground/image/decompressed_image.h"
#include "impeller/playground/switches.h"
#include "impeller/renderer/render_pass.h"
#include "impeller/renderer/renderer.h"
Expand Down
1 change: 0 additions & 1 deletion impeller/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ impeller_component("renderer") {
"../base",
"../core",
"../geometry",
"../image",
"../runtime_stage",
"../tessellator",
]
Expand Down
20 changes: 5 additions & 15 deletions impeller/scene/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "impeller/base/thread.h"
#include "impeller/base/validation.h"
#include "impeller/geometry/matrix.h"
#include "impeller/image/decompressed_image.h"
#include "impeller/scene/animation/animation_player.h"
#include "impeller/scene/importer/conversions.h"
#include "impeller/scene/importer/scene_flatbuffers.h"
Expand Down Expand Up @@ -80,17 +79,12 @@ static std::shared_ptr<Texture> UnpackTextureFromFlatbuffer(
return nullptr;
}

DecompressedImage::Format format;
switch (embedded->component_count()) {
case 1:
format = DecompressedImage::Format::kGrey;
break;
case 3:
format = DecompressedImage::Format::kRGB;
break;
case 4:
format = DecompressedImage::Format::kRGBA;
// RGBA.
break;
case 1:
case 3:
default:
FML_LOG(WARNING) << "Textures with " << embedded->component_count()
<< " components are not supported." << std::endl;
Expand All @@ -106,15 +100,11 @@ static std::shared_ptr<Texture> UnpackTextureFromFlatbuffer(

auto image_mapping = std::make_shared<fml::NonOwnedMapping>(
embedded->bytes()->Data(), embedded->bytes()->size());
auto decompressed_image =
DecompressedImage(ISize(embedded->width(), embedded->height()), format,
image_mapping)
.ConvertToRGBA();

auto texture_descriptor = TextureDescriptor{};
texture_descriptor.storage_mode = StorageMode::kHostVisible;
texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
texture_descriptor.size = decompressed_image.GetSize();
texture_descriptor.size = ISize(embedded->width(), embedded->height());
// TODO(bdero): Generate mipmaps for embedded textures.
texture_descriptor.mip_count = 1u;

Expand All @@ -124,7 +114,7 @@ static std::shared_ptr<Texture> UnpackTextureFromFlatbuffer(
return nullptr;
}

auto uploaded = texture->SetContents(decompressed_image.GetAllocation());
auto uploaded = texture->SetContents(image_mapping);
if (!uploaded) {
FML_LOG(ERROR) << "Could not upload texture to device memory.";
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion impeller/scene/scene_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "impeller/geometry/matrix.h"
#include "impeller/geometry/quaternion.h"
#include "impeller/geometry/vector.h"
#include "impeller/image/decompressed_image.h"
#include "impeller/playground/image/decompressed_image.h"
#include "impeller/playground/playground.h"
#include "impeller/playground/playground_test.h"
#include "impeller/scene/animation/animation_clip.h"
Expand Down