| 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 (isContextLost() || !validateImageBitmap("texImage2D", bitmap.get(), exce
ptionState) || !validateTexFunc("texImage2D", TexImage, SourceImageBitmap, targe
t, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0, 0, 0)) |
| 4513 synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "The source data has b
een neutered."); | |
| 4514 return; | |
| 4515 } | |
| 4516 if (isContextLost() || !validateTexFunc("texImage2D", TexImage, SourceImageB
itmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type,
0, 0, 0)) | |
| 4517 return; | 4513 return; |
| 4518 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); | 4514 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); |
| 4519 texImage2DImpl(target, level, internalformat, format, type, imageForRender,
WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha); | 4515 texImage2DImpl(target, level, internalformat, format, type, imageForRender,
WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha); |
| 4520 } | 4516 } |
| 4521 | 4517 |
| 4522 void WebGLRenderingContextBase::texParameter(GLenum target, GLenum pname, GLfloa
t paramf, GLint parami, bool isFloat) | 4518 void WebGLRenderingContextBase::texParameter(GLenum target, GLenum pname, GLfloa
t paramf, GLint parami, bool isFloat) |
| 4523 { | 4519 { |
| 4524 if (isContextLost()) | 4520 if (isContextLost()) |
| 4525 return; | 4521 return; |
| 4526 WebGLTexture* tex = validateTextureBinding("texParameter", target, false); | 4522 WebGLTexture* tex = validateTextureBinding("texParameter", target, false); |
| (...skipping 198 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)) | 4721 || !validateTexFunc("texSubImage2D", TexSubImage, SourceHTMLVideoElement
, target, level, 0, video->videoWidth(), video->videoHeight(), 1, 0, format, typ
e, xoffset, yoffset, 0)) |
| 4726 return; | 4722 return; |
| 4727 | 4723 |
| 4728 RefPtr<Image> image = videoFrameToImage(video); | 4724 RefPtr<Image> image = videoFrameToImage(video); |
| 4729 if (!image) | 4725 if (!image) |
| 4730 return; | 4726 return; |
| 4731 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get()
, WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha); | 4727 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get()
, WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha); |
| 4732 } | 4728 } |
| 4733 | 4729 |
| 4734 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, | 4730 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, |
| 4735 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap) | 4731 GLenum format, GLenum type, PassRefPtrWillBeRawPtr<ImageBitmap> bitmap, Exce
ptionState& exceptionState) |
| 4736 { | 4732 { |
| 4737 ASSERT(bitmap->bitmapImage()); | 4733 ASSERT(bitmap->bitmapImage()); |
| 4738 if (bitmap->isNeutered()) { | 4734 if (isContextLost() || !validateImageBitmap("texSubImage2D", bitmap.get(), e
xceptionState) || !validateTexFunc("texSubImage2D", TexSubImage, SourceImageBitm
ap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format, type, 0,
0, 0)) |
| 4739 synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "The source data ha
s been neutered."); | |
| 4740 return; | |
| 4741 } | |
| 4742 if (isContextLost() || !validateTexFunc("texSubImage2D", TexSubImage, Source
ImageBitmap, target, level, 0, bitmap->width(), bitmap->height(), 1, 0, format,
type, 0, 0, 0)) | |
| 4743 return; | 4735 return; |
| 4744 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); | 4736 StaticBitmapImage* imageForRender = bitmap->bitmapImage(); |
| 4745 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen
der, WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha
); | 4737 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen
der, WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha
); |
| 4746 } | 4738 } |
| 4747 | 4739 |
| 4748 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location,
GLfloat x) | 4740 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location,
GLfloat x) |
| 4749 { | 4741 { |
| 4750 if (isContextLost() || !location) | 4742 if (isContextLost() || !location) |
| 4751 return; | 4743 return; |
| 4752 | 4744 |
| (...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6497 return false; | 6489 return false; |
| 6498 } | 6490 } |
| 6499 | 6491 |
| 6500 if (wouldTaintOrigin(video)) { | 6492 if (wouldTaintOrigin(video)) { |
| 6501 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); | 6493 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); |
| 6502 return false; | 6494 return false; |
| 6503 } | 6495 } |
| 6504 return true; | 6496 return true; |
| 6505 } | 6497 } |
| 6506 | 6498 |
| 6499 bool WebGLRenderingContextBase::validateImageBitmap(const char* functionName, Im
ageBitmap* bitmap, ExceptionState& exceptionState) |
| 6500 { |
| 6501 if (bitmap->isNeutered()) { |
| 6502 synthesizeGLError(GL_INVALID_VALUE, "texImage2D", "The source data has b
een neutered."); |
| 6503 return false; |
| 6504 } |
| 6505 if (!bitmap->originClean()) { |
| 6506 exceptionState.throwSecurityError("The ImageBitmap contains cross-origin
data, and may not be loaded."); |
| 6507 return false; |
| 6508 } |
| 6509 return true; |
| 6510 } |
| 6511 |
| 6507 bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLe
num mode, GLint first, GLsizei count) | 6512 bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLe
num mode, GLint first, GLsizei count) |
| 6508 { | 6513 { |
| 6509 if (isContextLost()) | 6514 if (isContextLost()) |
| 6510 return false; | 6515 return false; |
| 6511 | 6516 |
| 6512 if (!validateStencilSettings(functionName)) | 6517 if (!validateStencilSettings(functionName)) |
| 6513 return false; | 6518 return false; |
| 6514 | 6519 |
| 6515 if (!validateRenderingState(functionName)) { | 6520 if (!validateRenderingState(functionName)) { |
| 6516 return false; | 6521 return false; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6937 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6942 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6938 } | 6943 } |
| 6939 | 6944 |
| 6940 void WebGLRenderingContextBase::restoreUnpackParameters() | 6945 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6941 { | 6946 { |
| 6942 if (m_unpackAlignment != 1) | 6947 if (m_unpackAlignment != 1) |
| 6943 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6948 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6944 } | 6949 } |
| 6945 | 6950 |
| 6946 } // namespace blink | 6951 } // namespace blink |
| OLD | NEW |