tagging audio streams and changing audio sink to pulseaudio
[profile/ivi/webkit-efl.git] / Source / WebCore / platform / graphics / GraphicsLayerClient.h
1 /*
2  * Copyright (C) 2009 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 GraphicsLayerClient_h
27 #define GraphicsLayerClient_h
28
29 #if USE(ACCELERATED_COMPOSITING)
30
31 namespace WebCore {
32
33 class GraphicsContext;
34 class GraphicsLayer;
35 class IntPoint;
36 class IntRect;
37 class FloatPoint;
38 #if PLATFORM(EFL)
39 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
40 #if USE(TEXTURE_MAPPER)
41 class TextureMapperPlatformLayer;
42 typedef TextureMapperPlatformLayer PlatformLayer;
43 #else
44 class EflLayer;
45 typedef EflLayer PlatformLayer;
46 #endif // USE(TEXTURE_MAPPER)
47 #endif // ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
48 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
49 class RenderBoxModelObject;
50 #endif
51 #endif
52
53 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
54 enum GraphicsLayerPaintingPhaseFlags {
55 #else
56 enum GraphicsLayerPaintingPhase {
57 #endif
58     GraphicsLayerPaintBackground = (1 << 0),
59     GraphicsLayerPaintForeground = (1 << 1),
60     GraphicsLayerPaintMask = (1 << 2),
61 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
62     GraphicsLayerPaintOverflowContents = (1 << 3),
63 #endif
64     GraphicsLayerPaintAll = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask)
65 };
66 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
67 typedef unsigned GraphicsLayerPaintingPhase;
68 #endif
69
70 enum AnimatedPropertyID {
71     AnimatedPropertyInvalid,
72     AnimatedPropertyWebkitTransform,
73     AnimatedPropertyOpacity,
74     AnimatedPropertyBackgroundColor,
75     AnimatedPropertyWebkitFilter
76 };
77
78 class GraphicsLayerClient {
79 public:
80     virtual ~GraphicsLayerClient() {}
81
82     virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
83     virtual bool usingTileCache(const GraphicsLayer*) const { return false; }
84     
85     // Callback for when hardware-accelerated animation started.
86     virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0;
87
88     // Notification that a layer property changed that requires a subsequent call to syncCompositingState()
89     // to appear on the screen.
90     virtual void notifySyncRequired(const GraphicsLayer*) = 0;
91     
92     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) = 0;
93     virtual void didCommitChangesForLayer(const GraphicsLayer*) const { }
94
95     // Multiplier for backing store size, related to high DPI.
96     virtual float deviceScaleFactor() const { return 1; }
97     // Page scale factor.
98     virtual float pageScaleFactor() const { return 1; }
99
100     virtual bool showDebugBorders(const GraphicsLayer*) const = 0;
101     virtual bool showRepaintCounter(const GraphicsLayer*) const = 0;
102
103 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
104     virtual void platformLayerChanged(GraphicsLayer*, PlatformLayer* oldPlatformLayer, PlatformLayer* newPlatformLayer) = 0;
105 #endif
106 #if ENABLE(TIZEN_ACCELERATED_COMPOSITING)
107     virtual RenderBoxModelObject* renderer() const { return 0; }
108 #endif
109 #ifndef NDEBUG
110     // RenderLayerBacking overrides this to verify that it is not
111     // currently painting contents. An ASSERT fails, if it is.
112     // This is executed in GraphicsLayer construction and destruction
113     // to verify that we don't create or destroy GraphicsLayers
114     // while painting.
115     virtual void verifyNotPainting() { }
116 #endif
117 };
118
119 } // namespace WebCore
120
121 #endif // USE(ACCELERATED_COMPOSITING)
122
123 #endif // GraphicsLayerClient_h