Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow inheriting LayerFilter to customize filter behavior. #390

Merged
merged 11 commits into from
Dec 20, 2024

Conversation

Hparty
Copy link
Collaborator

@Hparty Hparty commented Dec 19, 2024

No description provided.

@Hparty Hparty reopened this Dec 19, 2024
src/layers/Layer.cpp Outdated Show resolved Hide resolved
src/layers/Layer.cpp Outdated Show resolved Hide resolved
src/layers/Layer.cpp Outdated Show resolved Hide resolved
@domchen domchen changed the title Modify the behavior of LayerFilter to allow LayerFilter to customize rendering logic. Allow inheriting LayerFilter to customize filter behavior. Dec 20, 2024
src/layers/Layer.cpp Outdated Show resolved Hide resolved
src/layers/Layer.cpp Outdated Show resolved Hide resolved
…partyhuang_layerFilter

# Conflicts:
#	test/baseline/version.json   resolved by e5ca671 version
Comment on lines 537 to 550
std::shared_ptr<Image> Layer::createPictureImage(std::shared_ptr<Picture> picture, Point* offset) {
if (picture == nullptr) {
return nullptr;
}
auto bounds = picture->getBounds();
bounds.roundOut();
auto matrix = Matrix::MakeTrans(-bounds.x(), -bounds.y());
auto image = Image::MakeFrom(std::move(picture), static_cast<int>(bounds.width()),
static_cast<int>(bounds.height()), &matrix);
if (offset) {
*offset = Point::Make(bounds.x(), bounds.y());
}
return image;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个加个静态函数是不是就行了?没有访问任何layer的属性。

return image;
}

std::shared_ptr<Picture> Layer::getLayerContents(const DrawArgs& args, float contentScale) {
if (FloatNearlyZero(contentScale)) {
return nullptr;
}
Recorder recorder;
Recorder recorder{};
Copy link
Collaborator

Choose a reason for hiding this comment

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

是 Recorder recorder = {}; 编译器会优化成只有一次构造函数调用的。

}
return lastFilter;
Paint paint;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Paint paint = {};

@domchen domchen merged commit 27ac413 into main Dec 20, 2024
8 checks passed
@domchen domchen deleted the feature/partyhuang_layerFilter branch December 20, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants