Remove unused parameter.
[chromium-blink-merge.git] / ui / ozone / demo / software_renderer.cc
blob3cf621ddb266abb2fe795c19ecbcf467ef4ee097
1 // Copyright 2014 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/ozone/demo/software_renderer.h"
7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkSurface.h"
9 #include "ui/ozone/public/surface_factory_ozone.h"
10 #include "ui/ozone/public/surface_ozone_canvas.h"
12 namespace ui {
14 SoftwareRenderer::SoftwareRenderer(gfx::AcceleratedWidget widget,
15 const gfx::Size& size)
16 : RendererBase(widget, size) {
19 SoftwareRenderer::~SoftwareRenderer() {
22 bool SoftwareRenderer::Initialize() {
23 software_surface_ =
24 ui::SurfaceFactoryOzone::GetInstance()->CreateCanvasForWidget(widget_);
25 if (!software_surface_) {
26 LOG(ERROR) << "Failed to create software surface";
27 return false;
30 software_surface_->ResizeCanvas(size_);
31 return true;
34 void SoftwareRenderer::RenderFrame() {
35 float fraction = NextFraction();
37 skia::RefPtr<SkSurface> surface = software_surface_->GetSurface();
39 SkColor color =
40 SkColorSetARGB(0xff, 0, 0xff * fraction, 0xff * (1 - fraction));
42 surface->getCanvas()->clear(color);
44 software_surface_->PresentCanvas(gfx::Rect(size_));
47 } // namespace ui