2017-04-27 15:28:31 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
#ifndef GFX_WEBRENDERLAYER_H
|
|
|
|
#define GFX_WEBRENDERLAYER_H
|
|
|
|
|
|
|
|
#include "Layers.h"
|
|
|
|
#include "mozilla/webrender/WebRenderTypes.h"
|
|
|
|
#include "mozilla/webrender/WebRenderAPI.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
class ImageClientSingle;
|
2017-05-03 12:48:06 +00:00
|
|
|
class StackingContextHelper;
|
2017-04-27 15:28:31 +00:00
|
|
|
class WebRenderBridgeChild;
|
|
|
|
class WebRenderLayerManager;
|
|
|
|
|
2017-04-27 16:04:12 +00:00
|
|
|
typedef gfx::Matrix4x4Typed<LayerPixel, LayerPixel> BoundsTransformMatrix;
|
|
|
|
|
2017-04-27 15:28:31 +00:00
|
|
|
class WebRenderLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual Layer* GetLayer() = 0;
|
2017-05-03 12:48:06 +00:00
|
|
|
virtual void RenderLayer(wr::DisplayListBuilder& aBuilder,
|
|
|
|
const StackingContextHelper& aSc) = 0;
|
2017-04-27 15:28:31 +00:00
|
|
|
virtual Maybe<WrImageMask> RenderMaskLayer(const gfx::Matrix4x4& aTransform)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(false);
|
|
|
|
return Nothing();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() { return nullptr; }
|
|
|
|
static inline WebRenderLayer*
|
|
|
|
ToWebRenderLayer(Layer* aLayer)
|
|
|
|
{
|
|
|
|
return static_cast<WebRenderLayer*>(aLayer->ImplData());
|
|
|
|
}
|
|
|
|
|
|
|
|
Maybe<wr::ImageKey> UpdateImageKey(ImageClientSingle* aImageClient,
|
|
|
|
ImageContainer* aContainer,
|
|
|
|
Maybe<wr::ImageKey>& aOldKey,
|
|
|
|
wr::ExternalImageId& aExternalImageId);
|
|
|
|
|
|
|
|
WebRenderLayerManager* WrManager();
|
|
|
|
WebRenderBridgeChild* WrBridge();
|
|
|
|
WrImageKey GetImageKey();
|
|
|
|
|
2017-04-27 16:04:12 +00:00
|
|
|
LayerRect Bounds();
|
|
|
|
LayerRect BoundsForStackingContext();
|
2017-04-27 16:04:25 +00:00
|
|
|
protected:
|
|
|
|
BoundsTransformMatrix BoundsTransform();
|
2017-04-27 16:04:12 +00:00
|
|
|
Maybe<LayerRect> ClipRect();
|
2017-04-27 16:04:12 +00:00
|
|
|
|
2017-04-27 16:04:12 +00:00
|
|
|
void DumpLayerInfo(const char* aLayerType, const LayerRect& aRect);
|
2017-05-05 15:44:49 +00:00
|
|
|
|
|
|
|
// Builds a WrImageMask from the mask layer on this layer, if there is one.
|
|
|
|
// If this layer is pushing a stacking context, then the WrImageMask will be
|
|
|
|
// interpreted as relative to that stacking context by WR. The caller needs
|
|
|
|
// to pass in the StackingContextHelper for *this* layer, if there is one, in
|
|
|
|
// order for this function to make the necessary adjustments.
|
|
|
|
Maybe<WrImageMask> BuildWrMaskLayer(const StackingContextHelper* aUnapplySc);
|
2017-04-27 15:28:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* GFX_WEBRENDERLAYER_H */
|