OLD | NEW |
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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 context_provider->ContextGL()->GetIntegerv(GL_MAX_VIEWPORT_DIMS, | 1046 context_provider->ContextGL()->GetIntegerv(GL_MAX_VIEWPORT_DIMS, |
1047 max_viewport_dims_); | 1047 max_viewport_dims_); |
1048 | 1048 |
1049 RefPtr<DrawingBuffer> buffer; | 1049 RefPtr<DrawingBuffer> buffer; |
1050 buffer = CreateDrawingBuffer(std::move(context_provider)); | 1050 buffer = CreateDrawingBuffer(std::move(context_provider)); |
1051 if (!buffer) { | 1051 if (!buffer) { |
1052 context_lost_mode_ = kSyntheticLostContext; | 1052 context_lost_mode_ = kSyntheticLostContext; |
1053 return; | 1053 return; |
1054 } | 1054 } |
1055 | 1055 |
1056 drawing_buffer_ = buffer.Release(); | 1056 drawing_buffer_ = std::move(buffer); |
1057 drawing_buffer_->AddNewMailboxCallback( | 1057 drawing_buffer_->AddNewMailboxCallback( |
1058 WTF::Bind(&WebGLRenderingContextBase::NotifyCanvasContextChanged, | 1058 WTF::Bind(&WebGLRenderingContextBase::NotifyCanvasContextChanged, |
1059 WrapWeakPersistent(this))); | 1059 WrapWeakPersistent(this))); |
1060 GetDrawingBuffer()->Bind(GL_FRAMEBUFFER); | 1060 GetDrawingBuffer()->Bind(GL_FRAMEBUFFER); |
1061 SetupFlags(); | 1061 SetupFlags(); |
1062 | 1062 |
1063 #define ADD_VALUES_TO_SET(set, values) \ | 1063 #define ADD_VALUES_TO_SET(set, values) \ |
1064 for (size_t i = 0; i < WTF_ARRAY_LENGTH(values); ++i) { \ | 1064 for (size_t i = 0; i < WTF_ARRAY_LENGTH(values); ++i) { \ |
1065 set.insert(values[i]); \ | 1065 set.insert(values[i]); \ |
1066 } | 1066 } |
(...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4864 exception_state)) | 4864 exception_state)) |
4865 return; | 4865 return; |
4866 if (!ValidateTexImageBinding(func_name, function_id, target)) | 4866 if (!ValidateTexImageBinding(func_name, function_id, target)) |
4867 return; | 4867 return; |
4868 | 4868 |
4869 RefPtr<Image> image_for_render = image->CachedImage()->GetImage(); | 4869 RefPtr<Image> image_for_render = image->CachedImage()->GetImage(); |
4870 if (image_for_render && image_for_render->IsSVGImage()) { | 4870 if (image_for_render && image_for_render->IsSVGImage()) { |
4871 if (canvas()) { | 4871 if (canvas()) { |
4872 UseCounter::Count(canvas()->GetDocument(), UseCounter::kSVGInWebGL); | 4872 UseCounter::Count(canvas()->GetDocument(), UseCounter::kSVGInWebGL); |
4873 } | 4873 } |
4874 image_for_render = DrawImageIntoBuffer( | 4874 image_for_render = |
4875 image_for_render.Release(), image->width(), image->height(), func_name); | 4875 DrawImageIntoBuffer(std::move(image_for_render), image->width(), |
| 4876 image->height(), func_name); |
4876 } | 4877 } |
4877 | 4878 |
4878 TexImageFunctionType function_type; | 4879 TexImageFunctionType function_type; |
4879 if (function_id == kTexImage2D || function_id == kTexImage3D) | 4880 if (function_id == kTexImage2D || function_id == kTexImage3D) |
4880 function_type = kTexImage; | 4881 function_type = kTexImage; |
4881 else | 4882 else |
4882 function_type = kTexSubImage; | 4883 function_type = kTexSubImage; |
4883 if (!image_for_render || | 4884 if (!image_for_render || |
4884 !ValidateTexFunc(func_name, function_type, kSourceHTMLImageElement, | 4885 !ValidateTexFunc(func_name, function_type, kSourceHTMLImageElement, |
4885 target, level, internalformat, image_for_render->width(), | 4886 target, level, internalformat, image_for_render->width(), |
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7525 restore_timer_.StartOneShot(kSecondsBetweenRestoreAttempts, | 7526 restore_timer_.StartOneShot(kSecondsBetweenRestoreAttempts, |
7526 BLINK_FROM_HERE); | 7527 BLINK_FROM_HERE); |
7527 } else { | 7528 } else { |
7528 // This likely shouldn't happen but is the best way to report it to the | 7529 // This likely shouldn't happen but is the best way to report it to the |
7529 // WebGL app. | 7530 // WebGL app. |
7530 SynthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context"); | 7531 SynthesizeGLError(GL_INVALID_OPERATION, "", "error restoring context"); |
7531 } | 7532 } |
7532 return; | 7533 return; |
7533 } | 7534 } |
7534 | 7535 |
7535 drawing_buffer_ = buffer.Release(); | 7536 drawing_buffer_ = std::move(buffer); |
7536 drawing_buffer_->AddNewMailboxCallback( | 7537 drawing_buffer_->AddNewMailboxCallback( |
7537 WTF::Bind(&WebGLRenderingContextBase::NotifyCanvasContextChanged, | 7538 WTF::Bind(&WebGLRenderingContextBase::NotifyCanvasContextChanged, |
7538 WrapWeakPersistent(this))); | 7539 WrapWeakPersistent(this))); |
7539 | 7540 |
7540 GetDrawingBuffer()->Bind(GL_FRAMEBUFFER); | 7541 GetDrawingBuffer()->Bind(GL_FRAMEBUFFER); |
7541 lost_context_errors_.clear(); | 7542 lost_context_errors_.clear(); |
7542 context_lost_mode_ = kNotLostContext; | 7543 context_lost_mode_ = kNotLostContext; |
7543 auto_recovery_method_ = kManual; | 7544 auto_recovery_method_ = kManual; |
7544 restore_allowed_ = false; | 7545 restore_allowed_ = false; |
7545 RemoveFromEvictedList(this); | 7546 RemoveFromEvictedList(this); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7830 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7831 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
7831 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7832 HTMLCanvasElementOrOffscreenCanvas& result) const { |
7832 if (canvas()) { | 7833 if (canvas()) { |
7833 result.setHTMLCanvasElement(static_cast<HTMLCanvasElement*>(host())); | 7834 result.setHTMLCanvasElement(static_cast<HTMLCanvasElement*>(host())); |
7834 } else { | 7835 } else { |
7835 result.setOffscreenCanvas(static_cast<OffscreenCanvas*>(host())); | 7836 result.setOffscreenCanvas(static_cast<OffscreenCanvas*>(host())); |
7836 } | 7837 } |
7837 } | 7838 } |
7838 | 7839 |
7839 } // namespace blink | 7840 } // namespace blink |
OLD | NEW |