Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
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
2013-04-10 02:20:52 -07:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "GLContext.h" // for GLContext, etc
|
2014-01-10 05:06:06 -08:00
|
|
|
#include "SurfaceStream.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/layers/ISurfaceAllocator.h"
|
2014-01-10 05:06:06 -08:00
|
|
|
#include "mozilla/layers/TextureClientOGL.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "nsSize.h" // for nsIntSize
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
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
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
using namespace mozilla::gl;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class CompositableForwarder;
|
|
|
|
|
2013-08-27 13:16:54 -07:00
|
|
|
SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
|
|
|
|
: TextureClient(aFlags)
|
|
|
|
, mHandle(0)
|
2013-08-08 05:53:12 -07:00
|
|
|
, mInverted(false)
|
2013-07-30 02:59:51 -07:00
|
|
|
{
|
2013-10-02 13:52:04 -07:00
|
|
|
// SharedTextureClient is always owned externally.
|
2014-04-25 19:34:05 -07:00
|
|
|
mFlags |= TextureFlags::DEALLOCATE_CLIENT;
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
SharedTextureClientOGL::~SharedTextureClientOGL()
|
|
|
|
{
|
2013-10-02 13:52:04 -07:00
|
|
|
// the shared data is owned externally.
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
SharedTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
|
|
|
{
|
2013-09-06 02:04:50 -07:00
|
|
|
MOZ_ASSERT(IsValid());
|
2013-07-30 02:59:51 -07:00
|
|
|
if (!IsAllocated()) {
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-31 01:06:12 -08:00
|
|
|
aOutDescriptor = SharedTextureDescriptor(mShareType, mHandle, mSize, mInverted);
|
2013-07-30 02:59:51 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureClientOGL::InitWith(gl::SharedTextureHandle aHandle,
|
|
|
|
gfx::IntSize aSize,
|
2013-09-04 05:14:52 -07:00
|
|
|
gl::SharedTextureShareType aShareType,
|
2013-07-30 02:59:51 -07:00
|
|
|
bool aInverted)
|
|
|
|
{
|
2013-09-06 02:04:50 -07:00
|
|
|
MOZ_ASSERT(IsValid());
|
2013-07-30 02:59:51 -07:00
|
|
|
MOZ_ASSERT(!IsAllocated());
|
|
|
|
mHandle = aHandle;
|
|
|
|
mSize = aSize;
|
2013-08-27 13:16:54 -07:00
|
|
|
mShareType = aShareType;
|
2013-07-30 02:59:51 -07:00
|
|
|
mInverted = aInverted;
|
2013-10-09 18:20:57 -07:00
|
|
|
if (mInverted) {
|
2014-04-25 19:34:05 -07:00
|
|
|
AddFlags(TextureFlags::NEEDS_Y_FLIP);
|
2013-10-09 18:20:57 -07:00
|
|
|
}
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
2014-01-24 06:25:04 -08:00
|
|
|
bool
|
|
|
|
SharedTextureClientOGL::Lock(OpenMode mode)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!mIsLocked);
|
|
|
|
if (!IsValid() || !IsAllocated()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mIsLocked = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedTextureClientOGL::Unlock()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mIsLocked);
|
|
|
|
mIsLocked = false;
|
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
bool
|
|
|
|
SharedTextureClientOGL::IsAllocated() const
|
|
|
|
{
|
|
|
|
return mHandle != 0;
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
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
2013-04-10 02:20:52 -07:00
|
|
|
} // namespace
|
|
|
|
} // namespace
|