1/*
2 * Copyright (C) 2011, Igalia S.L.
3 *
4 *  This library is free software; you can redistribute it and/or
5 *  modify it under the terms of the GNU Lesser General Public
6 *  License as published by the Free Software Foundation; either
7 *  version 2 of the License, or (at your option) any later version.
8 *
9 *  This library is distributed in the hope that it will be useful,
10 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 *  Lesser General Public License for more details.
13 *
14 *  You should have received a copy of the GNU Lesser General Public
15 *  License along with this library; if not, write to the Free Software
16 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19#ifndef WidgetBackingStore_h
20#define WidgetBackingStore_h
21
22#include "IntRect.h"
23#include "IntSize.h"
24#include <wtf/FastMalloc.h>
25#include <wtf/Noncopyable.h>
26#include <wtf/PassOwnPtr.h>
27
28#if PLATFORM(GTK)
29#include <gtk/gtk.h>
30#elif PLATFORM(EFL)
31#include <Evas.h>
32#endif
33
34typedef struct _cairo_surface cairo_surface_t;
35
36namespace WebCore {
37
38#if PLATFORM(GTK)
39typedef GtkWidget* PlatformWidget;
40#elif PLATFORM(EFL)
41typedef Evas_Object* PlatformWidget;
42#endif
43
44class WidgetBackingStore {
45    WTF_MAKE_NONCOPYABLE(WidgetBackingStore);
46    WTF_MAKE_FAST_ALLOCATED;
47
48public:
49    virtual cairo_surface_t* cairoSurface() = 0;
50    virtual void scroll(const IntRect& scrollRect, const IntSize& scrollOffset) = 0;
51    const IntSize& size() { return m_size; }
52
53    WidgetBackingStore(const IntSize& size, float deviceScaleFactor)
54        : m_size(size)
55        , m_deviceScaleFactor(deviceScaleFactor)
56    { }
57
58    virtual ~WidgetBackingStore() { }
59
60protected:
61    IntSize m_size;
62    float m_deviceScaleFactor;
63};
64
65} // namespace WebCore
66
67#endif // WidgetBackingStore_h
68