/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */
nsresult GLImage::ReadIntoBuffer(uint8_t* aData, int32_t aStride, const gfx::IntSize& aSize,
gfx::SurfaceFormat aFormat) {
MOZ_ASSERT(NS_IsMainThread(), "Should be on the main thread");
if (!sSnapshotContext) {
nsCString discardFailureId;
sSnapshotContext = GLContextProvider::CreateHeadless({}, &discardFailureId); if (!sSnapshotContext) {
NS_WARNING("Failed to create snapshot GLContext"); return NS_ERROR_FAILURE;
}
}
already_AddRefed<gfx::SourceSurface> GLImage::GetAsSourceSurface() {
MOZ_ASSERT(NS_IsMainThread(), "Should be on the main thread");
gfx::IntSize size = GetSize(); auto format = gfx::SurfaceFormat::B8G8R8A8;
RefPtr<gfx::DataSourceSurface> dest =
gfx::Factory::CreateDataSourceSurface(size, format); if (NS_WARN_IF(!dest)) { return nullptr;
}
gfx::DataSourceSurface::ScopedMap map(dest, gfx::DataSourceSurface::WRITE); if (NS_WARN_IF(!map.IsMapped())) { return nullptr;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.