Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / compositor / canvas_painter.cc
blob618fa753b7b39beafb4310f834ef637ad9f75006
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/compositor/canvas_painter.h"
7 #include "cc/playback/display_item_list.h"
8 #include "cc/playback/display_item_list_settings.h"
9 #include "ui/gfx/canvas.h"
11 namespace ui {
13 CanvasPainter::CanvasPainter(gfx::Canvas* canvas, float raster_scale_factor)
14 : canvas_(canvas),
15 raster_scale_factor_(raster_scale_factor),
16 rect_(gfx::ScaleToEnclosedRect(
17 gfx::Rect(canvas_->sk_canvas()->getBaseLayerSize().width(),
18 canvas_->sk_canvas()->getBaseLayerSize().height()),
19 1.f / raster_scale_factor)),
20 list_(cc::DisplayItemList::Create(rect_, cc::DisplayItemListSettings())),
21 context_(list_.get(), raster_scale_factor_, rect_) {
24 CanvasPainter::~CanvasPainter() {
25 list_->Finalize();
26 list_->Raster(canvas_->sk_canvas(), nullptr, rect_, raster_scale_factor_);
29 } // namespace ui