Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 0 additions & 4 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -42629,8 +42629,6 @@ ORIGIN: ../../../flutter/impeller/aiks/color_source.cc + ../../../flutter/LICENS
ORIGIN: ../../../flutter/impeller/aiks/color_source.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/experimental_canvas.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/experimental_canvas.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/image.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/image.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/image_filter.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/image_filter.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/aiks/paint.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -45518,8 +45516,6 @@ FILE: ../../../flutter/impeller/aiks/color_source.cc
FILE: ../../../flutter/impeller/aiks/color_source.h
FILE: ../../../flutter/impeller/aiks/experimental_canvas.cc
FILE: ../../../flutter/impeller/aiks/experimental_canvas.h
FILE: ../../../flutter/impeller/aiks/image.cc
FILE: ../../../flutter/impeller/aiks/image.h
FILE: ../../../flutter/impeller/aiks/image_filter.cc
FILE: ../../../flutter/impeller/aiks/image_filter.h
FILE: ../../../flutter/impeller/aiks/paint.cc
Expand Down
3 changes: 1 addition & 2 deletions display_list/testing/dl_test_surface_metal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ sk_sp<DlImage> DlMetalSurfaceProvider::MakeImpellerImage(
flutter::DlBlendMode::kSrc);
list->Dispatch(dispatcher);
auto picture = dispatcher.EndRecordingAsPicture();
std::shared_ptr<impeller::Image> image =
std::shared_ptr<impeller::Texture> texture =
picture.ToImage(*aiks_context_, {width, height});
std::shared_ptr<impeller::Texture> texture = image->GetTexture();
return impeller::DlImageImpeller::Make(texture);

#endif // EXPERIMENTAL_CANVAS
Expand Down
2 changes: 0 additions & 2 deletions impeller/aiks/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ impeller_component("aiks") {
"color_source.h",
"experimental_canvas.cc",
"experimental_canvas.h",
"image.cc",
"image.h",
"image_filter.cc",
"image_filter.h",
"paint.cc",
Expand Down
4 changes: 2 additions & 2 deletions impeller/aiks/aiks_blend_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TEST_P(AiksTest, ColorWheel) {
}
};

std::shared_ptr<Image> color_wheel_image;
std::shared_ptr<Texture> color_wheel_image;
Matrix color_wheel_transform;

auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
Expand Down Expand Up @@ -131,7 +131,7 @@ TEST_P(AiksTest, ColorWheel) {
if (!snapshot.has_value() || !snapshot->texture) {
return std::nullopt;
}
color_wheel_image = std::make_shared<Image>(snapshot->texture);
color_wheel_image = snapshot->texture;
color_wheel_transform = snapshot->transform;
}

Expand Down
9 changes: 4 additions & 5 deletions impeller/aiks/aiks_blur_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ TEST_P(AiksTest, BlurredRectangleWithShader) {
}
}
Picture picture = recorder_canvas.EndRecordingAsPicture();
std::shared_ptr<Texture> texture =
picture.ToImage(renderer, ISize{100, 100})->GetTexture();
std::shared_ptr<Texture> texture = picture.ToImage(renderer, ISize{100, 100});

ColorSource image_source = ColorSource::MakeImage(
texture, Entity::TileMode::kRepeat, Entity::TileMode::kRepeat, {}, {});
Expand Down Expand Up @@ -107,7 +106,7 @@ TEST_P(AiksTest, GaussianBlurWithoutDecalSupport) {
FLT_FORWARD(mock_capabilities, old_capabilities, GetDefaultGlyphAtlasFormat);
ASSERT_TRUE(SetCapabilities(mock_capabilities).ok());

auto texture = std::make_shared<Image>(CreateTextureForFixture("boston.jpg"));
auto texture = CreateTextureForFixture("boston.jpg");
Canvas canvas;
canvas.Scale(GetContentScale() * 0.5);
canvas.DrawPaint({.color = Color::Black()});
Expand Down Expand Up @@ -143,7 +142,7 @@ TEST_P(AiksTest, GaussianBlurSolidColorTinyMipMap) {
std::make_shared<RenderTargetCache>(
GetContext()->GetResourceAllocator());
AiksContext aiks_context(GetContext(), nullptr, cache);
std::shared_ptr<Image> image = picture.ToImage(aiks_context, {1024, 768});
std::shared_ptr<Texture> image = picture.ToImage(aiks_context, {1024, 768});
EXPECT_TRUE(image) << " length " << i;
}
}
Expand Down Expand Up @@ -172,7 +171,7 @@ TEST_P(AiksTest, GaussianBlurBackdropTinyMipMap) {
std::make_shared<RenderTargetCache>(
GetContext()->GetResourceAllocator());
AiksContext aiks_context(GetContext(), nullptr, cache);
std::shared_ptr<Image> image = picture.ToImage(aiks_context, {1024, 768});
std::shared_ptr<Texture> image = picture.ToImage(aiks_context, {1024, 768});
EXPECT_TRUE(image) << " clip rect " << i;
}
}
Expand Down
15 changes: 7 additions & 8 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "gtest/gtest.h"
#include "impeller/aiks/canvas.h"
#include "impeller/aiks/color_filter.h"
#include "impeller/aiks/image.h"
#include "impeller/aiks/image_filter.h"
#include "impeller/aiks/testing/context_spy.h"
#include "impeller/core/device_buffer.h"
Expand Down Expand Up @@ -235,7 +234,7 @@ TEST_P(AiksTest, DrawPaintAbsorbsClears) {
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {300, 300});

ASSERT_EQ(spy->render_passes_.size(), 1llu);
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
Expand All @@ -259,7 +258,7 @@ TEST_P(AiksTest,
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {300, 300});

ASSERT_EQ(spy->render_passes_.size(),
GetBackend() == PlaygroundBackend::kOpenGLES ? 4llu : 3llu);
Expand All @@ -280,7 +279,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClears) {
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {300, 300});

ASSERT_EQ(spy->render_passes_.size(), 1llu);
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
Expand All @@ -300,7 +299,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRRect) {
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {300, 300});

ASSERT_EQ(spy->render_passes_.size(), 1llu);
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
Expand All @@ -320,7 +319,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRotation) {
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {300, 300});

ASSERT_EQ(spy->render_passes_.size(), 1llu);
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
Expand All @@ -340,7 +339,7 @@ TEST_P(AiksTest, DrawRectAbsorbsClearsNegative) {
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {301, 301});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {301, 301});

ASSERT_EQ(spy->render_passes_.size(), 1llu);
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
Expand All @@ -364,7 +363,7 @@ TEST_P(AiksTest, ClipRectElidesNoOpClips) {
std::shared_ptr<Context> real_context = GetContext();
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
AiksContext renderer(mock_context, nullptr);
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
std::shared_ptr<Texture> image = picture.ToImage(renderer, {300, 300});

ASSERT_EQ(spy->render_passes_.size(), 1llu);
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
Expand Down
10 changes: 5 additions & 5 deletions impeller/aiks/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ void Canvas::DrawPoints(std::vector<Point> points,
AddRenderEntityToCurrentPass(std::move(entity));
}

void Canvas::DrawImage(const std::shared_ptr<Image>& image,
void Canvas::DrawImage(const std::shared_ptr<Texture>& image,
Point offset,
const Paint& paint,
SamplerDescriptor sampler) {
Expand All @@ -733,7 +733,7 @@ void Canvas::DrawImage(const std::shared_ptr<Image>& image,
DrawImageRect(image, source, dest, paint, std::move(sampler));
}

void Canvas::DrawImageRect(const std::shared_ptr<Image>& image,
void Canvas::DrawImageRect(const std::shared_ptr<Texture>& image,
Rect source,
Rect dest,
const Paint& paint,
Expand All @@ -750,7 +750,7 @@ void Canvas::DrawImageRect(const std::shared_ptr<Image>& image,
}

auto texture_contents = TextureContents::MakeRect(dest);
texture_contents->SetTexture(image->GetTexture());
texture_contents->SetTexture(image);
texture_contents->SetSourceRect(source);
texture_contents->SetStrictSourceRect(src_rect_constraint ==
SourceRectConstraint::kStrict);
Expand Down Expand Up @@ -991,7 +991,7 @@ void Canvas::DrawVertices(const std::shared_ptr<VerticesGeometry>& vertices,
AddRenderEntityToCurrentPass(std::move(entity));
}

void Canvas::DrawAtlas(const std::shared_ptr<Image>& atlas,
void Canvas::DrawAtlas(const std::shared_ptr<Texture>& atlas,
std::vector<Matrix> transforms,
std::vector<Rect> texture_coordinates,
std::vector<Color> colors,
Expand All @@ -1007,7 +1007,7 @@ void Canvas::DrawAtlas(const std::shared_ptr<Image>& atlas,
contents->SetColors(std::move(colors));
contents->SetTransforms(std::move(transforms));
contents->SetTextureCoordinates(std::move(texture_coordinates));
contents->SetTexture(atlas->GetTexture());
contents->SetTexture(atlas);
contents->SetSamplerDescriptor(std::move(sampler));
contents->SetBlendMode(blend_mode);
contents->SetCullRect(cull_rect);
Expand Down
7 changes: 3 additions & 4 deletions impeller/aiks/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <optional>
#include <vector>

#include "impeller/aiks/image.h"
#include "impeller/aiks/image_filter.h"
#include "impeller/aiks/paint.h"
#include "impeller/aiks/picture.h"
Expand Down Expand Up @@ -129,13 +128,13 @@ class Canvas {
const Paint& paint,
PointStyle point_style);

void DrawImage(const std::shared_ptr<Image>& image,
void DrawImage(const std::shared_ptr<Texture>& image,
Point offset,
const Paint& paint,
SamplerDescriptor sampler = {});

void DrawImageRect(
const std::shared_ptr<Image>& image,
const std::shared_ptr<Texture>& image,
Rect source,
Rect dest,
const Paint& paint,
Expand Down Expand Up @@ -167,7 +166,7 @@ class Canvas {
BlendMode blend_mode,
const Paint& paint);

void DrawAtlas(const std::shared_ptr<Image>& atlas,
void DrawAtlas(const std::shared_ptr<Texture>& atlas,
std::vector<Matrix> transforms,
std::vector<Rect> texture_coordinates,
std::vector<Color> colors,
Expand Down
21 changes: 0 additions & 21 deletions impeller/aiks/image.cc

This file was deleted.

34 changes: 0 additions & 34 deletions impeller/aiks/image.h

This file was deleted.

7 changes: 3 additions & 4 deletions impeller/aiks/picture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ std::optional<Snapshot> Picture::Snapshot(AiksContext& context) {
.transform = Matrix::MakeTranslation(coverage->GetOrigin())};
}

std::shared_ptr<Image> Picture::ToImage(AiksContext& context,
ISize size) const {
std::shared_ptr<Texture> Picture::ToImage(AiksContext& context,
ISize size) const {
if (size.IsEmpty()) {
return nullptr;
}
auto texture = RenderToTexture(context, size);
return texture ? std::make_shared<Image>(texture) : nullptr;
return RenderToTexture(context, size);
}

std::shared_ptr<Texture> Picture::RenderToTexture(
Expand Down
3 changes: 1 addition & 2 deletions impeller/aiks/picture.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <optional>

#include "impeller/aiks/aiks_context.h"
#include "impeller/aiks/image.h"
#include "impeller/entity/entity_pass.h"

namespace impeller {
Expand All @@ -19,7 +18,7 @@ struct Picture {

std::optional<Snapshot> Snapshot(AiksContext& context);

std::shared_ptr<Image> ToImage(AiksContext& context, ISize size) const;
std::shared_ptr<Texture> ToImage(AiksContext& context, ISize size) const;

private:
std::shared_ptr<Texture> RenderToTexture(
Expand Down
24 changes: 11 additions & 13 deletions impeller/display_list/dl_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1017,12 +1017,11 @@ void DlDispatcherBase::drawImageRect(
flutter::DlImageSampling sampling,
bool render_with_attributes,
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
GetCanvas().DrawImageRect(
std::make_shared<Image>(image->impeller_texture()), // image
skia_conversions::ToRect(src), // source rect
skia_conversions::ToRect(dst), // destination rect
render_with_attributes ? paint_ : Paint(), // paint
ToSamplerDescriptor(sampling) // sampling
GetCanvas().DrawImageRect(image->impeller_texture(), // image
skia_conversions::ToRect(src), // source rect
skia_conversions::ToRect(dst), // destination rect
render_with_attributes ? paint_ : Paint(), // paint
ToSamplerDescriptor(sampling) // sampling
);
}

Expand All @@ -1034,7 +1033,7 @@ void DlDispatcherBase::drawImageNine(const sk_sp<flutter::DlImage> image,
bool render_with_attributes) {
NinePatchConverter converter = {};
converter.DrawNinePatch(
std::make_shared<Image>(image->impeller_texture()),
image->impeller_texture(),
Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
skia_conversions::ToRect(dst), ToSamplerDescriptor(filter), &GetCanvas(),
&paint_);
Expand All @@ -1050,12 +1049,11 @@ void DlDispatcherBase::drawAtlas(const sk_sp<flutter::DlImage> atlas,
flutter::DlImageSampling sampling,
const SkRect* cull_rect,
bool render_with_attributes) {
GetCanvas().DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
skia_conversions::ToRSXForms(xform, count),
skia_conversions::ToRects(tex, count),
ToColors(colors, count), ToBlendMode(mode),
ToSamplerDescriptor(sampling),
skia_conversions::ToRect(cull_rect), paint_);
GetCanvas().DrawAtlas(
atlas->impeller_texture(), skia_conversions::ToRSXForms(xform, count),
skia_conversions::ToRects(tex, count), ToColors(colors, count),
ToBlendMode(mode), ToSamplerDescriptor(sampling),
skia_conversions::ToRect(cull_rect), paint_);
}

// |flutter::DlOpReceiver|
Expand Down
2 changes: 1 addition & 1 deletion impeller/display_list/nine_patch_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::vector<double> NinePatchConverter::InitSlices(double img0,
// clang-format on
}

void NinePatchConverter::DrawNinePatch(const std::shared_ptr<Image>& image,
void NinePatchConverter::DrawNinePatch(const std::shared_ptr<Texture>& image,
Rect center,
Rect dst,
const SamplerDescriptor& sampler,
Expand Down
Loading