Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 1115553002: Removing blink::prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 ~ScopedFramebufferRestorer() 490 ~ScopedFramebufferRestorer()
491 { 491 {
492 m_context->restoreCurrentFramebuffer(); 492 m_context->restoreCurrentFramebuffer();
493 } 493 }
494 494
495 private: 495 private:
496 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; 496 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
497 }; 497 };
498 498
499 class WebGLRenderingContextLostCallback final : public NoBaseWillBeGarbageCollec tedFinalized<WebGLRenderingContextLostCallback>, public blink::WebGraphicsContex t3D::WebGraphicsContextLostCallback { 499 class WebGLRenderingContextLostCallback final : public NoBaseWillBeGarbageCollec tedFinalized<WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::We bGraphicsContextLostCallback {
500 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextLostCallback); 500 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextLostCallback);
501 public: 501 public:
502 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebG LRenderingContextBase* context) 502 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebG LRenderingContextBase* context)
503 { 503 {
504 return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context) ); 504 return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context) );
505 } 505 }
506 506
507 virtual ~WebGLRenderingContextLostCallback() { } 507 virtual ~WebGLRenderingContextLostCallback() { }
508 508
509 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext, WebGLRenderingContextBase::Auto); } 509 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext, WebGLRenderingContextBase::Auto); }
510 510
511 DEFINE_INLINE_TRACE() 511 DEFINE_INLINE_TRACE()
512 { 512 {
513 visitor->trace(m_context); 513 visitor->trace(m_context);
514 } 514 }
515 515
516 private: 516 private:
517 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t) 517 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t)
518 : m_context(context) { } 518 : m_context(context) { }
519 519
520 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; 520 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
521 }; 521 };
522 522
523 class WebGLRenderingContextErrorMessageCallback final : public NoBaseWillBeGarba geCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public blink::W ebGraphicsContext3D::WebGraphicsErrorMessageCallback { 523 class WebGLRenderingContextErrorMessageCallback final : public NoBaseWillBeGarba geCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public WebGraph icsContext3D::WebGraphicsErrorMessageCallback {
524 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextErrorMessageCal lback); 524 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextErrorMessageCal lback);
525 public: 525 public:
526 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> cre ate(WebGLRenderingContextBase* context) 526 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> cre ate(WebGLRenderingContextBase* context)
527 { 527 {
528 return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback( context)); 528 return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback( context));
529 } 529 }
530 530
531 virtual ~WebGLRenderingContextErrorMessageCallback() { } 531 virtual ~WebGLRenderingContextErrorMessageCallback() { }
532 532
533 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint ) 533 virtual void onErrorMessage(const WebString& message, WGC3Dint)
534 { 534 {
535 if (m_context->m_synthesizedErrorsToConsole) 535 if (m_context->m_synthesizedErrorsToConsole)
536 m_context->printGLErrorToConsole(message); 536 m_context->printGLErrorToConsole(message);
537 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); 537 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message);
538 } 538 }
539 539
540 DEFINE_INLINE_TRACE() 540 DEFINE_INLINE_TRACE()
541 { 541 {
542 visitor->trace(m_context); 542 visitor->trace(m_context);
543 } 543 }
544 544
545 private: 545 private:
546 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase * context) 546 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase * context)
547 : m_context(context) { } 547 : m_context(context) { }
548 548
549 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; 549 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
550 }; 550 };
551 551
552 PassOwnPtr<blink::WebGraphicsContext3D> WebGLRenderingContextBase::createWebGrap hicsContext3D(HTMLCanvasElement* canvas, WebGLContextAttributes attributes, unsi gned webGLVersion) 552 PassOwnPtr<WebGraphicsContext3D> WebGLRenderingContextBase::createWebGraphicsCon text3D(HTMLCanvasElement* canvas, WebGLContextAttributes attributes, unsigned we bGLVersion)
553 { 553 {
554 Document& document = canvas->document(); 554 Document& document = canvas->document();
555 LocalFrame* frame = document.frame(); 555 LocalFrame* frame = document.frame();
556 if (!frame) { 556 if (!frame) {
557 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext.")); 557 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext."));
558 return nullptr; 558 return nullptr;
559 } 559 }
560 Settings* settings = frame->settings(); 560 Settings* settings = frame->settings();
561 561
562 // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in 562 // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
563 // particular, if WebGL contexts were lost one or more times via the GL_ARB_ robustness extension. 563 // particular, if WebGL contexts were lost one or more times via the GL_ARB_ robustness extension.
564 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) { 564 if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled ())) {
565 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext.")); 565 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Web page was not allowed to create a WebGL cont ext."));
566 return nullptr; 566 return nullptr;
567 } 567 }
568 568
569 blink::WebGraphicsContext3D::Attributes wgc3dAttributes = toWebGraphicsConte xt3DAttributes(attributes, document.topDocument().url().string(), settings, webG LVersion); 569 WebGraphicsContext3D::Attributes wgc3dAttributes = toWebGraphicsContext3DAtt ributes(attributes, document.topDocument().url().string(), settings, webGLVersio n);
570 blink::WebGLInfo glInfo; 570 WebGLInfo glInfo;
571 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(wgc3dAttributes, 0, &glInfo)); 571 OwnPtr<WebGraphicsContext3D> context = adoptPtr(Platform::current()->createO ffscreenGraphicsContext3D(wgc3dAttributes, 0, &glInfo));
572 if (!context || shouldFailContextCreationForTesting) { 572 if (!context || shouldFailContextCreationForTesting) {
573 shouldFailContextCreationForTesting = false; 573 shouldFailContextCreationForTesting = false;
574 String statusMessage; 574 String statusMessage;
575 if (!glInfo.contextInfoCollectionFailure.isEmpty()) { 575 if (!glInfo.contextInfoCollectionFailure.isEmpty()) {
576 statusMessage.append("Could not create a WebGL context. "); 576 statusMessage.append("Could not create a WebGL context. ");
577 statusMessage.append(glInfo.contextInfoCollectionFailure); 577 statusMessage.append(glInfo.contextInfoCollectionFailure);
578 String vendorId = String::number(glInfo.vendorId); 578 String vendorId = String::number(glInfo.vendorId);
579 String deviceId = String::number(glInfo.deviceId); 579 String deviceId = String::number(glInfo.deviceId);
580 if (vendorId.isEmpty()) 580 if (vendorId.isEmpty())
581 statusMessage.append("VendorId = Not Available"); 581 statusMessage.append("VendorId = Not Available");
(...skipping 30 matching lines...) Expand all
612 } 612 }
613 613
614 return context.release(); 614 return context.release();
615 } 615 }
616 616
617 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() 617 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail()
618 { 618 {
619 shouldFailContextCreationForTesting = true; 619 shouldFailContextCreationForTesting = true;
620 } 620 }
621 621
622 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, const WebGLContextAttribu tes& requestedAttributes) 622 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa nvas, PassOwnPtr<WebGraphicsContext3D> context, const WebGLContextAttributes& re questedAttributes)
623 : CanvasRenderingContext(passedCanvas) 623 : CanvasRenderingContext(passedCanvas)
624 , m_contextLostMode(NotLostContext) 624 , m_contextLostMode(NotLostContext)
625 , m_autoRecoveryMethod(Manual) 625 , m_autoRecoveryMethod(Manual)
626 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch ContextLostEvent) 626 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch ContextLostEvent)
627 , m_restoreAllowed(false) 627 , m_restoreAllowed(false)
628 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) 628 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext)
629 , m_generatedImageCache(4) 629 , m_generatedImageCache(4)
630 , m_requestedAttributes(requestedAttributes) 630 , m_requestedAttributes(requestedAttributes)
631 , m_synthesizedErrorsToConsole(true) 631 , m_synthesizedErrorsToConsole(true)
632 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) 632 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole)
(...skipping 16 matching lines...) Expand all
649 #if ENABLE(OILPAN) 649 #if ENABLE(OILPAN)
650 m_sharedWebGraphicsContext3D = WebGLSharedWebGraphicsContext3D::create(buffe r.release()); 650 m_sharedWebGraphicsContext3D = WebGLSharedWebGraphicsContext3D::create(buffe r.release());
651 #else 651 #else
652 m_drawingBuffer = buffer.release(); 652 m_drawingBuffer = buffer.release();
653 #endif 653 #endif
654 654
655 drawingBuffer()->bind(); 655 drawingBuffer()->bind();
656 setupFlags(); 656 setupFlags();
657 } 657 }
658 658
659 PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(PassOwn Ptr<blink::WebGraphicsContext3D> context) 659 PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(PassOwn Ptr<WebGraphicsContext3D> context)
660 { 660 {
661 blink::WebGraphicsContext3D::Attributes attrs; 661 WebGraphicsContext3D::Attributes attrs;
662 attrs.alpha = m_requestedAttributes.alpha(); 662 attrs.alpha = m_requestedAttributes.alpha();
663 attrs.depth = m_requestedAttributes.depth(); 663 attrs.depth = m_requestedAttributes.depth();
664 attrs.stencil = m_requestedAttributes.stencil(); 664 attrs.stencil = m_requestedAttributes.stencil();
665 attrs.antialias = m_requestedAttributes.antialias(); 665 attrs.antialias = m_requestedAttributes.antialias();
666 attrs.premultipliedAlpha = m_requestedAttributes.premultipliedAlpha(); 666 attrs.premultipliedAlpha = m_requestedAttributes.premultipliedAlpha();
667 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes.preser veDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard; 667 DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes.preser veDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard;
668 return DrawingBuffer::create(context, clampedCanvasSize(), preserve, attrs); 668 return DrawingBuffer::create(context, clampedCanvasSize(), preserve, attrs);
669 } 669 }
670 670
671 void WebGLRenderingContextBase::initializeNewContext() 671 void WebGLRenderingContextBase::initializeNewContext()
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 if (needToResetMinFilter) 2110 if (needToResetMinFilter)
2111 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); 2111 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter());
2112 #endif 2112 #endif
2113 tex->generateMipmapLevelInfo(); 2113 tex->generateMipmapLevelInfo();
2114 } 2114 }
2115 2115
2116 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index) 2116 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index)
2117 { 2117 {
2118 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) 2118 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
2119 return nullptr; 2119 return nullptr;
2120 blink::WebGraphicsContext3D::ActiveInfo info; 2120 WebGraphicsContext3D::ActiveInfo info;
2121 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) 2121 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info))
2122 return nullptr; 2122 return nullptr;
2123 return WebGLActiveInfo::create(info.name, info.type, info.size); 2123 return WebGLActiveInfo::create(info.name, info.type, info.size);
2124 } 2124 }
2125 2125
2126 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index) 2126 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index)
2127 { 2127 {
2128 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) 2128 if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
2129 return nullptr; 2129 return nullptr;
2130 blink::WebGraphicsContext3D::ActiveInfo info; 2130 WebGraphicsContext3D::ActiveInfo info;
2131 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) 2131 if (!webContext()->getActiveUniform(objectOrZero(program), index, info))
2132 return nullptr; 2132 return nullptr;
2133 return WebGLActiveInfo::create(info.name, info.type, info.size); 2133 return WebGLActiveInfo::create(info.name, info.type, info.size);
2134 } 2134 }
2135 2135
2136 Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> WebGLRenderingContex tBase::getAttachedShaders(WebGLProgram* program) 2136 Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> WebGLRenderingContex tBase::getAttachedShaders(WebGLProgram* program)
2137 { 2137 {
2138 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) 2138 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
2139 return nullptr; 2139 return nullptr;
2140 2140
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 } 2209 }
2210 } 2210 }
2211 2211
2212 void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib utes>& result) 2212 void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib utes>& result)
2213 { 2213 {
2214 if (isContextLost()) 2214 if (isContextLost())
2215 return; 2215 return;
2216 result.set(m_requestedAttributes); 2216 result.set(m_requestedAttributes);
2217 // Some requested attributes may not be honored, so we need to query the und erlying 2217 // Some requested attributes may not be honored, so we need to query the und erlying
2218 // context/drawing buffer and adjust accordingly. 2218 // context/drawing buffer and adjust accordingly.
2219 blink::WebGraphicsContext3D::Attributes attrs = drawingBuffer()->getActualAt tributes(); 2219 WebGraphicsContext3D::Attributes attrs = drawingBuffer()->getActualAttribute s();
2220 if (m_requestedAttributes.depth() && !attrs.depth) 2220 if (m_requestedAttributes.depth() && !attrs.depth)
2221 result.get().setDepth(false); 2221 result.get().setDepth(false);
2222 if (m_requestedAttributes.stencil() && !attrs.stencil) 2222 if (m_requestedAttributes.stencil() && !attrs.stencil)
2223 result.get().setStencil(false); 2223 result.get().setStencil(false);
2224 result.get().setAntialias(drawingBuffer()->multisample()); 2224 result.get().setAntialias(drawingBuffer()->multisample());
2225 } 2225 }
2226 2226
2227 GLenum WebGLRenderingContextBase::getError() 2227 GLenum WebGLRenderingContextBase::getError()
2228 { 2228 {
2229 if (m_lostContextErrors.size()) { 2229 if (m_lostContextErrors.size()) {
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2807 if (!uniformLocation || uniformLocation->program() != program) { 2807 if (!uniformLocation || uniformLocation->program() != program) {
2808 synthesizeGLError(GL_INVALID_OPERATION, "getUniform", "no uniformlocatio n or not valid for this program"); 2808 synthesizeGLError(GL_INVALID_OPERATION, "getUniform", "no uniformlocatio n or not valid for this program");
2809 return ScriptValue::createNull(scriptState); 2809 return ScriptValue::createNull(scriptState);
2810 } 2810 }
2811 GLint location = uniformLocation->location(); 2811 GLint location = uniformLocation->location();
2812 2812
2813 // FIXME: make this more efficient using WebGLUniformLocation and caching ty pes in it 2813 // FIXME: make this more efficient using WebGLUniformLocation and caching ty pes in it
2814 GLint activeUniforms = 0; 2814 GLint activeUniforms = 0;
2815 webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activ eUniforms); 2815 webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activ eUniforms);
2816 for (GLint i = 0; i < activeUniforms; i++) { 2816 for (GLint i = 0; i < activeUniforms; i++) {
2817 blink::WebGraphicsContext3D::ActiveInfo info; 2817 WebGraphicsContext3D::ActiveInfo info;
2818 if (!webContext()->getActiveUniform(objectOrZero(program), i, info)) 2818 if (!webContext()->getActiveUniform(objectOrZero(program), i, info))
2819 return ScriptValue::createNull(scriptState); 2819 return ScriptValue::createNull(scriptState);
2820 String name = info.name; 2820 String name = info.name;
2821 StringBuilder nameBuilder; 2821 StringBuilder nameBuilder;
2822 // Strip "[0]" from the name if it's an array. 2822 // Strip "[0]" from the name if it's an array.
2823 if (info.size > 1 && name.endsWith("[0]")) 2823 if (info.size > 1 && name.endsWith("[0]"))
2824 info.name = name.left(name.length() - 3); 2824 info.name = name.left(name.length() - 3);
2825 // If it's an array, we need to iterate through each element, appending "[index]" to the name. 2825 // If it's an array, we need to iterate through each element, appending "[index]" to the name.
2826 for (GLint index = 0; index < info.size; ++index) { 2826 for (GLint index = 0; index < info.size; ++index) {
2827 nameBuilder.clear(); 2827 nameBuilder.clear();
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 break; 3292 break;
3293 case GL_HALF_FLOAT_OES: 3293 case GL_HALF_FLOAT_OES:
3294 expectedViewType = DOMArrayBufferView::TypeUint16; 3294 expectedViewType = DOMArrayBufferView::TypeUint16;
3295 break; 3295 break;
3296 default: 3296 default:
3297 synthesizeGLError(GL_INVALID_ENUM, "readPixels", "invalid type"); 3297 synthesizeGLError(GL_INVALID_ENUM, "readPixels", "invalid type");
3298 return; 3298 return;
3299 } 3299 }
3300 if (format != GL_RGBA || type != GL_UNSIGNED_BYTE) { 3300 if (format != GL_RGBA || type != GL_UNSIGNED_BYTE) {
3301 // Check against the implementation color read format and type. 3301 // Check against the implementation color read format and type.
3302 blink::WGC3Dint implFormat = 0, implType = 0; 3302 WGC3Dint implFormat = 0, implType = 0;
3303 webContext()->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &implForm at); 3303 webContext()->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &implForm at);
3304 webContext()->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &implType); 3304 webContext()->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &implType);
3305 if (!implFormat || !implType || format != static_cast<GLenum>(implFormat ) || type != static_cast<GLenum>(implType)) { 3305 if (!implFormat || !implType || format != static_cast<GLenum>(implFormat ) || type != static_cast<GLenum>(implType)) {
3306 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "format/type n ot RGBA/UNSIGNED_BYTE or implementation-defined values"); 3306 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "format/type n ot RGBA/UNSIGNED_BYTE or implementation-defined values");
3307 return; 3307 return;
3308 } 3308 }
3309 } 3309 }
3310 // Validate array type against pixel type. 3310 // Validate array type against pixel type.
3311 if (pixels->type() != expectedViewType) { 3311 if (pixels->type() != expectedViewType) {
3312 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "ArrayBufferView w as the wrong type for the pixel format"); 3312 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "ArrayBufferView w as the wrong type for the pixel format");
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
4635 if (!m_restoreAllowed) { 4635 if (!m_restoreAllowed) {
4636 if (m_contextLostMode == WebGLLoseContextLostContext) 4636 if (m_contextLostMode == WebGLLoseContextLostContext)
4637 synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context r estoration not allowed"); 4637 synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context r estoration not allowed");
4638 return; 4638 return;
4639 } 4639 }
4640 4640
4641 if (!m_restoreTimer.isActive()) 4641 if (!m_restoreTimer.isActive())
4642 m_restoreTimer.startOneShot(0, FROM_HERE); 4642 m_restoreTimer.startOneShot(0, FROM_HERE);
4643 } 4643 }
4644 4644
4645 blink::WebLayer* WebGLRenderingContextBase::platformLayer() const 4645 WebLayer* WebGLRenderingContextBase::platformLayer() const
4646 { 4646 {
4647 return isContextLost() ? 0 : drawingBuffer()->platformLayer(); 4647 return isContextLost() ? 0 : drawingBuffer()->platformLayer();
4648 } 4648 }
4649 4649
4650 void WebGLRenderingContextBase::setFilterQuality(SkFilterQuality filterQuality) 4650 void WebGLRenderingContextBase::setFilterQuality(SkFilterQuality filterQuality)
4651 { 4651 {
4652 if (!isContextLost() && drawingBuffer()) { 4652 if (!isContextLost() && drawingBuffer()) {
4653 drawingBuffer()->setFilterQuality(filterQuality); 4653 drawingBuffer()->setFilterQuality(filterQuality);
4654 } 4654 }
4655 } 4655 }
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5867 // If the context was lost due to RealLostContext, we need to destroy the ol d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou gh. 5867 // If the context was lost due to RealLostContext, we need to destroy the ol d DrawingBuffer before creating new DrawingBuffer to ensure resource budget enou gh.
5868 if (drawingBuffer()) { 5868 if (drawingBuffer()) {
5869 #if ENABLE(OILPAN) 5869 #if ENABLE(OILPAN)
5870 m_sharedWebGraphicsContext3D->dispose(); 5870 m_sharedWebGraphicsContext3D->dispose();
5871 #else 5871 #else
5872 m_drawingBuffer->beginDestruction(); 5872 m_drawingBuffer->beginDestruction();
5873 m_drawingBuffer.clear(); 5873 m_drawingBuffer.clear();
5874 #endif 5874 #endif
5875 } 5875 }
5876 5876
5877 blink::WebGraphicsContext3D::Attributes attributes = toWebGraphicsContext3DA ttributes(m_requestedAttributes, canvas()->document().topDocument().url().string (), settings, version()); 5877 WebGraphicsContext3D::Attributes attributes = toWebGraphicsContext3DAttribut es(m_requestedAttributes, canvas()->document().topDocument().url().string(), set tings, version());
5878 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0)); 5878 OwnPtr<WebGraphicsContext3D> context = adoptPtr(Platform::current()->createO ffscreenGraphicsContext3D(attributes, 0));
5879 RefPtr<DrawingBuffer> buffer; 5879 RefPtr<DrawingBuffer> buffer;
5880 if (context) { 5880 if (context) {
5881 // Construct a new drawing buffer with the new WebGraphicsContext3D. 5881 // Construct a new drawing buffer with the new WebGraphicsContext3D.
5882 buffer = createDrawingBuffer(context.release()); 5882 buffer = createDrawingBuffer(context.release());
5883 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i s set to null. 5883 // If DrawingBuffer::create() fails to allocate a fbo, |drawingBuffer| i s set to null.
5884 } 5884 }
5885 if (!buffer) { 5885 if (!buffer) {
5886 if (m_contextLostMode == RealLostContext) { 5886 if (m_contextLostMode == RealLostContext) {
5887 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts, FROM_HERE ); 5887 m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts, FROM_HERE );
5888 } else { 5888 } else {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
6185 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6185 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6186 } 6186 }
6187 #else 6187 #else
6188 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6188 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6189 { 6189 {
6190 return m_drawingBuffer.get(); 6190 return m_drawingBuffer.get();
6191 } 6191 }
6192 #endif 6192 #endif
6193 6193
6194 } // namespace blink 6194 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContextBase.h ('k') | Source/core/html/canvas/WebGLSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698