DiffContext: Remove transform_override (flutter/engine#35601)

This has been originally added to account for different
parts of rendering process applying integer CTM  inconsistently. With Integer CTM removed this is dead code.
This commit is contained in:
Matej Knopp
2022-08-27 09:13:04 +02:00
committed by GitHub
parent 6424894330
commit 89c5675052
2 changed files with 3 additions and 24 deletions

View File

@@ -22,10 +22,6 @@ void DiffContext::BeginSubtree() {
state_.rect_index_ = rects_->size();
state_.has_filter_bounds_adjustment = false;
state_.has_texture = false;
if (state_.transform_override) {
state_.transform = *state_.transform_override;
state_.transform_override = std::nullopt;
}
}
void DiffContext::EndSubtree() {
@@ -49,7 +45,7 @@ void DiffContext::PushTransform(const SkMatrix& transform) {
}
void DiffContext::SetTransform(const SkMatrix& transform) {
state_.transform_override = transform;
state_.transform = transform;
}
void DiffContext::PushFilterBoundsAdjustment(FilterBoundsAdjustment filter) {
@@ -157,16 +153,8 @@ void DiffContext::MarkSubtreeDirty(const SkRect& previous_paint_region) {
}
void DiffContext::AddLayerBounds(const SkRect& rect) {
// During painting we cull based on non-overriden transform and then
// override the transform right before paint. Do the same thing here to get
// identical paint rect.
auto transformed_rect =
ApplyFilterBoundsAdjustment(state_.transform.mapRect(rect));
if (transformed_rect.intersects(state_.cull_rect)) {
auto paint_rect = state_.transform_override
? ApplyFilterBoundsAdjustment(
state_.transform_override->mapRect(rect))
: transformed_rect;
auto paint_rect = ApplyFilterBoundsAdjustment(state_.transform.mapRect(rect));
if (paint_rect.intersects(state_.cull_rect)) {
rects_->push_back(paint_rect);
if (IsSubtreeDirty()) {
AddDamage(paint_rect);

View File

@@ -197,16 +197,7 @@ class DiffContext {
bool dirty;
SkRect cull_rect; // in screen coordinates
// In order to replicate paint process closely, we need both the original
// transform, and the overriden transform (set for layers that need to paint
// on integer coordinates). The reason for this is that during paint the
// transform matrix is overriden only after layer passes the cull check
// first (with original transform). So to cull layer we use transform, but
// to get paint coordinates we use transform_override. Child layers are
// painted after transform override, so if set we use transform_override as
// base when diffing child layers.
SkMatrix transform;
std::optional<SkMatrix> transform_override;
size_t rect_index_;
// Whether this subtree has filter bounds adjustment function. If so,