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 #ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
6 #define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/output/software_output_device.h"
24 class SoftwareOutputDeviceWin
;
26 class OutputDeviceBacking
{
28 OutputDeviceBacking();
29 ~OutputDeviceBacking();
32 void RegisterOutputDevice(SoftwareOutputDeviceWin
* device
);
33 void UnregisterOutputDevice(SoftwareOutputDeviceWin
* device
);
34 base::SharedMemory
* GetSharedMemory();
37 size_t GetMaxByteSize();
39 std::vector
<SoftwareOutputDeviceWin
*> devices_
;
40 scoped_ptr
<base::SharedMemory
> backing_
;
41 size_t created_byte_size_
;
43 DISALLOW_COPY_AND_ASSIGN(OutputDeviceBacking
);
46 class SoftwareOutputDeviceWin
: public cc::SoftwareOutputDevice
{
48 SoftwareOutputDeviceWin(OutputDeviceBacking
* backing
,
49 ui::Compositor
* compositor
);
50 ~SoftwareOutputDeviceWin() override
;
52 void Resize(const gfx::Size
& viewport_pixel_size
,
53 float scale_factor
) override
;
54 SkCanvas
* BeginPaint(const gfx::Rect
& damage_rect
) override
;
55 void EndPaint() override
;
57 gfx::Size
viewport_pixel_size() const { return viewport_pixel_size_
; }
58 void ReleaseContents();
62 skia::RefPtr
<SkCanvas
> contents_
;
63 bool is_hwnd_composited_
;
64 OutputDeviceBacking
* backing_
;
67 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin
);
70 } // namespace content
72 #endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_