fix use of intersect/intersects in DisplayListRasterCacheItem (flutter/engine#37238)

This commit is contained in:
Jim Graham
2022-11-02 10:24:45 -07:00
committed by GitHub
parent 426cd54590
commit effa8367d2
2 changed files with 15 additions and 1 deletions

View File

@@ -98,6 +98,20 @@ TEST_F(DisplayListLayerTest, SimpleDisplayList) {
EXPECT_EQ(mock_canvas().draw_calls(), expected_draw_calls);
}
TEST_F(DisplayListLayerTest, CachingDoesNotChangeCullRect) {
const SkPoint layer_offset = SkPoint::Make(10, 10);
DisplayListBuilder builder;
builder.drawRect({10, 10, 20, 20});
auto display_list = builder.Build();
auto layer = std::make_shared<DisplayListLayer>(
layer_offset, SkiaGPUObject(display_list, unref_queue()), true, false);
SkRect original_cull_rect = preroll_context()->cull_rect;
use_mock_raster_cache();
layer->Preroll(preroll_context(), SkMatrix::I());
ASSERT_EQ(preroll_context()->cull_rect, original_cull_rect);
}
TEST_F(DisplayListLayerTest, SimpleDisplayListOpacityInheritance) {
const SkPoint layer_offset = SkPoint::Make(1.5f, -0.5f);
const SkRect picture_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);

View File

@@ -108,7 +108,7 @@ void DisplayListRasterCacheItem::PrerollFinalize(PrerollContext* context,
// if the rect is intersect we will get the entry access_count to confirm if
// it great than the threshold. Otherwise we only increase the entry
// access_count.
bool visible = context->cull_rect.intersect(bounds);
bool visible = context->cull_rect.intersects(bounds);
int accesses = raster_cache->MarkSeen(key_id_, matrix, visible);
if (!visible || accesses <= raster_cache->access_threshold()) {
cache_state_ = kNone;