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

« back to all changes in this revision

Viewing changes to Source/WebCore/platform/graphics/blackberry/PluginLayerWebKitThread.cpp

  • 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) 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
 
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
#include "config.h"
 
20
#include "PluginLayerWebKitThread.h"
 
21
 
 
22
#if USE(ACCELERATED_COMPOSITING)
 
23
 
 
24
#include "LayerCompositingThread.h"
 
25
#include "PluginView.h"
 
26
 
 
27
namespace WebCore {
 
28
 
 
29
PluginLayerWebKitThread::PluginLayerWebKitThread(PluginView* pluginView)
 
30
    : LayerWebKitThread(Layer, 0)
 
31
    , m_needsDisplay(false)
 
32
{
 
33
    setPluginView(pluginView);
 
34
}
 
35
 
 
36
PluginLayerWebKitThread::~PluginLayerWebKitThread()
 
37
{
 
38
}
 
39
 
 
40
void PluginLayerWebKitThread::setPluginView(PluginView* pluginView)
 
41
{
 
42
    m_pluginView = pluginView;
 
43
    setNeedsTexture(isDrawable() && pluginView);
 
44
    setLayerProgramShader(LayerProgramShaderRGBA);
 
45
 
 
46
    if (m_pluginView)
 
47
        setNeedsDisplay();
 
48
    else {
 
49
        // We can't afford to wait until the next commit
 
50
        // to set the m_pluginView to 0 in the impl, because it is
 
51
        // about to be destroyed.
 
52
        layerCompositingThread()->setPluginView(0);
 
53
        setNeedsCommit();
 
54
    }
 
55
}
 
56
 
 
57
void PluginLayerWebKitThread::setHolePunchRect(const IntRect& rect)
 
58
{
 
59
    m_holePunchRect = rect;
 
60
    setNeedsCommit();
 
61
}
 
62
 
 
63
void PluginLayerWebKitThread::setNeedsDisplay()
 
64
{
 
65
    m_needsDisplay = true;
 
66
    setNeedsCommit();
 
67
}
 
68
 
 
69
void PluginLayerWebKitThread::updateTextureContentsIfNeeded()
 
70
{
 
71
    if (!m_needsDisplay)
 
72
        return;
 
73
 
 
74
    m_needsDisplay = false;
 
75
 
 
76
    if (!m_pluginView)
 
77
        return;
 
78
 
 
79
    m_pluginView->updateBuffer(IntRect(IntPoint::zero(), m_pluginView->size()));
 
80
}
 
81
 
 
82
} // namespace WebCore
 
83
 
 
84
#endif // USE(ACCELERATED_COMPOSITING)