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.
4
5#ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_OZONE_H_
6#define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_OZONE_H_
7
8#include "cc/output/software_output_device.h"
9#include "content/common/content_export.h"
10#include "ui/gfx/native_widget_types.h"
11
12namespace ui {
13class Compositor;
14class SurfaceOzoneCanvas;
15}
16
17namespace content {
18
19// Ozone implementation which relies on software rendering. Ozone will present
20// an accelerated widget as a SkCanvas. SoftwareOutputDevice will then use the
21// Ozone provided canvas to draw.
22class CONTENT_EXPORT SoftwareOutputDeviceOzone
23    : public cc::SoftwareOutputDevice {
24 public:
25  explicit SoftwareOutputDeviceOzone(ui::Compositor* compositor);
26  virtual ~SoftwareOutputDeviceOzone();
27
28  virtual void Resize(const gfx::Size& viewport_pixel_size,
29                      float scale_factor) OVERRIDE;
30  virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE;
31  virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE;
32
33 private:
34  ui::Compositor* compositor_;
35
36  scoped_ptr<ui::SurfaceOzoneCanvas> surface_ozone_;
37
38  DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceOzone);
39};
40
41}  // namespace content
42
43#endif  // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_OZONE_H_
44