Chromium Code Reviews| 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 4488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4499 } | 4499 } |
| 4500 | 4500 |
| 4501 // Normal pure SW path. | 4501 // Normal pure SW path. |
| 4502 RefPtr<Image> image = videoFrameToImage(video); | 4502 RefPtr<Image> image = videoFrameToImage(video); |
| 4503 if (!image) | 4503 if (!image) |
| 4504 return; | 4504 return; |
| 4505 texImage2DImpl(target, level, internalformat, format, type, image.get(), Web GLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha); | 4505 texImage2DImpl(target, level, internalformat, format, type, image.get(), Web GLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha); |
| 4506 } | 4506 } |
| 4507 | 4507 |
| 4508 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int ernalformat, | 4508 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int ernalformat, |
| 4509 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap) | 4509 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, Exce ptionState& exceptionState) |
| 4510 { | 4510 { |
| 4511 ASSERT(bitmap->bitmapImage()); | 4511 ASSERT(bitmap->bitmapImage()); |
| 4512 if (bitmap->isNeutered()) { | 4512 if (bitmap->isNeutered()) { |
| 4513 synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "The source data has b een neutered."); | 4513 synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "The source data has b een neutered."); |
| 4514 return; | 4514 return; |
| 4515 } | 4515 } |
| 4516 if (!bitmap->originClean()) { | |
|
Justin Novosad
2016/01/11 17:52:13
Could you factor this out into a helper, like the
| |
| 4517 exceptionState.throwSecurityError("The ImageBitmap contains cross-origin data, and may not be loaded."); | |
| 4518 return; | |
| 4519 } | |
| 4516 if (isContextLost() || !validateTexFunc("texImage2D", TexImage, SourceImageB itmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0)) | 4520 if (isContextLost() || !validateTexFunc("texImage2D", TexImage, SourceImageB itmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0)) |
| 4517 return; | 4521 return; |
| 4518 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); | 4522 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); |
| 4519 texImage2DImpl(target, level, internalformat, format, type, imageForRender, WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha); | 4523 texImage2DImpl(target, level, internalformat, format, type, imageForRender, WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha); |
| 4520 } | 4524 } |
| 4521 | 4525 |
| 4522 void WebGLRenderingContextBase::texParameter(GLenum target, GLenum pname, GLfloa t paramf, GLint parami, bool isFloat) | 4526 void WebGLRenderingContextBase::texParameter(GLenum target, GLenum pname, GLfloa t paramf, GLint parami, bool isFloat) |
| 4523 { | 4527 { |
| 4524 if (isContextLost()) | 4528 if (isContextLost()) |
| 4525 return; | 4529 return; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4725 || !validateTexFunc("texSubImage2D", TexSubImage, SourceHTMLVideoElement , target, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, typ e, xoffset, yoffset, 0)) | 4729 || !validateTexFunc("texSubImage2D", TexSubImage, SourceHTMLVideoElement , target, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, typ e, xoffset, yoffset, 0)) |
| 4726 return; | 4730 return; |
| 4727 | 4731 |
| 4728 RefPtr<Image> image = videoFrameToImage(video); | 4732 RefPtr<Image> image = videoFrameToImage(video); |
| 4729 if (!image) | 4733 if (!image) |
| 4730 return; | 4734 return; |
| 4731 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get() , WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha); | 4735 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get() , WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha); |
| 4732 } | 4736 } |
| 4733 | 4737 |
| 4734 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, | 4738 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| 4735 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap) | 4739 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, Exce ptionState& exceptionState) |
| 4736 { | 4740 { |
| 4737 ASSERT(bitmap->bitmapImage()); | 4741 ASSERT(bitmap->bitmapImage()); |
| 4738 if (bitmap->isNeutered()) { | 4742 if (bitmap->isNeutered()) { |
| 4739 synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "The source data ha s been neutered."); | 4743 synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "The source data ha s been neutered."); |
| 4740 return; | 4744 return; |
| 4741 } | 4745 } |
| 4746 if (!bitmap->originClean()) { | |
|
Justin Novosad
2016/01/11 17:52:13
Ditto. -> use helper to avoid duplicated code (and
| |
| 4747 exceptionState.throwSecurityError("The ImageBitmap contains cross-origin data, and may not be loaded."); | |
| 4748 return; | |
| 4749 } | |
| 4742 if (isContextLost() || !validateTexFunc("texSubImage2D", TexSubImage, Source ImageBitmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0)) | 4750 if (isContextLost() || !validateTexFunc("texSubImage2D", TexSubImage, Source ImageBitmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0)) |
| 4743 return; | 4751 return; |
| 4744 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); | 4752 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); |
| 4745 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen der, WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha ); | 4753 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen der, WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha ); |
| 4746 } | 4754 } |
| 4747 | 4755 |
| 4748 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, GLfloat x) | 4756 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, GLfloat x) |
| 4749 { | 4757 { |
| 4750 if (isContextLost() || !location) | 4758 if (isContextLost() || !location) |
| 4751 return; | 4759 return; |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6937 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6945 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6938 } | 6946 } |
| 6939 | 6947 |
| 6940 void WebGLRenderingContextBase::restoreUnpackParameters() | 6948 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6941 { | 6949 { |
| 6942 if (m_unpackAlignment != 1) | 6950 if (m_unpackAlignment != 1) |
| 6943 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6951 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6944 } | 6952 } |
| 6945 | 6953 |
| 6946 } // namespace blink | 6954 } // namespace blink |
| OLD | NEW |