2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2017-10-28 01:55:37 +03:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2017-06-24 00:23:12 +03:00
|
|
|
|
|
|
|
#ifndef mozilla_gfx_layers_mlgpu_ContainerLayerMLGPU_h
|
|
|
|
#define mozilla_gfx_layers_mlgpu_ContainerLayerMLGPU_h
|
|
|
|
|
|
|
|
#include "LayerMLGPU.h"
|
2017-06-06 02:03:02 +03:00
|
|
|
#include "MLGDeviceTypes.h"
|
2017-06-24 00:23:12 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2017-06-06 02:03:02 +03:00
|
|
|
class MLGDevice;
|
2017-10-11 03:39:42 +03:00
|
|
|
class RenderViewMLGPU;
|
2017-06-06 02:03:02 +03:00
|
|
|
|
2017-06-24 00:23:12 +03:00
|
|
|
class ContainerLayerMLGPU final : public ContainerLayer
|
|
|
|
, public LayerMLGPU
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ContainerLayerMLGPU(LayerManagerMLGPU* aManager);
|
|
|
|
~ContainerLayerMLGPU() override;
|
|
|
|
|
|
|
|
MOZ_LAYER_DECL_NAME("ContainerLayerMLGPU", TYPE_CONTAINER)
|
|
|
|
|
|
|
|
HostLayer* AsHostLayer() override { return this; }
|
|
|
|
ContainerLayerMLGPU* AsContainerLayerMLGPU() override { return this; }
|
|
|
|
Layer* GetLayer() override { return this; }
|
|
|
|
|
|
|
|
void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override {
|
|
|
|
DefaultComputeEffectiveTransforms(aTransformToSurface);
|
|
|
|
}
|
2017-08-04 07:22:49 +03:00
|
|
|
void SetInvalidCompositeRect(const gfx::IntRect* aRect) override;
|
2017-06-24 00:23:12 +03:00
|
|
|
void ClearCachedResources() override;
|
|
|
|
|
|
|
|
RefPtr<MLGRenderTarget> UpdateRenderTarget(
|
|
|
|
MLGDevice* aDevice,
|
|
|
|
MLGRenderTargetFlags aFlags);
|
|
|
|
|
|
|
|
MLGRenderTarget* GetRenderTarget() const {
|
|
|
|
return mRenderTarget;
|
|
|
|
}
|
|
|
|
gfx::IntPoint GetTargetOffset() const {
|
|
|
|
return mTargetOffset;
|
|
|
|
}
|
|
|
|
gfx::IntSize GetTargetSize() const {
|
|
|
|
return mTargetSize;
|
|
|
|
}
|
|
|
|
const gfx::IntRect& GetInvalidRect() const {
|
|
|
|
return mInvalidRect;
|
|
|
|
}
|
|
|
|
void ClearInvalidRect() {
|
|
|
|
mInvalidRect.SetEmpty();
|
|
|
|
}
|
|
|
|
bool IsContentOpaque() override;
|
2017-10-11 03:39:42 +03:00
|
|
|
bool NeedsSurfaceCopy() const {
|
|
|
|
return mSurfaceCopyNeeded;
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderViewMLGPU* GetRenderView() const {
|
|
|
|
return mView;
|
|
|
|
}
|
|
|
|
void SetRenderView(RenderViewMLGPU* aView) {
|
|
|
|
MOZ_ASSERT(!mView);
|
|
|
|
mView = aView;
|
|
|
|
}
|
2017-06-24 00:23:12 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool OnPrepareToRender(FrameBuilder* aBuilder) override;
|
2017-06-27 23:11:01 +03:00
|
|
|
void OnLayerManagerChange(LayerManagerMLGPU* aManager) override;
|
2017-06-29 01:26:48 +03:00
|
|
|
Maybe<gfx::IntRect> ComputeIntermediateSurfaceBounds();
|
2017-06-24 00:23:12 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
RefPtr<MLGRenderTarget> mRenderTarget;
|
|
|
|
|
|
|
|
// We cache these since occlusion culling can change the visible region.
|
|
|
|
gfx::IntPoint mTargetOffset;
|
|
|
|
gfx::IntSize mTargetSize;
|
|
|
|
|
|
|
|
// The region of the container that needs to be recomposited if visible. We
|
2017-07-31 22:28:54 +03:00
|
|
|
// store this as a rectangle instead of an nsIntRegion for efficiency. This
|
|
|
|
// is in layer coordinates.
|
2017-06-24 00:23:12 +03:00
|
|
|
gfx::IntRect mInvalidRect;
|
2017-07-31 22:28:54 +03:00
|
|
|
bool mInvalidateEntireSurface;
|
2017-10-11 03:39:42 +03:00
|
|
|
bool mSurfaceCopyNeeded;
|
|
|
|
|
|
|
|
// This is only valid for intermediate surfaces while an instance of
|
|
|
|
// FrameBuilder is live.
|
|
|
|
RenderViewMLGPU* mView;
|
2017-06-24 00:23:12 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_gfx_layers_mlgpu_ContainerLayerMLGPU_h
|