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_WIN_H_
6#define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "cc/output/software_output_device.h"
10
11#include <windows.h>
12
13namespace gfx {
14class Canvas;
15}
16
17namespace ui {
18class Compositor;
19}
20
21namespace content {
22
23class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice {
24 public:
25  explicit SoftwareOutputDeviceWin(ui::Compositor* compositor);
26  virtual ~SoftwareOutputDeviceWin();
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  virtual void CopyToPixels(const gfx::Rect& rect, void* pixels) OVERRIDE;
33
34 private:
35  HWND hwnd_;
36  BITMAPINFO bitmap_info_;
37  scoped_ptr<gfx::Canvas> contents_;
38  bool is_hwnd_composited_;
39
40  DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin);
41};
42
43}  // namespace content
44
45#endif  // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
46