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 3 // found in the LICENSE file. 4 5 #ifndef CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ 6 #define CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ 7 8 #include "base/basictypes.h" 9 #include "cc/base/cc_export.h" 10 #include "skia/ext/refptr.h" 11 #include "ui/gfx/rect.h" 12 #include "ui/gfx/size.h" 13 #include "ui/gfx/vector2d.h" 14 15 class SkBitmap; 16 class SkDevice; 17 class SkCanvas; 18 19 namespace cc { 20 21 class SoftwareFrameData; 22 23 // This is a "tear-off" class providing software drawing support to 24 // OutputSurface, such as to a platform-provided window framebuffer. 25 class CC_EXPORT SoftwareOutputDevice { 26 public: 27 SoftwareOutputDevice(); 28 virtual ~SoftwareOutputDevice(); 29 30 // SoftwareOutputDevice implementation. 31 virtual void Resize(gfx::Size size); 32 33 virtual SkCanvas* BeginPaint(gfx::Rect damage_rect); 34 virtual void EndPaint(SoftwareFrameData* frame_data); 35 36 virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output); 37 virtual void Scroll(gfx::Vector2d delta, 38 gfx::Rect clip_rect); 39 40 // TODO(skaslev) Remove this after UberCompositor lands. 41 virtual void ReclaimSoftwareFrame(unsigned id); 42 43 protected: 44 gfx::Size viewport_size_; 45 gfx::Rect damage_rect_; 46 skia::RefPtr<SkDevice> device_; 47 skia::RefPtr<SkCanvas> canvas_; 48 49 private: 50 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDevice); 51 }; 52 53 } // namespace cc 54 55 #endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ 56