Skip to content

Commit

Permalink
Simplify PictureLayer::Paint. (flutter#2962)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Aug 22, 2016
1 parent 07b59df commit 2e68423
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions flow/layers/picture_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down

0 comments on commit 2e68423

Please sign in to comment.