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.
5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BACKING_STORE_H__
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BACKING_STORE_H__
10 #include "base/memory/scoped_ptr.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/gfx/size.h"
13 #include "ui/gfx/vector2d.h"
26 // The BrowserPluginBackingStore is a wrapper around an SkBitmap that is used
27 // in the software rendering path of the browser plugin. The backing store has
28 // two write operations:
29 // 1. PaintToBackingStore copies pixel regions to the bitmap.
30 // 2. ScrollBackingStore scrolls a region of the bitmap by dx, and dy.
31 // These are called in response to changes in the guest relayed via
32 // BrowserPluginMsg_UpdateRect. See BrowserPlugin::UpdateRect.
33 class BrowserPluginBackingStore
{
35 BrowserPluginBackingStore(const gfx::Size
& size
, float scale_factor
);
36 virtual ~BrowserPluginBackingStore();
38 void PaintToBackingStore(
39 const gfx::Rect
& bitmap_rect
,
40 const std::vector
<gfx::Rect
>& copy_rects
,
43 void ScrollBackingStore(const gfx::Vector2d
& delta
,
44 const gfx::Rect
& clip_rect
,
45 const gfx::Size
& view_size
);
47 void Clear(SkColor clear_color
);
49 const gfx::Size
& GetSize() const { return size_
; }
51 const SkBitmap
& GetBitmap() const { return bitmap_
; }
53 float GetScaleFactor() const { return scale_factor_
; }
58 scoped_ptr
<SkCanvas
> canvas_
;
61 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBackingStore
);
64 } // namespace content
66 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BACKING_STORE_H__