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