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

Conversation

jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented May 4, 2024

Work towards flutter/flutter#138798

Allow cloning a rectangle packer with all existing skylines preserved, but the size increased. This will allow us to preserve the positioning and state of all glyphs when the atlas size is increased, which is necessary for the "blit contents to top right of new texture" approach for improving append performance.
EDIT: I mean top left!

@@ -129,13 +131,13 @@ void SkylineRectanglePacker::addSkylineLevel(int skylineIndex,
newSegment.width_ = width;
skyline_.insert(std::next(skyline_.begin(), skylineIndex), newSegment);

FML_DCHECK(newSegment.x_ + newSegment.width_ <= this->width());
FML_DCHECK(newSegment.y_ <= this->height());
FML_CHECK(newSegment.x_ + newSegment.width_ <= this->width());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for testing..

/// This method is used for growing the glyph atlas while keeping
/// existing glyphs in place. The width of the rectangle packer
/// cannot be increased.
virtual std::unique_ptr<RectanglePacker> Clone(int scale) = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Consider uint32_t for the scale as a negative scale makes no sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// @return A new rectangle packer.
///
/// This method is used for growing the glyph atlas while keeping
/// existing glyphs in place. The width of the rectangle packer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existing rects instead of glyphs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

TEST(TypographerTest, CanCloneRectanglePackerEmpty) {
auto skyline = RectanglePacker::Factory(256, 256);

EXPECT_EQ(skyline->percentFull(), 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a later patch, we should consider a refactor to use PascalCase like in the rest of the engine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did that here, it was easy enough

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label May 7, 2024
@auto-submit auto-submit bot merged commit d88b7db into flutter:main May 7, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 7, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 7, 2024
…147938)

flutter/engine@5d94a52...d88b7db

2024-05-07 jonahwilliams@google.com [Impeller] allow cloning a rectangle packer with an increased size. (flutter/engine#52563)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants