提交 2e684230 编写于 作者: C Chinmay Garde 提交者: GitHub

Simplify PictureLayer::Paint. (#2962)

上级 07b59dff
......@@ -23,15 +23,15 @@ void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
void PictureLayer::Paint(PaintContext& context) {
FTL_DCHECK(picture_);
TRACE_EVENT1("flutter", "PictureLayer::Paint", "image",
image_ ? "prerolled" : "normal");
SkAutoCanvasRestore save(&context.canvas, true);
context.canvas.translate(offset_.x(), offset_.y());
if (image_) {
TRACE_EVENT1("flutter", "PictureLayer::Paint", "image", "prerolled");
SkRect rect = picture_->cullRect().makeOffset(offset_.x(), offset_.y());
context.canvas.drawImageRect(image_.get(), rect, nullptr,
SkCanvas::kFast_SrcRectConstraint);
context.canvas.drawImage(image_.get(), 0, 0);
} else {
TRACE_EVENT1("flutter", "PictureLayer::Paint", "image", "normal");
SkAutoCanvasRestore save(&context.canvas, true);
context.canvas.translate(offset_.x(), offset_.y());
context.canvas.drawPicture(picture_.get());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册