mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
7d182a2102
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions. Authors: gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical gfx/layers/d3d* - D3D9/D3D10 - bas gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas gfx/layers/composite/* - CompositeLayers - nrc,nical gfx/layers/client/* - Client - nrc,nical,bas gfx/layers/*Image* - nical gfx/layers/ipc ipc - IPC - nical gfx/layers/opengl - CompositorOGL - nrc,nical gfx/2d - bas,nrc gfx/gl - GLContext - bjacob dom/* layout/* - DOM - mattwoodrow
124 lines
2.7 KiB
C++
124 lines
2.7 KiB
C++
/* -*- Mode: C++; tab-width: 20; 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/. */
|
|
|
|
#include "gfxSharedImageSurface.h"
|
|
|
|
#include "ipc/AutoOpenSurface.h"
|
|
#include "ImageLayerComposite.h"
|
|
#include "ImageHost.h"
|
|
#include "gfxImageSurface.h"
|
|
#include "gfx2DGlue.h"
|
|
|
|
#include "mozilla/layers/Compositor.h"
|
|
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo
|
|
#include "mozilla/layers/Effects.h"
|
|
#include "CompositableHost.h"
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
ImageLayerComposite::ImageLayerComposite(LayerManagerComposite* aManager)
|
|
: ShadowImageLayer(aManager, nullptr)
|
|
, LayerComposite(aManager)
|
|
, mImageHost(nullptr)
|
|
{
|
|
MOZ_COUNT_CTOR(ImageLayerComposite);
|
|
mImplData = static_cast<LayerComposite*>(this);
|
|
}
|
|
|
|
ImageLayerComposite::~ImageLayerComposite()
|
|
{
|
|
MOZ_COUNT_DTOR(ImageLayerComposite);
|
|
MOZ_ASSERT(mDestroyed);
|
|
|
|
CleanupResources();
|
|
}
|
|
|
|
void
|
|
ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
|
|
{
|
|
mImageHost = static_cast<ImageHost*>(aHost);
|
|
}
|
|
|
|
void
|
|
ImageLayerComposite::Disconnect()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
LayerRenderState
|
|
ImageLayerComposite::GetRenderState()
|
|
{
|
|
if (!mImageHost) {
|
|
return LayerRenderState();
|
|
}
|
|
return mImageHost->GetRenderState();
|
|
}
|
|
|
|
Layer*
|
|
ImageLayerComposite::GetLayer()
|
|
{
|
|
return this;
|
|
}
|
|
|
|
void
|
|
ImageLayerComposite::RenderLayer(const nsIntPoint& aOffset,
|
|
const nsIntRect& aClipRect)
|
|
{
|
|
if (!mImageHost) {
|
|
return;
|
|
}
|
|
|
|
mCompositor->MakeCurrent();
|
|
|
|
EffectChain effectChain;
|
|
LayerManagerComposite::AddMaskEffect(mMaskLayer, effectChain);
|
|
|
|
gfx::Matrix4x4 transform;
|
|
ToMatrix4x4(GetEffectiveTransform(), transform);
|
|
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
|
mImageHost->SetCompositor(mCompositor);
|
|
mImageHost->Composite(effectChain,
|
|
GetEffectiveOpacity(),
|
|
transform,
|
|
gfx::Point(aOffset.x, aOffset.y),
|
|
gfx::ToFilter(mFilter),
|
|
clipRect);
|
|
}
|
|
|
|
CompositableHost*
|
|
ImageLayerComposite::GetCompositableHost() {
|
|
return mImageHost.get();
|
|
}
|
|
|
|
void
|
|
ImageLayerComposite::CleanupResources()
|
|
{
|
|
if (mImageHost) {
|
|
mImageHost->Detach();
|
|
}
|
|
mImageHost = nullptr;
|
|
}
|
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
nsACString&
|
|
ImageLayerComposite::PrintInfo(nsACString& aTo, const char* aPrefix)
|
|
{
|
|
ImageLayer::PrintInfo(aTo, aPrefix);
|
|
aTo += "\n";
|
|
if (mImageHost) {
|
|
nsAutoCString pfx(aPrefix);
|
|
pfx += " ";
|
|
mImageHost->PrintInfo(aTo, pfx.get());
|
|
}
|
|
return aTo;
|
|
}
|
|
#endif
|
|
|
|
} /* layers */
|
|
} /* mozilla */
|