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

Modify the behavior of LayerFilter to allow LayerFilter to customize rendering logic. #390

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

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
return nullptr;
}
std::vector<std::shared_ptr<ImageFilter>> imageFilters;
if (_filters.empty() || FloatNearlyZero(contentScale)) {
Copy link
Collaborator

@domchen domchen Dec 19, 2024

Choose a reason for hiding this comment

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

这里的contentScales是否等于0是不是应该在更前面的调用源头的地方判断?

Comment on lines 71 to 82
Recorder shadowRecorder;
auto shadowCanvas = shadowRecorder.beginRecording();
for (const auto& param : params) {
auto filter = createShadowFilter(param, scale);
if (!filter) {
continue;
}
Paint paint;
paint.setImageFilter(filter);
shadowCanvas->drawImage(opaqueImage, bounds.x(), bounds.y(), &paint);
}
auto shadowPicture = shadowRecorder.finishRecordingAsPicture();
Copy link
Collaborator

Choose a reason for hiding this comment

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

同理投影的Image也不需要Recorder,用makeWithFilter直接创建。

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