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 24 matching lines...) Expand all Loading... |
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(gfx::Size size); | 39 virtual void Resize(gfx::Size size); |
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(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. |
50 virtual void EndPaint(SoftwareFrameData* frame_data); | 50 virtual void EndPaint(SoftwareFrameData* frame_data); |
51 | 51 |
52 // Copies pixels inside |rect| from the current software framebuffer to | 52 // Copies pixels inside |rect| from the current software framebuffer to |
53 // |output|. Fails if there is no current softwareframebuffer. | 53 // |output|. Fails if there is no current softwareframebuffer. |
54 virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output); | 54 virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output); |
55 | 55 |
56 // Blit the pixel content of the SoftwareOutputDevice by |delta| with the | 56 // Blit the pixel content of the SoftwareOutputDevice by |delta| with the |
57 // write clipped to |clip_rect|. | 57 // write clipped to |clip_rect|. |
58 virtual void Scroll(gfx::Vector2d delta, | 58 virtual void Scroll(gfx::Vector2d delta, |
59 gfx::Rect clip_rect); | 59 const gfx::Rect& clip_rect); |
60 | 60 |
61 // Discard the backing buffer in the surface provided by this instance. | 61 // Discard the backing buffer in the surface provided by this instance. |
62 virtual void DiscardBackbuffer() {} | 62 virtual void DiscardBackbuffer() {} |
63 | 63 |
64 // Ensures that there is a backing buffer available on this instance. | 64 // Ensures that there is a backing buffer available on this instance. |
65 virtual void EnsureBackbuffer() {} | 65 virtual void EnsureBackbuffer() {} |
66 | 66 |
67 // TODO(skaslev) Remove this after UberCompositor lands. | 67 // TODO(skaslev) Remove this after UberCompositor lands. |
68 // Called in response to receiving a SwapBuffersAck. At this point, software | 68 // Called in response to receiving a SwapBuffersAck. At this point, software |
69 // frame identified by id can be reused or discarded as it is no longer being | 69 // frame identified by id can be reused or discarded as it is no longer being |
(...skipping 11 matching lines...) Expand all Loading... |
81 skia::RefPtr<SkCanvas> canvas_; | 81 skia::RefPtr<SkCanvas> canvas_; |
82 scoped_ptr<gfx::VSyncProvider> vsync_provider_; | 82 scoped_ptr<gfx::VSyncProvider> vsync_provider_; |
83 | 83 |
84 private: | 84 private: |
85 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDevice); | 85 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDevice); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace cc | 88 } // namespace cc |
89 | 89 |
90 #endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ | 90 #endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ |
OLD | NEW |