本文整理汇总了C++中OwnPtrWillBeRawPtr::drawingBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ OwnPtrWillBeRawPtr::drawingBuffer方法的具体用法?C++ OwnPtrWillBeRawPtr::drawingBuffer怎么用?C++ OwnPtrWillBeRawPtr::drawingBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwnPtrWillBeRawPtr
的用法示例。
在下文中一共展示了OwnPtrWillBeRawPtr::drawingBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextLabel
PassOwnPtrWillBeRawPtr<CanvasRenderingContext> WebGL2RenderingContext::Factory::create(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs, Document&)
{
if (!RuntimeEnabledFeatures::unsafeES3APIsEnabled()) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Creation of WebGL2 contexts disabled."));
return nullptr;
}
WebGLContextAttributes attributes = toWebGLContextAttributes(attrs);
OwnPtr<WebGraphicsContext3D> context(createWebGraphicsContext3D(canvas, attributes, 2));
if (!context)
return nullptr;
OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get());
if (!extensionsUtil)
return nullptr;
if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) {
String contextLabel(String::format("WebGL2RenderingContext-%p", context.get()));
context->pushGroupMarkerEXT(contextLabel.ascii().data());
}
OwnPtrWillBeRawPtr<WebGL2RenderingContext> renderingContext = adoptPtrWillBeNoop(new WebGL2RenderingContext(canvas, context.release(), attributes));
if (!renderingContext->drawingBuffer()) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL2 context."));
return nullptr;
}
renderingContext->initializeNewContext();
renderingContext->registerContextExtensions();
return renderingContext.release();
}
示例2: statusMessage
PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
{
Document& document = canvas->document();
LocalFrame* frame = document.frame();
if (!frame) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context."));
return nullptr;
}
Settings* settings = frame->settings();
// The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
// particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension.
if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled())) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context."));
return nullptr;
}
// The only situation that attrs is null is through Document::getCSSCanvasContext().
RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr;
if (!attrs) {
defaultAttrs = WebGLContextAttributes::create();
attrs = defaultAttrs.get();
}
blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(document.topDocument().url().string(), settings, 1);
blink::WebGLInfo glInfo;
OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo));
if (!context) {
String statusMessage("Could not create a WebGL context for VendorInfo = ");
statusMessage.append(glInfo.vendorInfo);
statusMessage.append(", RendererInfo = ");
statusMessage.append(glInfo.rendererInfo);
statusMessage.append(", DriverInfo = ");
statusMessage.append(glInfo.driverVersion);
statusMessage.append(".");
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, statusMessage));
return nullptr;
}
OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.get());
if (!extensionsUtil)
return nullptr;
if (extensionsUtil->supportsExtension("GL_EXT_debug_marker"))
context->pushGroupMarkerEXT("WebGLRenderingContext");
OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeNoop(new WebGLRenderingContext(canvas, context.release(), attrs));
renderingContext->registerContextExtensions();
renderingContext->suspendIfNeeded();
if (!renderingContext->drawingBuffer()) {
canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context."));
return nullptr;
}
return renderingContext.release();
}