~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without
 
5
 * modification, are permitted provided that the following conditions
 
6
 * are met:
 
7
 * 1. Redistributions of source code must retain the above copyright
 
8
 *    notice, this list of conditions and the following disclaimer.
 
9
 * 2. Redistributions in binary form must reproduce the above copyright
 
10
 *    notice, this list of conditions and the following disclaimer in the
 
11
 *    documentation and/or other materials provided with the distribution.
 
12
 *
 
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
24
 */
 
25
 
 
26
#ifndef CACFLayerTreeHost_h
 
27
#define CACFLayerTreeHost_h
 
28
 
 
29
#if USE(ACCELERATED_COMPOSITING)
 
30
 
 
31
#include "AbstractCACFLayerTreeHost.h"
 
32
#include "COMPtr.h"
 
33
#include "Timer.h"
 
34
 
 
35
#include <wtf/HashSet.h>
 
36
#include <wtf/PassRefPtr.h>
 
37
#include <wtf/RefCounted.h>
 
38
#include <wtf/RefPtr.h>
 
39
#include <wtf/RetainPtr.h>
 
40
#include <wtf/Vector.h>
 
41
 
 
42
#include <CoreGraphics/CGGeometry.h>
 
43
 
 
44
interface IDirect3DDevice9;
 
45
struct WKCACFContext;
 
46
 
 
47
typedef struct CGImage* CGImageRef;
 
48
 
 
49
#if USE(AVFOUNDATION)
 
50
struct GraphicsDeviceAdapter;
 
51
#endif
 
52
 
 
53
namespace WebCore {
 
54
 
 
55
class CACFLayerTreeHostClient;
 
56
class PlatformCALayer;
 
57
 
 
58
class CACFLayerTreeHost : public RefCounted<CACFLayerTreeHost>, private AbstractCACFLayerTreeHost {
 
59
public:
 
60
    static PassRefPtr<CACFLayerTreeHost> create();
 
61
    virtual ~CACFLayerTreeHost();
 
62
 
 
63
    static bool acceleratedCompositingAvailable();
 
64
 
 
65
    void setClient(CACFLayerTreeHostClient* client) { m_client = client; }
 
66
 
 
67
    void setRootChildLayer(PlatformCALayer*);
 
68
    void setWindow(HWND);
 
69
    virtual void paint();
 
70
    virtual void resize() = 0;
 
71
    void flushPendingGraphicsLayerChangesSoon();
 
72
    virtual void setShouldInvertColors(bool);
 
73
#if USE(AVFOUNDATION)
 
74
    virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; }
 
75
#endif
 
76
 
 
77
    // AbstractCACFLayerTreeHost
 
78
    virtual void flushPendingLayerChangesNow();
 
79
 
 
80
protected:
 
81
    CACFLayerTreeHost();
 
82
 
 
83
    CGRect bounds() const;
 
84
    HWND window() const { return m_window; }
 
85
    void notifyAnimationsStarted();
 
86
 
 
87
    // AbstractCACFLayerTreeHost
 
88
    virtual PlatformCALayer* rootLayer() const;
 
89
 
 
90
    virtual bool createRenderer() = 0;
 
91
    virtual void destroyRenderer();
 
92
    virtual void contextDidChange();
 
93
 
 
94
private:
 
95
    void initialize();
 
96
 
 
97
    // AbstractCACFLayerTreeHost
 
98
    virtual void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>);
 
99
    virtual void layerTreeDidChange();
 
100
 
 
101
 
 
102
    virtual void flushContext() = 0;
 
103
    virtual CFTimeInterval lastCommitTime() const = 0;
 
104
    virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()) = 0;
 
105
    virtual void initializeContext(void* userData, PlatformCALayer*) = 0;
 
106
 
 
107
    CACFLayerTreeHostClient* m_client;
 
108
    RefPtr<PlatformCALayer> m_rootLayer;
 
109
    RefPtr<PlatformCALayer> m_rootChildLayer;
 
110
    HashSet<RefPtr<PlatformCALayer> > m_pendingAnimatedLayers;
 
111
    HWND m_window;
 
112
    bool m_shouldFlushPendingGraphicsLayerChanges;
 
113
    bool m_isFlushingLayerChanges;
 
114
 
 
115
#if !ASSERT_DISABLED
 
116
    enum { WindowNotSet, WindowSet, WindowCleared } m_state;
 
117
#endif
 
118
};
 
119
 
 
120
}
 
121
 
 
122
#endif // USE(ACCELERATED_COMPOSITING)
 
123
 
 
124
#endif // CACFLayerTreeHost_h