OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ | 5 #ifndef CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ |
6 #define CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ | 6 #define CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // This is a "tear-off" class providing software drawing support to | 29 // This is a "tear-off" class providing software drawing support to |
30 // OutputSurface, such as to a platform-provided window framebuffer. | 30 // OutputSurface, such as to a platform-provided window framebuffer. |
31 class CC_EXPORT SoftwareOutputDevice { | 31 class CC_EXPORT SoftwareOutputDevice { |
32 public: | 32 public: |
33 SoftwareOutputDevice(); | 33 SoftwareOutputDevice(); |
34 virtual ~SoftwareOutputDevice(); | 34 virtual ~SoftwareOutputDevice(); |
35 | 35 |
36 // Discards any pre-existing backing buffers and allocates memory for a | 36 // Discards any pre-existing backing buffers and allocates memory for a |
37 // software device of |size|. This must be called before the | 37 // software device of |size|. This must be called before the |
38 // |SoftwareOutputDevice| can be used in other ways. | 38 // |SoftwareOutputDevice| can be used in other ways. |
39 virtual void Resize(const gfx::Size& size); | 39 virtual void Resize(const gfx::Size& pixel_size, float scale_factor); |
40 | 40 |
41 // Called on BeginDrawingFrame. The compositor will draw into the returned | 41 // Called on BeginDrawingFrame. The compositor will draw into the returned |
42 // SkCanvas. The |SoftwareOutputDevice| implementation needs to provide a | 42 // SkCanvas. The |SoftwareOutputDevice| implementation needs to provide a |
43 // valid SkCanvas of at least size |damage_rect|. This class retains ownership | 43 // valid SkCanvas of at least size |damage_rect|. This class retains ownership |
44 // of the SkCanvas. | 44 // of the SkCanvas. |
45 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect); | 45 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect); |
46 | 46 |
47 // Called on FinishDrawingFrame. The compositor will no longer mutate the the | 47 // Called on FinishDrawingFrame. The compositor will no longer mutate the the |
48 // SkCanvas instance returned by |BeginPaint| and should discard any reference | 48 // SkCanvas instance returned by |BeginPaint| and should discard any reference |
49 // that it holds to it. | 49 // that it holds to it. |
(...skipping 17 matching lines...) Expand all Loading... |
67 // Called in response to receiving a SwapBuffersAck. At this point, software | 67 // Called in response to receiving a SwapBuffersAck. At this point, software |
68 // frame identified by id can be reused or discarded as it is no longer being | 68 // frame identified by id can be reused or discarded as it is no longer being |
69 // displayed. | 69 // displayed. |
70 virtual void ReclaimSoftwareFrame(unsigned id); | 70 virtual void ReclaimSoftwareFrame(unsigned id); |
71 | 71 |
72 // VSyncProvider used to update the timer used to schedule draws with the | 72 // VSyncProvider used to update the timer used to schedule draws with the |
73 // hardware vsync. Return NULL if a provider doesn't exist. | 73 // hardware vsync. Return NULL if a provider doesn't exist. |
74 virtual gfx::VSyncProvider* GetVSyncProvider(); | 74 virtual gfx::VSyncProvider* GetVSyncProvider(); |
75 | 75 |
76 protected: | 76 protected: |
77 gfx::Size viewport_size_; | 77 gfx::Size viewport_pixel_size_; |
| 78 float scale_factor_; |
78 gfx::Rect damage_rect_; | 79 gfx::Rect damage_rect_; |
79 skia::RefPtr<SkCanvas> canvas_; | 80 skia::RefPtr<SkCanvas> canvas_; |
80 scoped_ptr<gfx::VSyncProvider> vsync_provider_; | 81 scoped_ptr<gfx::VSyncProvider> vsync_provider_; |
81 | 82 |
82 private: | 83 private: |
83 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDevice); | 84 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDevice); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace cc | 87 } // namespace cc |
87 | 88 |
88 #endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ | 89 #endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ |
OLD | NEW |