2012-11-19 21:58:37 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef mozilla_HwcComposer2D
|
|
|
|
#define mozilla_HwcComposer2D
|
|
|
|
|
|
|
|
#include "Composer2D.h"
|
|
|
|
#include "Layers.h"
|
2013-04-30 04:21:54 +04:00
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
2012-11-19 21:58:37 +04:00
|
|
|
|
2013-05-08 07:58:22 +04:00
|
|
|
#include "hardware/hwcomposer.h"
|
|
|
|
|
2012-11-19 21:58:37 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
class ContainerLayer;
|
|
|
|
class Layer;
|
|
|
|
}
|
|
|
|
|
2013-04-30 04:21:54 +04:00
|
|
|
//Holds a dynamically allocated vector of rectangles
|
|
|
|
//used to decribe the complex visible region of a layer
|
|
|
|
typedef std::vector<hwc_rect_t> RectVector;
|
|
|
|
|
2013-05-08 07:58:22 +04:00
|
|
|
class HwcComposer2D : public mozilla::layers::Composer2D {
|
2012-11-19 21:58:37 +04:00
|
|
|
public:
|
|
|
|
HwcComposer2D();
|
|
|
|
virtual ~HwcComposer2D();
|
|
|
|
|
|
|
|
int Init(hwc_display_t aDisplay, hwc_surface_t aSurface);
|
|
|
|
|
|
|
|
bool Initialized() const { return mHwc; }
|
|
|
|
|
|
|
|
static HwcComposer2D* GetInstance();
|
|
|
|
|
|
|
|
// Returns TRUE if the container has been succesfully rendered
|
|
|
|
// Returns FALSE if the container cannot be fully rendered
|
|
|
|
// by this composer so nothing was rendered at all
|
|
|
|
bool TryRender(layers::Layer* aRoot, const gfxMatrix& aGLWorldTransform) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool ReallocLayerList();
|
2013-01-18 01:34:01 +04:00
|
|
|
bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip,
|
|
|
|
const gfxMatrix& aParentTransform, const gfxMatrix& aGLWorldTransform);
|
2012-11-19 21:58:37 +04:00
|
|
|
|
2013-05-08 07:58:22 +04:00
|
|
|
hwc_composer_device_t* mHwc;
|
2012-11-19 21:58:37 +04:00
|
|
|
hwc_layer_list_t* mList;
|
2013-05-08 07:58:22 +04:00
|
|
|
hwc_display_t mDpy;
|
|
|
|
hwc_surface_t mSur;
|
2013-01-18 01:34:01 +04:00
|
|
|
nsIntRect mScreenRect;
|
2012-11-19 21:58:37 +04:00
|
|
|
int mMaxLayerCount;
|
2013-01-09 16:56:37 +04:00
|
|
|
bool mColorFill;
|
2013-04-30 04:21:54 +04:00
|
|
|
//Holds all the dynamically allocated RectVectors needed
|
|
|
|
//to render the current frame
|
|
|
|
std::list<RectVector> mVisibleRegions;
|
2012-11-19 21:58:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_HwcComposer2D
|