mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
cd94ff127c
--HG-- extra : rebase_source : a553b4c36feb555b23cbe140a05df09f0dc2656d
70 lines
1.6 KiB
C++
70 lines
1.6 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 "MacIOSurfaceTextureClientOGL.h"
|
|
#include "mozilla/gfx/MacIOSurface.h"
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
MacIOSurfaceTextureClientOGL::MacIOSurfaceTextureClientOGL(TextureFlags aFlags)
|
|
: TextureClient(aFlags)
|
|
, mIsLocked(false)
|
|
{}
|
|
|
|
MacIOSurfaceTextureClientOGL::~MacIOSurfaceTextureClientOGL()
|
|
{}
|
|
|
|
void
|
|
MacIOSurfaceTextureClientOGL::InitWith(MacIOSurface* aSurface)
|
|
{
|
|
MOZ_ASSERT(IsValid());
|
|
MOZ_ASSERT(!IsAllocated());
|
|
mSurface = aSurface;
|
|
}
|
|
|
|
bool
|
|
MacIOSurfaceTextureClientOGL::Lock(OpenMode aMode)
|
|
{
|
|
MOZ_ASSERT(!mIsLocked);
|
|
mIsLocked = true;
|
|
return IsValid() && IsAllocated();
|
|
}
|
|
|
|
void
|
|
MacIOSurfaceTextureClientOGL::Unlock()
|
|
{
|
|
MOZ_ASSERT(mIsLocked);
|
|
mIsLocked = false;
|
|
}
|
|
|
|
bool
|
|
MacIOSurfaceTextureClientOGL::IsLocked() const
|
|
{
|
|
return mIsLocked;
|
|
}
|
|
|
|
bool
|
|
MacIOSurfaceTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
|
{
|
|
MOZ_ASSERT(IsValid());
|
|
if (!IsAllocated()) {
|
|
return false;
|
|
}
|
|
aOutDescriptor = SurfaceDescriptorMacIOSurface(mSurface->GetIOSurfaceID(),
|
|
mSurface->GetContentsScaleFactor(),
|
|
!mSurface->HasAlpha());
|
|
return true;
|
|
}
|
|
|
|
gfx::IntSize
|
|
MacIOSurfaceTextureClientOGL::GetSize() const
|
|
{
|
|
return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
|
|
}
|
|
|
|
}
|
|
}
|