OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_SKIA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_SKIA_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_SKIA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_SKIA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
13 | 13 |
14 class SkCanvas; | 14 class SkCanvas; |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Point; | 17 class Point; |
18 class Canvas; | 18 class Canvas; |
19 } | 19 } |
20 | 20 |
| 21 namespace content { |
| 22 class RenderProcessHost; |
| 23 } |
| 24 |
21 // A backing store that uses skia. This is a temporary backing store used by | 25 // A backing store that uses skia. This is a temporary backing store used by |
22 // RenderWidgetHostViewViews. In time, only GPU rendering will be used for | 26 // RenderWidgetHostViewViews. In time, only GPU rendering will be used for |
23 // RWHVV, and then this backing store will be removed. | 27 // RWHVV, and then this backing store will be removed. |
24 class BackingStoreSkia : public BackingStore { | 28 class BackingStoreSkia : public BackingStore { |
25 public: | 29 public: |
26 CONTENT_EXPORT BackingStoreSkia( | 30 CONTENT_EXPORT BackingStoreSkia( |
27 RenderWidgetHost* widget, | 31 RenderWidgetHost* widget, |
28 const gfx::Size& size); | 32 const gfx::Size& size); |
29 | 33 |
30 virtual ~BackingStoreSkia(); | 34 virtual ~BackingStoreSkia(); |
31 | 35 |
32 CONTENT_EXPORT void SkiaShowRect(const gfx::Point& point, | 36 CONTENT_EXPORT void SkiaShowRect(const gfx::Point& point, |
33 gfx::Canvas* canvas); | 37 gfx::Canvas* canvas); |
34 | 38 |
35 // BackingStore implementation. | 39 // BackingStore implementation. |
36 virtual size_t MemorySize() OVERRIDE; | 40 virtual size_t MemorySize() OVERRIDE; |
37 virtual void PaintToBackingStore( | 41 virtual void PaintToBackingStore( |
38 RenderProcessHost* process, | 42 content::RenderProcessHost* process, |
39 TransportDIB::Id bitmap, | 43 TransportDIB::Id bitmap, |
40 const gfx::Rect& bitmap_rect, | 44 const gfx::Rect& bitmap_rect, |
41 const std::vector<gfx::Rect>& copy_rects, | 45 const std::vector<gfx::Rect>& copy_rects, |
42 const base::Closure& completion_callback, | 46 const base::Closure& completion_callback, |
43 bool* scheduled_completion_callback) OVERRIDE; | 47 bool* scheduled_completion_callback) OVERRIDE; |
44 virtual bool CopyFromBackingStore(const gfx::Rect& rect, | 48 virtual bool CopyFromBackingStore(const gfx::Rect& rect, |
45 skia::PlatformCanvas* output) OVERRIDE; | 49 skia::PlatformCanvas* output) OVERRIDE; |
46 virtual void ScrollBackingStore(int dx, int dy, | 50 virtual void ScrollBackingStore(int dx, int dy, |
47 const gfx::Rect& clip_rect, | 51 const gfx::Rect& clip_rect, |
48 const gfx::Size& view_size) OVERRIDE; | 52 const gfx::Size& view_size) OVERRIDE; |
49 | 53 |
50 private: | 54 private: |
51 SkBitmap bitmap_; | 55 SkBitmap bitmap_; |
52 | 56 |
53 scoped_ptr<SkCanvas> canvas_; | 57 scoped_ptr<SkCanvas> canvas_; |
54 | 58 |
55 DISALLOW_COPY_AND_ASSIGN(BackingStoreSkia); | 59 DISALLOW_COPY_AND_ASSIGN(BackingStoreSkia); |
56 }; | 60 }; |
57 | 61 |
58 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_SKIA_H_ | 62 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_SKIA_H_ |
OLD | NEW |