Skip to content

Commit 8f4901f

Browse files
authored
Request quickReject results from correct drawing canvas (flutter#22674)
Also Fix MockCanvas clipping so tests will work with new culling
1 parent 298bf68 commit 8f4901f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

flow/layers/layer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class Layer {
195195
if (paint_bounds_.isEmpty()) {
196196
return false;
197197
}
198-
return !context.internal_nodes_canvas->quickReject(paint_bounds_);
198+
return !context.leaf_nodes_canvas->quickReject(paint_bounds_);
199199
}
200200

201201
uint64_t unique_id() const { return unique_id_; }

flow/raster_cache.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ std::unique_ptr<RasterCacheResult> RasterCache::RasterizeLayer(
158158
SkISize canvas_size = canvas->getBaseLayerSize();
159159
SkNWayCanvas internal_nodes_canvas(canvas_size.width(),
160160
canvas_size.height());
161+
internal_nodes_canvas.setMatrix(canvas->getTotalMatrix());
161162
internal_nodes_canvas.addCanvas(canvas);
162163
Layer::PaintContext paintContext = {
163164
/* internal_nodes_canvas= */ static_cast<SkCanvas*>(

testing/mock_canvas.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,26 @@ void MockCanvas::onClipRect(const SkRect& rect,
148148
ClipEdgeStyle style) {
149149
draw_calls_.emplace_back(
150150
DrawCall{current_layer_, ClipRectData{rect, op, style}});
151+
// quickReject() is handled by base class and needs accurate clip information
152+
SkCanvas::onClipRect(rect, op, style);
151153
}
152154

153155
void MockCanvas::onClipRRect(const SkRRect& rrect,
154156
SkClipOp op,
155157
ClipEdgeStyle style) {
156158
draw_calls_.emplace_back(
157159
DrawCall{current_layer_, ClipRRectData{rrect, op, style}});
160+
// quickReject() is handled by base class and needs accurate clip information
161+
SkCanvas::onClipRRect(rrect, op, style);
158162
}
159163

160164
void MockCanvas::onClipPath(const SkPath& path,
161165
SkClipOp op,
162166
ClipEdgeStyle style) {
163167
draw_calls_.emplace_back(
164168
DrawCall{current_layer_, ClipPathData{path, op, style}});
169+
// quickReject() is handled by base class and needs accurate clip information
170+
SkCanvas::onClipPath(path, op, style);
165171
}
166172

167173
bool MockCanvas::onDoSaveBehind(const SkRect*) {

0 commit comments

Comments
 (0)