OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 WEBKIT_TOOLS_TEST_SHELL_SIMPLE_WEBPAINTSURFACE_IMPL_H_ |
| 6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_WEBPAINTSURFACE_IMPL_H_ |
| 7 |
| 8 #include "gfx/rect.h" |
| 9 #include "skia/ext/platform_canvas.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPaintSurface.h" |
| 11 |
| 12 class SimpleWebPaintSurfaceImpl : public WebKit::WebPaintSurface { |
| 13 public: |
| 14 class Delegate { |
| 15 public: |
| 16 // Called when the paint surface is modified. In response to this method, |
| 17 // the delegate should asynchronously call DidCopyPaintSurface, which will |
| 18 // permit further modifications to the paint surface. |
| 19 virtual void DidModifyPaintSurface(const gfx::Rect& bounds) = 0; |
| 20 }; |
| 21 |
| 22 SimpleWebPaintSurfaceImpl(Delegate* delegate, const gfx::Size& size); |
| 23 ~SimpleWebPaintSurfaceImpl(); |
| 24 |
| 25 const gfx::Size& size() const { return size_; } |
| 26 skia::PlatformCanvas* canvas() { return &canvas_; } |
| 27 |
| 28 // Called asynchronously in response to DidModifyPaintSurface. |
| 29 void DidCopyPaintSurface(); |
| 30 |
| 31 private: |
| 32 // WebKit::WebPaintSurface methods: |
| 33 virtual void setClient(WebKit::WebPaintSurfaceClient* client); |
| 34 virtual WebKit::WebPaintBuffer* createBuffer(const WebKit::WebSize& size); |
| 35 virtual void paint(WebKit::WebPaintBuffer* buffer, |
| 36 const WebKit::WebPoint& destination_point, |
| 37 const WebKit::WebRect& source_rect); |
| 38 virtual void scroll(const WebKit::WebRect& clip_rect, |
| 39 const WebKit::WebPoint& scroll_delta); |
| 40 virtual bool flush(); |
| 41 |
| 42 Delegate* delegate_; |
| 43 gfx::Size size_; |
| 44 skia::PlatformCanvas canvas_; |
| 45 WebKit::WebPaintSurfaceClient* client_; |
| 46 gfx::Rect damage_bounds_; |
| 47 bool flushing_; |
| 48 }; |
| 49 |
| 50 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_WEBPAINTSURFACE_IMPL_H_ |
OLD | NEW |