OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "cc/output/software_output_device.h" | 11 #include "cc/output/software_output_device.h" |
10 | 12 |
11 #include <windows.h> | 13 #include <windows.h> |
12 | 14 |
13 namespace gfx { | 15 namespace base { |
14 class Canvas; | 16 class SharedMemory; |
15 } | 17 } |
16 | 18 |
17 namespace ui { | 19 namespace ui { |
18 class Compositor; | 20 class Compositor; |
19 } | 21 } |
20 | 22 |
21 namespace content { | 23 namespace content { |
| 24 class SoftwareOutputDeviceWin; |
| 25 |
| 26 class OutputDeviceBacking { |
| 27 public: |
| 28 OutputDeviceBacking(); |
| 29 ~OutputDeviceBacking(); |
| 30 |
| 31 void Resized(); |
| 32 void RegisterOutputDevice(SoftwareOutputDeviceWin* device); |
| 33 void UnregisterOutputDevice(SoftwareOutputDeviceWin* device); |
| 34 base::SharedMemory* GetSharedMemory(); |
| 35 |
| 36 private: |
| 37 size_t GetMaxByteSize(); |
| 38 |
| 39 std::vector<SoftwareOutputDeviceWin*> devices_; |
| 40 scoped_ptr<base::SharedMemory> backing_; |
| 41 size_t created_byte_size_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(OutputDeviceBacking); |
| 44 }; |
22 | 45 |
23 class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice { | 46 class SoftwareOutputDeviceWin : public cc::SoftwareOutputDevice { |
24 public: | 47 public: |
25 explicit SoftwareOutputDeviceWin(ui::Compositor* compositor); | 48 SoftwareOutputDeviceWin(OutputDeviceBacking* backing, |
| 49 ui::Compositor* compositor); |
26 ~SoftwareOutputDeviceWin() override; | 50 ~SoftwareOutputDeviceWin() override; |
27 | 51 |
28 void Resize(const gfx::Size& viewport_pixel_size, | 52 void Resize(const gfx::Size& viewport_pixel_size, |
29 float scale_factor) override; | 53 float scale_factor) override; |
30 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override; | 54 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override; |
31 void EndPaint(cc::SoftwareFrameData* frame_data) override; | 55 void EndPaint(cc::SoftwareFrameData* frame_data) override; |
32 | 56 |
| 57 gfx::Size viewport_pixel_size() const { return viewport_pixel_size_; } |
| 58 void ReleaseContents(); |
| 59 |
33 private: | 60 private: |
34 HWND hwnd_; | 61 HWND hwnd_; |
35 BITMAPINFO bitmap_info_; | 62 skia::RefPtr<SkCanvas> contents_; |
36 scoped_ptr<gfx::Canvas> contents_; | |
37 bool is_hwnd_composited_; | 63 bool is_hwnd_composited_; |
| 64 OutputDeviceBacking* backing_; |
| 65 bool in_paint_; |
38 | 66 |
39 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin); | 67 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceWin); |
40 }; | 68 }; |
41 | 69 |
42 } // namespace content | 70 } // namespace content |
43 | 71 |
44 #endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_ | 72 #endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_WIN_H_ |
OLD | NEW |