OLD | NEW |
| (Empty) |
1 // Copyright (c) 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 CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BACKING_STORE_H__ | |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BACKING_STORE_H__ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "third_party/skia/include/core/SkBitmap.h" | |
12 #include "ui/gfx/size.h" | |
13 | |
14 class SkCanvas; | |
15 class TransportDIB; | |
16 | |
17 namespace gfx { | |
18 class Canvas; | |
19 class Point; | |
20 class Rect; | |
21 } | |
22 | |
23 namespace content { | |
24 | |
25 // The BrowserPluginBackingStore is a wrapper around an SkBitmap that is used | |
26 // in the software rendering path of the browser plugin. The backing store has | |
27 // two write operations: | |
28 // 1. PaintToBackingStore copies pixel regions to the bitmap. | |
29 // 2. ScrollBackingStore scrolls a region of the bitmap by dx, and dy. | |
30 // These are called in response to changes in the guest relayed via | |
31 // BrowserPluginMsg_UpdateRect. See BrowserPlugin::UpdateRect. | |
32 class BrowserPluginBackingStore { | |
33 public: | |
34 BrowserPluginBackingStore(const gfx::Size& size, float scale_factor); | |
35 virtual ~BrowserPluginBackingStore(); | |
36 | |
37 void PaintToBackingStore( | |
38 const gfx::Rect& bitmap_rect, | |
39 const std::vector<gfx::Rect>& copy_rects, | |
40 TransportDIB* dib); | |
41 | |
42 void ScrollBackingStore(int dx, | |
43 int dy, | |
44 const gfx::Rect& clip_rect, | |
45 const gfx::Size& view_size); | |
46 | |
47 const gfx::Size& GetSize() const { return size_; } | |
48 | |
49 const SkBitmap& GetBitmap() const { return bitmap_; } | |
50 | |
51 float GetScaleFactor() const { return scale_factor_; } | |
52 | |
53 private: | |
54 gfx::Size size_; | |
55 SkBitmap bitmap_; | |
56 scoped_ptr<SkCanvas> canvas_; | |
57 float scale_factor_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBackingStore); | |
60 }; | |
61 | |
62 } // namespace content | |
63 | |
64 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BACKING_STORE_H__ | |
OLD | NEW |