2013-11-01 05:54:14 +04: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/. */
|
|
|
|
|
2016-01-22 01:38:53 +03:00
|
|
|
#include "MacIOSurfaceHelpers.h"
|
2013-11-01 05:54:14 +04:00
|
|
|
#include "MacIOSurfaceImage.h"
|
2016-06-27 18:25:13 +03:00
|
|
|
#include "gfxPlatform.h"
|
2014-12-22 11:49:00 +03:00
|
|
|
#include "mozilla/layers/CompositableClient.h"
|
|
|
|
#include "mozilla/layers/CompositableForwarder.h"
|
2013-11-18 06:04:38 +04:00
|
|
|
#include "mozilla/layers/MacIOSurfaceTextureClientOGL.h"
|
2015-10-20 20:13:35 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2013-11-01 05:54:14 +04:00
|
|
|
|
2014-01-27 17:25:50 +04:00
|
|
|
using namespace mozilla;
|
2013-11-01 05:54:14 +04:00
|
|
|
using namespace mozilla::layers;
|
2015-08-04 00:57:54 +03:00
|
|
|
using namespace mozilla::gfx;
|
2013-11-01 05:54:14 +04:00
|
|
|
|
|
|
|
TextureClient*
|
2016-09-27 06:22:20 +03:00
|
|
|
MacIOSurfaceImage::GetTextureClient(KnowsCompositor* aForwarder)
|
2013-11-01 05:54:14 +04:00
|
|
|
{
|
|
|
|
if (!mTextureClient) {
|
2016-06-27 18:25:13 +03:00
|
|
|
BackendType backend = BackendType::NONE;
|
2015-11-20 16:24:46 +03:00
|
|
|
mTextureClient = TextureClient::CreateWithData(
|
2016-06-27 18:25:13 +03:00
|
|
|
MacIOSurfaceTextureData::Create(mSurface, backend),
|
2015-11-20 16:24:46 +03:00
|
|
|
TextureFlags::DEFAULT,
|
2016-09-27 06:22:20 +03:00
|
|
|
aForwarder->GetTextureForwarder()
|
2015-11-20 16:24:46 +03:00
|
|
|
);
|
2013-11-01 05:54:14 +04:00
|
|
|
}
|
|
|
|
return mTextureClient;
|
|
|
|
}
|
2014-01-27 17:25:50 +04:00
|
|
|
|
2015-08-04 00:57:54 +03:00
|
|
|
already_AddRefed<SourceSurface>
|
2014-01-27 17:25:50 +04:00
|
|
|
MacIOSurfaceImage::GetAsSourceSurface()
|
|
|
|
{
|
2016-01-22 01:38:53 +03:00
|
|
|
return CreateSourceSurfaceFromMacIOSurface(mSurface);
|
2014-01-27 17:25:50 +04:00
|
|
|
}
|