Request quickReject results from correct drawing canvas (flutter/engine#22674)

Also Fix MockCanvas clipping so tests will work with new culling
This commit is contained in:
Jim Graham
2020-11-24 13:11:15 -08:00
committed by GitHub
parent 2260bb3fd7
commit b4a85a26ca
3 changed files with 8 additions and 1 deletions

View File

@@ -195,7 +195,7 @@ class Layer {
if (paint_bounds_.isEmpty()) {
return false;
}
return !context.internal_nodes_canvas->quickReject(paint_bounds_);
return !context.leaf_nodes_canvas->quickReject(paint_bounds_);
}
uint64_t unique_id() const { return unique_id_; }

View File

@@ -158,6 +158,7 @@ std::unique_ptr<RasterCacheResult> RasterCache::RasterizeLayer(
SkISize canvas_size = canvas->getBaseLayerSize();
SkNWayCanvas internal_nodes_canvas(canvas_size.width(),
canvas_size.height());
internal_nodes_canvas.setMatrix(canvas->getTotalMatrix());
internal_nodes_canvas.addCanvas(canvas);
Layer::PaintContext paintContext = {
/* internal_nodes_canvas= */ static_cast<SkCanvas*>(

View File

@@ -148,6 +148,8 @@ void MockCanvas::onClipRect(const SkRect& rect,
ClipEdgeStyle style) {
draw_calls_.emplace_back(
DrawCall{current_layer_, ClipRectData{rect, op, style}});
// quickReject() is handled by base class and needs accurate clip information
SkCanvas::onClipRect(rect, op, style);
}
void MockCanvas::onClipRRect(const SkRRect& rrect,
@@ -155,6 +157,8 @@ void MockCanvas::onClipRRect(const SkRRect& rrect,
ClipEdgeStyle style) {
draw_calls_.emplace_back(
DrawCall{current_layer_, ClipRRectData{rrect, op, style}});
// quickReject() is handled by base class and needs accurate clip information
SkCanvas::onClipRRect(rrect, op, style);
}
void MockCanvas::onClipPath(const SkPath& path,
@@ -162,6 +166,8 @@ void MockCanvas::onClipPath(const SkPath& path,
ClipEdgeStyle style) {
draw_calls_.emplace_back(
DrawCall{current_layer_, ClipPathData{path, op, style}});
// quickReject() is handled by base class and needs accurate clip information
SkCanvas::onClipPath(path, op, style);
}
bool MockCanvas::onDoSaveBehind(const SkRect*) {