Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim:set ts=4 sw=2 sts=2 et: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef GFX_LAYERSCOPE_H
8
#define GFX_LAYERSCOPE_H
9
10
#include <stdint.h>
11
#include <mozilla/UniquePtr.h>
12
#include "gfxMatrix.h"
13
#include "mozilla/gfx/Rect.h"
14
15
namespace mozilla {
16
17
namespace gl {
18
class GLContext;
19
}
20
21
namespace layers {
22
23
namespace layerscope {
24
class Packet;
25
}
26
27
struct EffectChain;
28
class LayerComposite;
29
class TextureHost;
30
31
class LayerScope {
32
public:
33
static void DrawBegin();
34
static void SetRenderOffset(float aX, float aY);
35
static void SetLayerTransform(const gfx::Matrix4x4& aMatrix);
36
static void SetDrawRects(size_t aRects, const gfx::Rect* aLayerRects,
37
const gfx::Rect* aTextureRects);
38
static void DrawEnd(gl::GLContext* aGLContext,
39
const EffectChain& aEffectChain, int aWidth, int aHeight);
40
41
static void SendLayer(LayerComposite* aLayer, int aWidth, int aHeight);
42
static void SendLayerDump(UniquePtr<layerscope::Packet> aPacket);
43
static bool CheckSendable();
44
static void CleanLayer();
45
static void SetHWComposed();
46
47
static void SetPixelScale(double devPixelsPerCSSPixel);
48
static void ContentChanged(TextureHost* host);
49
50
private:
51
static void Init();
52
};
53
54
// Perform BeginFrame and EndFrame automatically
55
class LayerScopeAutoFrame final {
56
public:
57
explicit LayerScopeAutoFrame(int64_t aFrameStamp);
58
~LayerScopeAutoFrame();
59
60
private:
61
static void BeginFrame(int64_t aFrameStamp);
62
static void EndFrame();
63
};
64
65
} // namespace layers
66
} // namespace mozilla
67
68
#endif /* GFX_LAYERSCOPE_H */