widget/gonk/Framebuffer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gonk/Framebuffer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set sw=2 ts=8 et ft=cpp : */
     1.6 +/* Copyright 2012 Mozilla Foundation and Mozilla contributors
     1.7 + *
     1.8 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.9 + * you may not use this file except in compliance with the License.
    1.10 + * You may obtain a copy of the License at
    1.11 + *
    1.12 + *     http://www.apache.org/licenses/LICENSE-2.0
    1.13 + *
    1.14 + * Unless required by applicable law or agreed to in writing, software
    1.15 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.16 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.17 + * See the License for the specific language governing permissions and
    1.18 + * limitations under the License.
    1.19 + */
    1.20 +
    1.21 +class gfxASurface;
    1.22 +class nsIntRegion;
    1.23 +class nsIntSize;
    1.24 +
    1.25 +namespace mozilla {
    1.26 +
    1.27 +namespace Framebuffer {
    1.28 +
    1.29 +//
    1.30 +// The general usage of Framebuffer is
    1.31 +//
    1.32 +// -- in initialization code --
    1.33 +//  Open();
    1.34 +//
    1.35 +// -- ready to paint next frame --
    1.36 +//  nsRefPtr<gfxASurface> backBuffer = BackBuffer();
    1.37 +//  // ...
    1.38 +//  Paint(backBuffer);
    1.39 +//  // ...
    1.40 +//  Present();
    1.41 +//
    1.42 +
    1.43 +// Return true if the fbdev was successfully opened.  If this fails, 
    1.44 +// the result of all further calls is undefined.  Open() is idempotent.
    1.45 +bool Open();
    1.46 +
    1.47 +// After Close(), the result of all further calls is undefined.
    1.48 +// Close() is idempotent, and Open() can be called again after
    1.49 +// Close().
    1.50 +void Close();
    1.51 +
    1.52 +// Return true if the fbdev was successfully opened or the size was
    1.53 +// already cached.
    1.54 +bool GetSize(nsIntSize *aScreenSize);
    1.55 +
    1.56 +// Return the buffer to be drawn into, that will be the next frame.
    1.57 +gfxASurface* BackBuffer();
    1.58 +
    1.59 +// Swap the front buffer for the back buffer.  |aUpdated| is the
    1.60 +// region of the back buffer that was repainted.
    1.61 +void Present(const nsIntRegion& aUpdated);
    1.62 +
    1.63 +} // namespace Framebuffer
    1.64 +
    1.65 +} // namespace mozilla

mercurial