-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] allow cloning a rectangle packer with an increased size. #52563
Conversation
53b207b
to
f2c2a28
Compare
@@ -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()); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
…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
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!