~raof/mir/prober-drm-device-probe

« back to all changes in this revision

Viewing changes to include/mir_test_doubles/mock_renderable.h

  • Committer: Tarmac
  • Author(s): Kevin DuBois, Alan Griffiths
  • Date: 2012-12-21 17:22:03 UTC
  • mfrom: (308.2.43 hold-resource-over-draw)
  • Revision ID: tarmac-20121221172203-0ivamoj1ww8pd2rk
compositor: hold graphic buffer resources from the time that the GL commands are issued until the time that the driver is done using them. Fixes a rendering glitch that pops up especially during triple buffer or full screen windows on android drivers.

Approved by PS Jenkins bot, Alan Griffiths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2012 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
 
17
 */
 
18
#ifndef MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_
 
19
#define MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_
 
20
 
 
21
#include "mir/graphics/renderable.h"
 
22
#include "mir_test_doubles/mock_graphic_region.h"
 
23
#include <gmock/gmock.h>
 
24
 
 
25
namespace mir
 
26
{
 
27
namespace test
 
28
{
 
29
namespace doubles
 
30
{
 
31
 
 
32
class MockRenderable :  public graphics::Renderable
 
33
{
 
34
public:
 
35
    MockRenderable()
 
36
     : region(std::make_shared<MockGraphicRegion>()),
 
37
       comp_resource(std::make_shared<compositor::GraphicBufferCompositorResource>(region))
 
38
    {
 
39
        using namespace testing;
 
40
        ON_CALL(*this, texture())
 
41
            .WillByDefault(Return(comp_resource));
 
42
    }
 
43
    MOCK_CONST_METHOD0(top_left, geometry::Point());
 
44
    MOCK_CONST_METHOD0(size, geometry::Size());
 
45
    MOCK_CONST_METHOD0(texture, std::shared_ptr<compositor::GraphicBufferCompositorResource>());
 
46
    MOCK_CONST_METHOD0(transformation, glm::mat4());
 
47
    MOCK_CONST_METHOD0(alpha, float());
 
48
    MOCK_CONST_METHOD0(hidden, bool());
 
49
 
 
50
    std::shared_ptr<compositor::GraphicRegion> const region;
 
51
    std::shared_ptr<compositor::GraphicBufferCompositorResource> const comp_resource;
 
52
};
 
53
 
 
54
}
 
55
}
 
56
}
 
57
#endif /* MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_ */