mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1671599 - Make dom/canvas
buildable outside of unified-build
environment. r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D93753
This commit is contained in:
parent
7c4670b83d
commit
e872071d08
@ -1,4 +1,5 @@
|
||||
dom/animation/
|
||||
dom/base/
|
||||
dom/bindings/
|
||||
dom/cache/
|
||||
dom/cache/
|
||||
dom/canvas/
|
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CanvasRenderingContextHelper.h"
|
||||
#include "GLContext.h"
|
||||
#include "ImageBitmapRenderingContext.h"
|
||||
#include "ImageEncoder.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
|
@ -77,6 +77,9 @@ class CanvasRenderingContextHelper {
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
namespace CanvasUtils {
|
||||
bool GetCanvasContextType(const nsAString&, dom::CanvasContextType* const);
|
||||
} // namespace CanvasUtils
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // MOZILLA_DOM_CANVASRENDERINGCONTEXTHELPER_H_
|
||||
|
@ -45,7 +45,7 @@ using namespace mozilla::gfx;
|
||||
namespace mozilla {
|
||||
namespace CanvasUtils {
|
||||
|
||||
bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,
|
||||
bool IsImageExtractionAllowed(dom::Document* aDocument, JSContext* aCx,
|
||||
nsIPrincipal& aPrincipal) {
|
||||
// Do the rest of the checks only if privacy.resistFingerprinting is on.
|
||||
if (!nsContentUtils::ShouldResistFingerprinting(aDocument)) {
|
||||
@ -85,7 +85,7 @@ bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,
|
||||
return true;
|
||||
}
|
||||
|
||||
Document* topLevelDocument = aDocument->GetTopLevelContentDocument();
|
||||
dom::Document* topLevelDocument = aDocument->GetTopLevelContentDocument();
|
||||
nsIURI* topLevelDocURI =
|
||||
topLevelDocument ? topLevelDocument->GetDocumentURI() : nullptr;
|
||||
nsCString topLevelDocURISpec;
|
||||
@ -139,7 +139,7 @@ bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,
|
||||
bool isAutoBlockCanvas =
|
||||
StaticPrefs::
|
||||
privacy_resistFingerprinting_autoDeclineNoUserInputCanvasPrompts() &&
|
||||
!UserActivation::IsHandlingUserInput();
|
||||
!dom::UserActivation::IsHandlingUserInput();
|
||||
|
||||
if (isAutoBlockCanvas) {
|
||||
nsAutoString message;
|
||||
@ -166,7 +166,7 @@ bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
BrowserChild* browserChild = BrowserChild::GetFrom(win);
|
||||
dom::BrowserChild* browserChild = dom::BrowserChild::GetFrom(win);
|
||||
if (browserChild) {
|
||||
browserChild->SendShowCanvasPermissionPrompt(origin, isAutoBlockCanvas);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "CanvasRenderingContextHelper.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "jsapi.h"
|
||||
#include "js/Array.h" // JS::GetArrayLength
|
||||
|
@ -20,10 +20,13 @@
|
||||
#include "mozilla/layers/LayerTransactionChild.h"
|
||||
#include "mozilla/layers/OOPCanvasRenderer.h"
|
||||
#include "mozilla/layers/TextureClientSharedSurface.h"
|
||||
#include "mozilla/layers/WebRenderUserData.h"
|
||||
#include "mozilla/layers/WebRenderCanvasRenderer.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/StaticPrefs_webgl.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "TexUnpackBlob.h"
|
||||
#include "WebGLMethodDispatcher.h"
|
||||
#include "WebGLChild.h"
|
||||
@ -37,7 +40,7 @@ webgl::NotLostData::NotLostData(ClientWebGLContext& _context)
|
||||
webgl::NotLostData::~NotLostData() {
|
||||
if (outOfProcess) {
|
||||
const auto& pwebgl = outOfProcess->mWebGLChild;
|
||||
Unused << WebGLChild::Send__delete__(pwebgl.get());
|
||||
Unused << dom::WebGLChild::Send__delete__(pwebgl.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,11 +146,12 @@ bool ClientWebGLContext::DispatchEvent(const nsAString& eventName) const {
|
||||
eventName, kCanBubble, kIsCancelable, &useDefaultHandler);
|
||||
} else if (mOffscreenCanvas) {
|
||||
// OffscreenCanvas case
|
||||
RefPtr<Event> event = new Event(mOffscreenCanvas, nullptr, nullptr);
|
||||
RefPtr<dom::Event> event =
|
||||
new dom::Event(mOffscreenCanvas, nullptr, nullptr);
|
||||
event->InitEvent(eventName, kCanBubble, kIsCancelable);
|
||||
event->SetTrusted(true);
|
||||
useDefaultHandler = mOffscreenCanvas->DispatchEvent(
|
||||
*event, CallerType::System, IgnoreErrors());
|
||||
*event, dom::CallerType::System, IgnoreErrors());
|
||||
}
|
||||
return useDefaultHandler;
|
||||
}
|
||||
@ -269,7 +273,7 @@ void ClientWebGLContext::ThrowEvent_WebGLContextCreationError(
|
||||
msg.AppendPrintf("Failed to create WebGL context: %s", text.c_str());
|
||||
JsWarning(msg.BeginReading());
|
||||
|
||||
RefPtr<EventTarget> target = mCanvasElement;
|
||||
RefPtr<dom::EventTarget> target = mCanvasElement;
|
||||
if (!target && mOffscreenCanvas) {
|
||||
target = mOffscreenCanvas;
|
||||
} else if (!target) {
|
||||
@ -283,8 +287,8 @@ void ClientWebGLContext::ThrowEvent_WebGLContextCreationError(
|
||||
// eventInit.mCancelable = true; // The spec says this, but it's silly.
|
||||
eventInit.mStatusMessage = NS_ConvertASCIItoUTF16(text.c_str());
|
||||
|
||||
const RefPtr<WebGLContextEvent> event =
|
||||
WebGLContextEvent::Constructor(target, kEventName, eventInit);
|
||||
const RefPtr<dom::WebGLContextEvent> event =
|
||||
dom::WebGLContextEvent::Constructor(target, kEventName, eventInit);
|
||||
event->SetTrusted(true);
|
||||
|
||||
target->DispatchEvent(*event);
|
||||
@ -430,7 +434,7 @@ bool ClientWebGLContext::InitializeCanvasRenderer(
|
||||
const FuncScope funcScope(*this, "<InitializeCanvasRenderer>");
|
||||
if (IsContextLost()) return false;
|
||||
|
||||
CanvasRendererData data;
|
||||
layers::CanvasRendererData data;
|
||||
data.mContext = mSharedPtrPtr;
|
||||
data.mOriginPos = gl::OriginPos::BottomLeft;
|
||||
|
||||
@ -456,7 +460,7 @@ layers::LayersBackend ClientWebGLContext::GetCompositorBackendType() const {
|
||||
return mOffscreenCanvas->GetCompositorBackendType();
|
||||
}
|
||||
|
||||
return LayersBackend::LAYERS_NONE;
|
||||
return layers::LayersBackend::LAYERS_NONE;
|
||||
}
|
||||
|
||||
mozilla::dom::Document* ClientWebGLContext::GetOwnerDoc() const {
|
||||
@ -474,7 +478,7 @@ void ClientWebGLContext::Commit() {
|
||||
}
|
||||
|
||||
void ClientWebGLContext::GetCanvas(
|
||||
Nullable<dom::OwningHTMLCanvasElementOrOffscreenCanvas>& retval) {
|
||||
dom::Nullable<dom::OwningHTMLCanvasElementOrOffscreenCanvas>& retval) {
|
||||
if (mCanvasElement) {
|
||||
MOZ_RELEASE_ASSERT(!mOffscreenCanvas, "GFX: Canvas is offscreen.");
|
||||
|
||||
@ -567,7 +571,7 @@ ClientWebGLContext::SetDimensions(const int32_t signedWidth,
|
||||
static bool IsWebglOutOfProcessEnabled() {
|
||||
bool useOop = StaticPrefs::webgl_out_of_process();
|
||||
|
||||
if (!gfxVars::AllowWebglOop()) {
|
||||
if (!gfx::gfxVars::AllowWebglOop()) {
|
||||
useOop = false;
|
||||
}
|
||||
if (StaticPrefs::webgl_out_of_process_force()) {
|
||||
@ -629,13 +633,13 @@ bool ClientWebGLContext::CreateHostContext(const uvec2& requestedSize) {
|
||||
|
||||
webgl::RemotingData outOfProcess;
|
||||
|
||||
auto* const cbc = CompositorBridgeChild::Get();
|
||||
auto* const cbc = layers::CompositorBridgeChild::Get();
|
||||
MOZ_ASSERT(cbc);
|
||||
if (!cbc) {
|
||||
return Err("!CompositorBridgeChild::Get()");
|
||||
}
|
||||
|
||||
outOfProcess.mWebGLChild = new WebGLChild(*this);
|
||||
outOfProcess.mWebGLChild = new dom::WebGLChild(*this);
|
||||
outOfProcess.mWebGLChild = static_cast<dom::WebGLChild*>(
|
||||
cbc->SendPWebGLConstructor(outOfProcess.mWebGLChild));
|
||||
if (!outOfProcess.mWebGLChild) {
|
||||
@ -780,7 +784,7 @@ ClientWebGLContext::SetContextOptions(JSContext* cx,
|
||||
ErrorResult& aRvForDictionaryInit) {
|
||||
if (mInitialOptions && options.isNullOrUndefined()) return NS_OK;
|
||||
|
||||
WebGLContextAttributes attributes;
|
||||
dom::WebGLContextAttributes attributes;
|
||||
if (!attributes.Init(cx, options)) {
|
||||
aRvForDictionaryInit.Throw(NS_ERROR_UNEXPECTED);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@ -1046,10 +1050,10 @@ UniquePtr<uint8_t[]> ClientWebGLContext::GetImageBuffer(int32_t* out_format) {
|
||||
|
||||
// Use GetSurfaceSnapshot() to make sure that appropriate y-flip gets applied
|
||||
gfxAlphaType any;
|
||||
RefPtr<SourceSurface> snapshot = GetSurfaceSnapshot(&any);
|
||||
RefPtr<gfx::SourceSurface> snapshot = GetSurfaceSnapshot(&any);
|
||||
if (!snapshot) return nullptr;
|
||||
|
||||
RefPtr<DataSourceSurface> dataSurface = snapshot->GetDataSurface();
|
||||
RefPtr<gfx::DataSourceSurface> dataSurface = snapshot->GetDataSurface();
|
||||
|
||||
const auto& premultAlpha = mNotLost->info.options.premultipliedAlpha;
|
||||
return gfxUtils::GetImageBuffer(dataSurface, premultAlpha, out_format);
|
||||
@ -1061,10 +1065,10 @@ ClientWebGLContext::GetInputStream(const char* mimeType,
|
||||
nsIInputStream** out_stream) {
|
||||
// Use GetSurfaceSnapshot() to make sure that appropriate y-flip gets applied
|
||||
gfxAlphaType any;
|
||||
RefPtr<SourceSurface> snapshot = GetSurfaceSnapshot(&any);
|
||||
RefPtr<gfx::SourceSurface> snapshot = GetSurfaceSnapshot(&any);
|
||||
if (!snapshot) return NS_ERROR_FAILURE;
|
||||
|
||||
RefPtr<DataSourceSurface> dataSurface = snapshot->GetDataSurface();
|
||||
RefPtr<gfx::DataSourceSurface> dataSurface = snapshot->GetDataSurface();
|
||||
const auto& premultAlpha = mNotLost->info.options.premultipliedAlpha;
|
||||
return gfxUtils::GetInputStream(dataSurface, premultAlpha, mimeType,
|
||||
encoderOptions, out_stream);
|
||||
@ -1710,7 +1714,7 @@ bool ToJSValueOrNull(JSContext* const cx, const RefPtr<T>& ptr,
|
||||
retval.set(JS::NullValue());
|
||||
return true;
|
||||
}
|
||||
return ToJSValue(cx, ptr, retval);
|
||||
return dom::ToJSValue(cx, ptr, retval);
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename S>
|
||||
@ -2425,12 +2429,12 @@ void ClientWebGLContext::GetUniform(JSContext* const cx,
|
||||
|
||||
case LOCAL_GL_FLOAT: {
|
||||
const auto ptr = reinterpret_cast<const float*>(res.data);
|
||||
MOZ_ALWAYS_TRUE(ToJSValue(cx, *ptr, retval));
|
||||
MOZ_ALWAYS_TRUE(dom::ToJSValue(cx, *ptr, retval));
|
||||
return;
|
||||
}
|
||||
case LOCAL_GL_INT: {
|
||||
const auto ptr = reinterpret_cast<const int32_t*>(res.data);
|
||||
MOZ_ALWAYS_TRUE(ToJSValue(cx, *ptr, retval));
|
||||
MOZ_ALWAYS_TRUE(dom::ToJSValue(cx, *ptr, retval));
|
||||
return;
|
||||
}
|
||||
case LOCAL_GL_UNSIGNED_INT:
|
||||
@ -2450,7 +2454,7 @@ void ClientWebGLContext::GetUniform(JSContext* const cx,
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: {
|
||||
const auto ptr = reinterpret_cast<const uint32_t*>(res.data);
|
||||
MOZ_ALWAYS_TRUE(ToJSValue(cx, *ptr, retval));
|
||||
MOZ_ALWAYS_TRUE(dom::ToJSValue(cx, *ptr, retval));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2464,7 +2468,7 @@ void ClientWebGLContext::GetUniform(JSContext* const cx,
|
||||
for (const auto i : IntegerRange(elemCount)) {
|
||||
boolArr[i] = bool(intArr[i]);
|
||||
}
|
||||
MOZ_ALWAYS_TRUE(ToJSValue(cx, boolArr, elemCount, retval));
|
||||
MOZ_ALWAYS_TRUE(dom::ToJSValue(cx, boolArr, elemCount, retval));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4569,11 +4573,11 @@ void ClientWebGLContext::DoReadPixels(const webgl::ReadPixelsDesc& desc,
|
||||
}
|
||||
|
||||
bool ClientWebGLContext::ReadPixels_SharedPrecheck(
|
||||
CallerType aCallerType, ErrorResult& out_error) const {
|
||||
dom::CallerType aCallerType, ErrorResult& out_error) const {
|
||||
if (IsContextLost()) return false;
|
||||
|
||||
if (mCanvasElement && mCanvasElement->IsWriteOnly() &&
|
||||
aCallerType != CallerType::System) {
|
||||
aCallerType != dom::CallerType::System) {
|
||||
JsWarning("readPixels: Not allowed");
|
||||
out_error.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
return false;
|
||||
|
@ -8,8 +8,10 @@
|
||||
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include "ClientWebGLContext.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "GLContext.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGL2Context.h"
|
||||
#include "WebGLFramebuffer.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "ImageData.h"
|
||||
#include "gfxTypes.h" // for gfxAlphaType
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
|
@ -80,21 +80,22 @@ ImageBitmapRenderingContext::InitializeWithDrawTarget(
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
already_AddRefed<DataSourceSurface>
|
||||
already_AddRefed<gfx::DataSourceSurface>
|
||||
ImageBitmapRenderingContext::MatchWithIntrinsicSize() {
|
||||
RefPtr<SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
RefPtr<DataSourceSurface> temp = Factory::CreateDataSourceSurface(
|
||||
IntSize(mWidth, mHeight), surface->GetFormat());
|
||||
RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
RefPtr<gfx::DataSourceSurface> temp = gfx::Factory::CreateDataSourceSurface(
|
||||
gfx::IntSize(mWidth, mHeight), surface->GetFormat());
|
||||
if (!temp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DataSourceSurface::ScopedMap map(temp, DataSourceSurface::READ_WRITE);
|
||||
gfx::DataSourceSurface::ScopedMap map(temp,
|
||||
gfx::DataSourceSurface::READ_WRITE);
|
||||
if (!map.IsMapped()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> dt = Factory::CreateDrawTargetForData(
|
||||
RefPtr<gfx::DrawTarget> dt = gfx::Factory::CreateDrawTargetForData(
|
||||
gfxPlatform::GetPlatform()->GetSoftwareBackend(), map.GetData(),
|
||||
temp->GetSize(), map.GetStride(), temp->GetFormat());
|
||||
if (!dt || !dt->IsValid()) {
|
||||
@ -103,11 +104,11 @@ ImageBitmapRenderingContext::MatchWithIntrinsicSize() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dt->ClearRect(Rect(0, 0, mWidth, mHeight));
|
||||
dt->ClearRect(gfx::Rect(0, 0, mWidth, mHeight));
|
||||
dt->CopySurface(
|
||||
surface,
|
||||
IntRect(0, 0, surface->GetSize().width, surface->GetSize().height),
|
||||
IntPoint(0, 0));
|
||||
gfx::IntRect(0, 0, surface->GetSize().width, surface->GetSize().height),
|
||||
gfx::IntPoint(0, 0));
|
||||
|
||||
return temp.forget();
|
||||
}
|
||||
@ -120,13 +121,13 @@ mozilla::UniquePtr<uint8_t[]> ImageBitmapRenderingContext::GetImageBuffer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
RefPtr<DataSourceSurface> data = surface->GetDataSurface();
|
||||
RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
RefPtr<gfx::DataSourceSurface> data = surface->GetDataSurface();
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (data->GetSize() != IntSize(mWidth, mHeight)) {
|
||||
if (data->GetSize() != gfx::IntSize(mWidth, mHeight)) {
|
||||
data = MatchWithIntrinsicSize();
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
@ -134,7 +135,7 @@ mozilla::UniquePtr<uint8_t[]> ImageBitmapRenderingContext::GetImageBuffer(
|
||||
}
|
||||
|
||||
*aFormat = imgIEncoder::INPUT_FORMAT_HOSTARGB;
|
||||
return SurfaceToPackedBGRA(data);
|
||||
return gfx::SurfaceToPackedBGRA(data);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -171,8 +172,8 @@ ImageBitmapRenderingContext::GetSurfaceSnapshot(
|
||||
(GetIsOpaque() ? gfxAlphaType::Opaque : gfxAlphaType::Premult);
|
||||
}
|
||||
|
||||
RefPtr<SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
if (surface->GetSize() != IntSize(mWidth, mHeight)) {
|
||||
RefPtr<gfx::SourceSurface> surface = mImage->GetAsSourceSurface();
|
||||
if (surface->GetSize() != gfx::IntSize(mWidth, mHeight)) {
|
||||
return MatchWithIntrinsicSize();
|
||||
}
|
||||
|
||||
@ -197,7 +198,7 @@ ImageBitmapRenderingContext::Reset() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> ImageBitmapRenderingContext::GetCanvasLayer(
|
||||
already_AddRefed<layers::Layer> ImageBitmapRenderingContext::GetCanvasLayer(
|
||||
nsDisplayListBuilder* aBuilder, Layer* aOldLayer, LayerManager* aManager) {
|
||||
if (!mImage) {
|
||||
// No DidTransactionCallback will be received, so mark the context clean
|
||||
@ -206,26 +207,26 @@ already_AddRefed<Layer> ImageBitmapRenderingContext::GetCanvasLayer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ImageLayer> imageLayer;
|
||||
RefPtr<layers::ImageLayer> imageLayer;
|
||||
|
||||
if (aOldLayer) {
|
||||
imageLayer = static_cast<ImageLayer*>(aOldLayer);
|
||||
imageLayer = static_cast<layers::ImageLayer*>(aOldLayer);
|
||||
} else {
|
||||
imageLayer = aManager->CreateImageLayer();
|
||||
}
|
||||
|
||||
RefPtr<ImageContainer> imageContainer = imageLayer->GetContainer();
|
||||
RefPtr<layers::ImageContainer> imageContainer = imageLayer->GetContainer();
|
||||
if (!imageContainer) {
|
||||
imageContainer = LayerManager::CreateImageContainer();
|
||||
imageLayer->SetContainer(imageContainer);
|
||||
}
|
||||
|
||||
AutoTArray<ImageContainer::NonOwningImage, 1> imageList;
|
||||
AutoTArray<layers::ImageContainer::NonOwningImage, 1> imageList;
|
||||
RefPtr<layers::Image> image = ClipToIntrinsicSize();
|
||||
if (!image) {
|
||||
return nullptr;
|
||||
}
|
||||
imageList.AppendElement(ImageContainer::NonOwningImage(image));
|
||||
imageList.AppendElement(layers::ImageContainer::NonOwningImage(image));
|
||||
imageContainer->SetCurrentImages(imageList);
|
||||
|
||||
return imageLayer.forget();
|
||||
@ -240,14 +241,15 @@ bool ImageBitmapRenderingContext::UpdateWebRenderCanvasData(
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ImageContainer> imageContainer = aCanvasData->GetImageContainer();
|
||||
AutoTArray<ImageContainer::NonOwningImage, 1> imageList;
|
||||
RefPtr<layers::ImageContainer> imageContainer =
|
||||
aCanvasData->GetImageContainer();
|
||||
AutoTArray<layers::ImageContainer::NonOwningImage, 1> imageList;
|
||||
RefPtr<layers::Image> image = ClipToIntrinsicSize();
|
||||
if (!image) {
|
||||
return false;
|
||||
}
|
||||
|
||||
imageList.AppendElement(ImageContainer::NonOwningImage(image));
|
||||
imageList.AppendElement(layers::ImageContainer::NonOwningImage(image));
|
||||
imageContainer->SetCurrentImages(imageList);
|
||||
return true;
|
||||
}
|
||||
@ -264,8 +266,8 @@ ImageBitmapRenderingContext::Redraw(const gfxRect& aDirty) {
|
||||
if (imageContainer) {
|
||||
RefPtr<layers::Image> image = ClipToIntrinsicSize();
|
||||
if (image) {
|
||||
AutoTArray<ImageContainer::NonOwningImage, 1> imageList;
|
||||
imageList.AppendElement(ImageContainer::NonOwningImage(image));
|
||||
AutoTArray<layers::ImageContainer::NonOwningImage, 1> imageList;
|
||||
imageList.AppendElement(layers::ImageContainer::NonOwningImage(image));
|
||||
imageContainer->SetCurrentImages(imageList);
|
||||
} else {
|
||||
imageContainer->ClearAllImages();
|
||||
|
@ -5,6 +5,13 @@
|
||||
#ifndef ImageBitmapRenderingContext_h
|
||||
#define ImageBitmapRenderingContext_h
|
||||
|
||||
#include "mozilla/dom/ImageBitmap.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/layers/WebRenderUserData.h"
|
||||
#include "imgIEncoder.h"
|
||||
#include "ImageEncoder.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/StructuredClone.h"
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "CanvasUtils.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLScreenBuffer.h"
|
||||
#include "ImageBitmap.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -131,7 +132,7 @@ already_AddRefed<nsISupports> OffscreenCanvas::GetContext(
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
ImageContainer* OffscreenCanvas::GetImageContainer() {
|
||||
layers::ImageContainer* OffscreenCanvas::GetImageContainer() {
|
||||
if (!mCanvasRenderer) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define MOZILLA_DOM_OFFSCREENCANVAS_H_
|
||||
|
||||
#include "gfxTypes.h"
|
||||
#include "mozilla/dom/ImageEncoder.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLProgram.h"
|
||||
#include "WebGLTransformFeedback.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -258,7 +258,7 @@ CheckVertexAttribPointer(const bool isWebgl2,
|
||||
return calc;
|
||||
}
|
||||
|
||||
void DoVertexAttribPointer(GLContext& gl, const uint32_t index,
|
||||
void DoVertexAttribPointer(gl::GLContext& gl, const uint32_t index,
|
||||
const webgl::VertAttribPointerDesc& desc) {
|
||||
if (desc.intFunc) {
|
||||
gl.fVertexAttribIPointer(index, desc.channels, desc.type,
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/dom/WebGLCrossProcessCommandQueue.h"
|
||||
#include "mozilla/layers/LayerTransactionParent.h"
|
||||
#include "mozilla/layers/TextureClientSharedSurface.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "HostWebGLContext.h"
|
||||
#include "WebGLMethodDispatcher.h"
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef WEBGL_SHADER_VALIDATOR_H_
|
||||
#define WEBGL_SHADER_VALIDATOR_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "WebGLVertexArrayFake.h"
|
||||
|
||||
#include "GLContext.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "WebGLVertexArrayGL.h"
|
||||
|
||||
#include "GLContext.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
Loading…
Reference in New Issue
Block a user