|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set sw=2 ts=8 et ft=cpp : */ |
|
3 /* Copyright 2012 Mozilla Foundation and Mozilla contributors |
|
4 * |
|
5 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 * you may not use this file except in compliance with the License. |
|
7 * You may obtain a copy of the License at |
|
8 * |
|
9 * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 * |
|
11 * Unless required by applicable law or agreed to in writing, software |
|
12 * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 * See the License for the specific language governing permissions and |
|
15 * limitations under the License. |
|
16 */ |
|
17 |
|
18 class gfxASurface; |
|
19 class nsIntRegion; |
|
20 class nsIntSize; |
|
21 |
|
22 namespace mozilla { |
|
23 |
|
24 namespace Framebuffer { |
|
25 |
|
26 // |
|
27 // The general usage of Framebuffer is |
|
28 // |
|
29 // -- in initialization code -- |
|
30 // Open(); |
|
31 // |
|
32 // -- ready to paint next frame -- |
|
33 // nsRefPtr<gfxASurface> backBuffer = BackBuffer(); |
|
34 // // ... |
|
35 // Paint(backBuffer); |
|
36 // // ... |
|
37 // Present(); |
|
38 // |
|
39 |
|
40 // Return true if the fbdev was successfully opened. If this fails, |
|
41 // the result of all further calls is undefined. Open() is idempotent. |
|
42 bool Open(); |
|
43 |
|
44 // After Close(), the result of all further calls is undefined. |
|
45 // Close() is idempotent, and Open() can be called again after |
|
46 // Close(). |
|
47 void Close(); |
|
48 |
|
49 // Return true if the fbdev was successfully opened or the size was |
|
50 // already cached. |
|
51 bool GetSize(nsIntSize *aScreenSize); |
|
52 |
|
53 // Return the buffer to be drawn into, that will be the next frame. |
|
54 gfxASurface* BackBuffer(); |
|
55 |
|
56 // Swap the front buffer for the back buffer. |aUpdated| is the |
|
57 // region of the back buffer that was repainted. |
|
58 void Present(const nsIntRegion& aUpdated); |
|
59 |
|
60 } // namespace Framebuffer |
|
61 |
|
62 } // namespace mozilla |