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_SOFTWARE_OUTPUT_DEVICE_H_ | 5 #ifndef CC_SOFTWARE_OUTPUT_DEVICE_H_ |
6 #define CC_SOFTWARE_OUTPUT_DEVICE_H_ | 6 #define CC_SOFTWARE_OUTPUT_DEVICE_H_ |
7 | 7 |
8 #include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h" | 8 #include "cc/cc_export.h" |
| 9 #include "skia/ext/refptr.h" |
| 10 #include "ui/gfx/rect.h" |
9 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 #include "ui/gfx/vector2d.h" |
| 13 #include "ui/surface/transport_dib.h" |
| 14 |
| 15 class SkBitmap; |
| 16 class SkDevice; |
| 17 class SkCanvas; |
10 | 18 |
11 namespace cc { | 19 namespace cc { |
12 | 20 |
| 21 class SoftwareFrameData; |
| 22 |
13 // This is a "tear-off" class providing software drawing support to | 23 // This is a "tear-off" class providing software drawing support to |
14 // OutputSurface, such as to a platform-provided window framebuffer. | 24 // OutputSurface, such as to a platform-provided window framebuffer. |
15 class SoftwareOutputDevice { | 25 class CC_EXPORT SoftwareOutputDevice { |
16 public: | 26 public: |
17 virtual ~SoftwareOutputDevice() {} | |
18 | 27 |
19 // Lock the framebuffer and return a pointer to a WebImage referring to its | 28 SoftwareOutputDevice(); |
20 // pixels. Set forWrite if you intend to change the pixels. Readback | 29 virtual ~SoftwareOutputDevice(); |
21 // is supported whether or not forWrite is set. | |
22 // TODO(danakj): Switch this from WebImage to a Skia type. | |
23 virtual WebKit::WebImage* Lock(bool forWrite) = 0; | |
24 virtual void Unlock() = 0; | |
25 | 30 |
26 virtual void DidChangeViewportSize(gfx::Size) = 0; | 31 // SoftwareOutputDevice implementation |
| 32 virtual void Resize(const gfx::Size& size); |
| 33 |
| 34 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect); |
| 35 virtual void EndPaint(SoftwareFrameData* frame_data=NULL); |
| 36 |
| 37 virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output); |
| 38 virtual void Scroll(const gfx::Vector2d& delta, |
| 39 const gfx::Rect& clip_rect); |
| 40 |
| 41 // TODO(skaslev) Remove this after UberCompositor lands. |
| 42 virtual void ReclaimDIB(TransportDIB::Handle handle); |
| 43 |
| 44 protected: |
| 45 gfx::Size viewport_size_; |
| 46 gfx::Rect damage_rect_; |
| 47 skia::RefPtr<SkDevice> device_; |
| 48 skia::RefPtr<SkCanvas> canvas_; |
27 }; | 49 }; |
28 | 50 |
29 } // namespace cc | 51 } // namespace cc |
30 | 52 |
31 #endif // CC_SOFTWARE_OUTPUT_DEVICE_H_ | 53 #endif // CC_SOFTWARE_OUTPUT_DEVICE_H_ |
OLD | NEW |