2013-12-04 00:20:04 +00: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/. */
|
|
|
|
|
|
|
|
#include "TextureHostBasic.h"
|
2014-07-22 15:29:33 +00:00
|
|
|
#ifdef XP_MACOSX
|
2013-12-04 00:20:04 +00:00
|
|
|
#include "MacIOSurfaceTextureHostBasic.h"
|
2014-07-22 15:29:33 +00:00
|
|
|
#endif
|
2015-10-27 05:43:07 +00:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
#include "GrallocTextureHostBasic.h"
|
|
|
|
#endif
|
2013-12-04 00:20:04 +00:00
|
|
|
|
|
|
|
using namespace mozilla::gl;
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2015-06-17 14:00:52 +00:00
|
|
|
already_AddRefed<TextureHost>
|
2013-12-12 01:44:47 +00:00
|
|
|
CreateTextureHostBasic(const SurfaceDescriptor& aDesc,
|
2013-12-04 00:20:04 +00:00
|
|
|
ISurfaceAllocator* aDeallocator,
|
|
|
|
TextureFlags aFlags)
|
|
|
|
{
|
|
|
|
#ifdef XP_MACOSX
|
2014-01-09 14:26:20 +00:00
|
|
|
if (aDesc.type() == SurfaceDescriptor::TSurfaceDescriptorMacIOSurface) {
|
|
|
|
const SurfaceDescriptorMacIOSurface& desc =
|
|
|
|
aDesc.get_SurfaceDescriptorMacIOSurface();
|
2015-05-01 13:14:16 +00:00
|
|
|
return MakeAndAddRef<MacIOSurfaceTextureHostBasic>(aFlags, desc);
|
2013-12-04 00:20:04 +00:00
|
|
|
}
|
2015-10-27 05:43:07 +00:00
|
|
|
#endif
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
2015-12-04 10:23:42 +00:00
|
|
|
if (aDesc.type() == SurfaceDescriptor::TSurfaceDescriptorGralloc) {
|
|
|
|
const SurfaceDescriptorGralloc& desc =
|
|
|
|
aDesc.get_SurfaceDescriptorGralloc();
|
2015-10-27 05:43:07 +00:00
|
|
|
return MakeAndAddRef<GrallocTextureHostBasic>(aFlags, desc);
|
|
|
|
}
|
2014-01-09 14:26:20 +00:00
|
|
|
#endif
|
|
|
|
return CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
|
2013-12-04 00:20:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace layers
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|