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 4315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4326 GLint level, | 4326 GLint level, |
| 4327 GLint internalformat, | 4327 GLint internalformat, |
| 4328 GLint xoffset, | 4328 GLint xoffset, |
| 4329 GLint yoffset, | 4329 GLint yoffset, |
| 4330 GLint zoffset, | 4330 GLint zoffset, |
| 4331 GLenum format, | 4331 GLenum format, |
| 4332 GLenum type, | 4332 GLenum type, |
| 4333 Image* image, | 4333 Image* image, |
| 4334 WebGLImageConversion::ImageHtmlDomSource domSource, | 4334 WebGLImageConversion::ImageHtmlDomSource domSource, |
| 4335 bool flipY, | 4335 bool flipY, |
| 4336 bool premultiplyAlpha) { | 4336 bool premultiplyAlpha, |
| 4337 const IntRect& sourceImageRect) { | |
| 4337 const char* funcName = getTexImageFunctionName(functionID); | 4338 const char* funcName = getTexImageFunctionName(functionID); |
| 4338 // All calling functions check isContextLost, so a duplicate check is not | 4339 // All calling functions check isContextLost, so a duplicate check is not |
| 4339 // needed here. | 4340 // needed here. |
| 4340 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | 4341 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { |
| 4341 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | 4342 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. |
| 4342 type = GL_FLOAT; | 4343 type = GL_FLOAT; |
| 4343 } | 4344 } |
| 4344 Vector<uint8_t> data; | 4345 Vector<uint8_t> data; |
| 4346 | |
| 4347 IntRect subRect = sourceImageRect; | |
| 4348 if (subRect == sentinelEmptyRect()) { | |
| 4349 // Recalculate based on the size of the Image. | |
| 4350 subRect = safeGetImageSize(image); | |
| 4351 } | |
| 4352 | |
| 4353 bool selectingSubRectangle = image && | |
| 4354 !(subRect.x() == 0 && subRect.y() == 0 && | |
| 4355 subRect.width() == image->width() && | |
| 4356 subRect.height() == image->height()); | |
| 4357 // If the source image rect selects anything except the entire | |
| 4358 // contents of the image, assert that we're running WebGL 2.0 or | |
| 4359 // higher, since this should never happen for WebGL 1.0 (even though | |
| 4360 // the code could support it). If the image is null, that will be | |
| 4361 // signaled as an error later. | |
| 4362 DCHECK(!selectingSubRectangle || isWebGL2OrHigher()) | |
| 4363 << "subRect = (" << subRect.width() << " x " << subRect.height() | |
| 4364 << ") @ (" << subRect.x() << ", " << subRect.y() << "), image = (" | |
| 4365 << (image ? image->width() : -1) << " x " | |
| 4366 << (image ? image->height() : -1) << ")"; | |
| 4367 | |
| 4368 if (subRect.x() < 0 || subRect.y() < 0 || subRect.maxX() > image->width() || | |
| 4369 subRect.maxY() > image->height() || subRect.width() < 0 || | |
| 4370 subRect.height() < 0) { | |
| 4371 synthesizeGLError(GL_INVALID_OPERATION, funcName, | |
|
Zhenyao Mo
2016/10/31 22:50:51
Should we generate INVALID_VALUE here? subRect's w
Ken Russell (switch to Gerrit)
2016/11/01 00:31:34
Thanks, good point; I'll address this in a follow-
| |
| 4372 "source sub-rectangle specified via pixel unpack " | |
| 4373 "parameters is invalid"); | |
| 4374 return; | |
| 4375 } | |
| 4376 | |
| 4377 // Adjust the source image rectangle if doing a y-flip. | |
| 4378 IntRect adjustedSourceImageRect = subRect; | |
| 4379 if (flipY) { | |
| 4380 adjustedSourceImageRect.setY(image->height() - | |
| 4381 adjustedSourceImageRect.maxY()); | |
| 4382 } | |
| 4383 | |
| 4345 WebGLImageConversion::ImageExtractor imageExtractor( | 4384 WebGLImageConversion::ImageExtractor imageExtractor( |
| 4346 image, domSource, premultiplyAlpha, | 4385 image, domSource, premultiplyAlpha, |
| 4347 m_unpackColorspaceConversion == GL_NONE); | 4386 m_unpackColorspaceConversion == GL_NONE); |
| 4348 if (!imageExtractor.imagePixelData()) { | 4387 if (!imageExtractor.imagePixelData()) { |
| 4349 synthesizeGLError(GL_INVALID_VALUE, funcName, "bad image data"); | 4388 synthesizeGLError(GL_INVALID_VALUE, funcName, "bad image data"); |
| 4350 return; | 4389 return; |
| 4351 } | 4390 } |
| 4391 | |
| 4352 WebGLImageConversion::DataFormat sourceDataFormat = | 4392 WebGLImageConversion::DataFormat sourceDataFormat = |
| 4353 imageExtractor.imageSourceFormat(); | 4393 imageExtractor.imageSourceFormat(); |
| 4354 WebGLImageConversion::AlphaOp alphaOp = imageExtractor.imageAlphaOp(); | 4394 WebGLImageConversion::AlphaOp alphaOp = imageExtractor.imageAlphaOp(); |
| 4355 const void* imagePixelData = imageExtractor.imagePixelData(); | 4395 const void* imagePixelData = imageExtractor.imagePixelData(); |
| 4356 | 4396 |
| 4357 bool needConversion = true; | 4397 bool needConversion = true; |
| 4358 if (type == GL_UNSIGNED_BYTE && | 4398 if (type == GL_UNSIGNED_BYTE && |
| 4359 sourceDataFormat == WebGLImageConversion::DataFormatRGBA8 && | 4399 sourceDataFormat == WebGLImageConversion::DataFormatRGBA8 && |
| 4360 format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNothing && | 4400 format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNothing && |
| 4361 !flipY) { | 4401 !flipY && !selectingSubRectangle) { |
| 4362 needConversion = false; | 4402 needConversion = false; |
| 4363 } else { | 4403 } else { |
| 4364 if (!WebGLImageConversion::packImageData( | 4404 if (!WebGLImageConversion::packImageData( |
| 4365 image, imagePixelData, format, type, flipY, alphaOp, | 4405 image, imagePixelData, format, type, flipY, alphaOp, |
| 4366 sourceDataFormat, imageExtractor.imageWidth(), | 4406 sourceDataFormat, imageExtractor.imageWidth(), |
| 4367 imageExtractor.imageHeight(), | 4407 imageExtractor.imageHeight(), adjustedSourceImageRect, |
| 4368 imageExtractor.imageSourceUnpackAlignment(), data)) { | 4408 imageExtractor.imageSourceUnpackAlignment(), data)) { |
| 4369 synthesizeGLError(GL_INVALID_VALUE, funcName, "packImage error"); | 4409 synthesizeGLError(GL_INVALID_VALUE, funcName, "packImage error"); |
| 4370 return; | 4410 return; |
| 4371 } | 4411 } |
| 4372 } | 4412 } |
| 4373 | 4413 |
| 4374 resetUnpackParameters(); | 4414 resetUnpackParameters(); |
| 4375 if (functionID == TexImage2D) { | 4415 if (functionID == TexImage2D) { |
| 4376 texImage2DBase(target, level, internalformat, imageExtractor.imageWidth(), | 4416 texImage2DBase(target, level, internalformat, |
| 4377 imageExtractor.imageHeight(), 0, format, type, | 4417 adjustedSourceImageRect.width(), |
| 4418 adjustedSourceImageRect.height(), 0, format, type, | |
| 4378 needConversion ? data.data() : imagePixelData); | 4419 needConversion ? data.data() : imagePixelData); |
| 4379 } else if (functionID == TexSubImage2D) { | 4420 } else if (functionID == TexSubImage2D) { |
| 4380 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, | 4421 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, |
| 4381 imageExtractor.imageWidth(), | 4422 adjustedSourceImageRect.width(), |
| 4382 imageExtractor.imageHeight(), format, type, | 4423 adjustedSourceImageRect.height(), format, type, |
| 4383 needConversion ? data.data() : imagePixelData); | 4424 needConversion ? data.data() : imagePixelData); |
| 4384 } else { | 4425 } else { |
| 4385 DCHECK_EQ(functionID, TexSubImage3D); | 4426 DCHECK_EQ(functionID, TexSubImage3D); |
| 4386 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, | 4427 contextGL()->TexSubImage3D( |
| 4387 imageExtractor.imageWidth(), | 4428 target, level, xoffset, yoffset, zoffset, |
| 4388 imageExtractor.imageHeight(), 1, format, type, | 4429 adjustedSourceImageRect.width(), adjustedSourceImageRect.height(), 1, |
| 4389 needConversion ? data.data() : imagePixelData); | 4430 format, type, needConversion ? data.data() : imagePixelData); |
| 4390 } | 4431 } |
| 4391 restoreUnpackParameters(); | 4432 restoreUnpackParameters(); |
| 4392 } | 4433 } |
| 4393 | 4434 |
| 4394 bool WebGLRenderingContextBase::validateTexFunc( | 4435 bool WebGLRenderingContextBase::validateTexFunc( |
| 4395 const char* functionName, | 4436 const char* functionName, |
| 4396 TexImageFunctionType functionType, | 4437 TexImageFunctionType functionType, |
| 4397 TexFuncValidationSourceType sourceType, | 4438 TexFuncValidationSourceType sourceType, |
| 4398 GLenum target, | 4439 GLenum target, |
| 4399 GLint level, | 4440 GLint level, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4496 return "texSubImage2D"; | 4537 return "texSubImage2D"; |
| 4497 case TexSubImage3D: | 4538 case TexSubImage3D: |
| 4498 return "texSubImage3D"; | 4539 return "texSubImage3D"; |
| 4499 case TexImage3D: | 4540 case TexImage3D: |
| 4500 return "texImage3D"; | 4541 return "texImage3D"; |
| 4501 default: // Adding default to prevent compile error | 4542 default: // Adding default to prevent compile error |
| 4502 return ""; | 4543 return ""; |
| 4503 } | 4544 } |
| 4504 } | 4545 } |
| 4505 | 4546 |
| 4547 IntRect WebGLRenderingContextBase::sentinelEmptyRect() { | |
| 4548 // Return a rectangle with -1 width and height so we can recognize | |
| 4549 // it later and recalculate it based on the Image whose data we'll | |
| 4550 // upload. It's important that there be no possible differences in | |
| 4551 // the logic which computes the image's size. | |
| 4552 return IntRect(0, 0, -1, -1); | |
| 4553 } | |
| 4554 | |
| 4555 IntRect WebGLRenderingContextBase::safeGetImageSize(Image* image) { | |
| 4556 if (!image) | |
| 4557 return IntRect(); | |
| 4558 | |
| 4559 return IntRect(0, 0, image->width(), image->height()); | |
| 4560 } | |
| 4561 | |
| 4506 void WebGLRenderingContextBase::texImageHelperDOMArrayBufferView( | 4562 void WebGLRenderingContextBase::texImageHelperDOMArrayBufferView( |
| 4507 TexImageFunctionID functionID, | 4563 TexImageFunctionID functionID, |
| 4508 GLenum target, | 4564 GLenum target, |
| 4509 GLint level, | 4565 GLint level, |
| 4510 GLint internalformat, | 4566 GLint internalformat, |
| 4511 GLsizei width, | 4567 GLsizei width, |
| 4512 GLsizei height, | 4568 GLsizei height, |
| 4513 GLsizei depth, | 4569 GLsizei depth, |
| 4514 GLint border, | 4570 GLint border, |
| 4515 GLenum format, | 4571 GLenum format, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4690 TexImageFunctionID functionID, | 4746 TexImageFunctionID functionID, |
| 4691 GLenum target, | 4747 GLenum target, |
| 4692 GLint level, | 4748 GLint level, |
| 4693 GLint internalformat, | 4749 GLint internalformat, |
| 4694 GLenum format, | 4750 GLenum format, |
| 4695 GLenum type, | 4751 GLenum type, |
| 4696 GLint xoffset, | 4752 GLint xoffset, |
| 4697 GLint yoffset, | 4753 GLint yoffset, |
| 4698 GLint zoffset, | 4754 GLint zoffset, |
| 4699 HTMLImageElement* image, | 4755 HTMLImageElement* image, |
| 4756 const IntRect& sourceImageRect, | |
| 4700 ExceptionState& exceptionState) { | 4757 ExceptionState& exceptionState) { |
| 4701 const char* funcName = getTexImageFunctionName(functionID); | 4758 const char* funcName = getTexImageFunctionName(functionID); |
| 4702 if (isContextLost()) | 4759 if (isContextLost()) |
| 4703 return; | 4760 return; |
| 4704 if (!validateHTMLImageElement(funcName, image, exceptionState)) | 4761 if (!validateHTMLImageElement(funcName, image, exceptionState)) |
| 4705 return; | 4762 return; |
| 4706 if (!validateTexImageBinding(funcName, functionID, target)) | 4763 if (!validateTexImageBinding(funcName, functionID, target)) |
| 4707 return; | 4764 return; |
| 4708 | 4765 |
| 4709 RefPtr<Image> imageForRender = image->cachedImage()->getImage(); | 4766 RefPtr<Image> imageForRender = image->cachedImage()->getImage(); |
| 4710 if (imageForRender && imageForRender->isSVGImage()) | 4767 if (imageForRender && imageForRender->isSVGImage()) |
| 4711 imageForRender = drawImageIntoBuffer( | 4768 imageForRender = drawImageIntoBuffer( |
| 4712 imageForRender.release(), image->width(), image->height(), funcName); | 4769 imageForRender.release(), image->width(), image->height(), funcName); |
| 4713 | 4770 |
| 4714 TexImageFunctionType functionType; | 4771 TexImageFunctionType functionType; |
| 4715 if (functionID == TexImage2D) | 4772 if (functionID == TexImage2D) |
| 4716 functionType = TexImage; | 4773 functionType = TexImage; |
| 4717 else | 4774 else |
| 4718 functionType = TexSubImage; | 4775 functionType = TexSubImage; |
| 4719 if (!imageForRender || | 4776 if (!imageForRender || |
| 4720 !validateTexFunc(funcName, functionType, SourceHTMLImageElement, target, | 4777 !validateTexFunc(funcName, functionType, SourceHTMLImageElement, target, |
| 4721 level, internalformat, imageForRender->width(), | 4778 level, internalformat, imageForRender->width(), |
| 4722 imageForRender->height(), 1, 0, format, type, xoffset, | 4779 imageForRender->height(), 1, 0, format, type, xoffset, |
| 4723 yoffset, zoffset)) | 4780 yoffset, zoffset)) |
| 4724 return; | 4781 return; |
| 4725 | 4782 |
| 4726 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 4783 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| 4727 zoffset, format, type, imageForRender.get(), | 4784 zoffset, format, type, imageForRender.get(), |
| 4728 WebGLImageConversion::HtmlDomImage, m_unpackFlipY, | 4785 WebGLImageConversion::HtmlDomImage, m_unpackFlipY, |
| 4729 m_unpackPremultiplyAlpha); | 4786 m_unpackPremultiplyAlpha, sourceImageRect); |
| 4730 } | 4787 } |
| 4731 | 4788 |
| 4732 void WebGLRenderingContextBase::texImage2D(GLenum target, | 4789 void WebGLRenderingContextBase::texImage2D(GLenum target, |
| 4733 GLint level, | 4790 GLint level, |
| 4734 GLint internalformat, | 4791 GLint internalformat, |
| 4735 GLenum format, | 4792 GLenum format, |
| 4736 GLenum type, | 4793 GLenum type, |
| 4737 HTMLImageElement* image, | 4794 HTMLImageElement* image, |
| 4738 ExceptionState& exceptionState) { | 4795 ExceptionState& exceptionState) { |
| 4739 texImageHelperHTMLImageElement(TexImage2D, target, level, internalformat, | 4796 texImageHelperHTMLImageElement(TexImage2D, target, level, internalformat, |
| 4740 format, type, 0, 0, 0, image, exceptionState); | 4797 format, type, 0, 0, 0, image, |
| 4798 sentinelEmptyRect(), exceptionState); | |
| 4741 } | 4799 } |
| 4742 | 4800 |
| 4743 bool WebGLRenderingContextBase::canUseTexImageByGPU( | 4801 bool WebGLRenderingContextBase::canUseTexImageByGPU( |
| 4744 TexImageFunctionID functionID, | 4802 TexImageFunctionID functionID, |
| 4745 GLint internalformat, | 4803 GLint internalformat, |
| 4746 GLenum type) { | 4804 GLenum type) { |
| 4747 if (functionID == TexImage2D && | 4805 if (functionID == TexImage2D && |
| 4748 (isFloatType(type) || isIntegerFormat(internalformat) || | 4806 (isFloatType(type) || isIntegerFormat(internalformat) || |
| 4749 isSRGBFormat(internalformat))) | 4807 isSRGBFormat(internalformat))) |
| 4750 return false; | 4808 return false; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4897 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is | 4955 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is |
| 4898 // upgraded to handle more formats. | 4956 // upgraded to handle more formats. |
| 4899 if (!canvas->renderingContext() || | 4957 if (!canvas->renderingContext() || |
| 4900 !canvas->renderingContext()->isAccelerated() || | 4958 !canvas->renderingContext()->isAccelerated() || |
| 4901 !canUseTexImageByGPU(functionID, internalformat, type)) { | 4959 !canUseTexImageByGPU(functionID, internalformat, type)) { |
| 4902 // 2D canvas has only FrontBuffer. | 4960 // 2D canvas has only FrontBuffer. |
| 4903 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 4961 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| 4904 zoffset, format, type, | 4962 zoffset, format, type, |
| 4905 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 4963 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
| 4906 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, | 4964 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, |
| 4907 m_unpackPremultiplyAlpha); | 4965 m_unpackPremultiplyAlpha, |
| 4966 IntRect(0, 0, canvas->width(), canvas->height())); | |
| 4908 return; | 4967 return; |
| 4909 } | 4968 } |
| 4910 | 4969 |
| 4911 if (functionID == TexImage2D) { | 4970 if (functionID == TexImage2D) { |
| 4912 texImage2DBase(target, level, internalformat, canvas->width(), | 4971 texImage2DBase(target, level, internalformat, canvas->width(), |
| 4913 canvas->height(), 0, format, type, 0); | 4972 canvas->height(), 0, format, type, 0); |
| 4914 texImageByGPU(TexImage2DByGPU, texture, target, level, internalformat, | 4973 texImageByGPU(TexImage2DByGPU, texture, target, level, internalformat, |
| 4915 type, 0, 0, 0, canvas); | 4974 type, 0, 0, 0, canvas); |
| 4916 } else { | 4975 } else { |
| 4917 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, type, | 4976 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, type, |
| 4918 xoffset, yoffset, 0, canvas); | 4977 xoffset, yoffset, 0, canvas); |
| 4919 } | 4978 } |
| 4920 } else { | 4979 } else { |
| 4921 DCHECK_EQ(functionID, TexSubImage3D); | 4980 DCHECK_EQ(functionID, TexSubImage3D); |
| 4922 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269). | 4981 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269). |
| 4923 texImageImpl(TexSubImage3D, target, level, 0, xoffset, yoffset, zoffset, | 4982 texImageImpl(TexSubImage3D, target, level, 0, xoffset, yoffset, zoffset, |
| 4924 format, type, | 4983 format, type, |
| 4925 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 4984 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
| 4926 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, | 4985 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, |
| 4927 m_unpackPremultiplyAlpha); | 4986 m_unpackPremultiplyAlpha, |
| 4987 IntRect(0, 0, canvas->width(), canvas->height())); | |
| 4928 } | 4988 } |
| 4929 } | 4989 } |
| 4930 | 4990 |
| 4931 void WebGLRenderingContextBase::texImage2D(GLenum target, | 4991 void WebGLRenderingContextBase::texImage2D(GLenum target, |
| 4932 GLint level, | 4992 GLint level, |
| 4933 GLint internalformat, | 4993 GLint internalformat, |
| 4934 GLenum format, | 4994 GLenum format, |
| 4935 GLenum type, | 4995 GLenum type, |
| 4936 HTMLCanvasElement* canvas, | 4996 HTMLCanvasElement* canvas, |
| 4937 ExceptionState& exceptionState) { | 4997 ExceptionState& exceptionState) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5027 } | 5087 } |
| 5028 } | 5088 } |
| 5029 } | 5089 } |
| 5030 | 5090 |
| 5031 RefPtr<Image> image = videoFrameToImage(video); | 5091 RefPtr<Image> image = videoFrameToImage(video); |
| 5032 if (!image) | 5092 if (!image) |
| 5033 return; | 5093 return; |
| 5034 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 5094 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| 5035 zoffset, format, type, image.get(), | 5095 zoffset, format, type, image.get(), |
| 5036 WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, | 5096 WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, |
| 5037 m_unpackPremultiplyAlpha); | 5097 m_unpackPremultiplyAlpha, |
| 5098 IntRect(0, 0, video->videoWidth(), video->videoHeight())); | |
| 5038 } | 5099 } |
| 5039 | 5100 |
| 5040 void WebGLRenderingContextBase::texImageBitmapByGPU(ImageBitmap* bitmap, | 5101 void WebGLRenderingContextBase::texImageBitmapByGPU(ImageBitmap* bitmap, |
| 5041 GLuint targetTexture, | 5102 GLuint targetTexture, |
| 5042 GLenum targetInternalformat, | 5103 GLenum targetInternalformat, |
| 5043 GLenum targetType, | 5104 GLenum targetType, |
| 5044 GLint targetLevel, | 5105 GLint targetLevel, |
| 5045 bool flipY) { | 5106 bool flipY) { |
| 5046 bitmap->bitmapImage()->copyToTexture(drawingBuffer()->contextProvider(), | 5107 bitmap->bitmapImage()->copyToTexture(drawingBuffer()->contextProvider(), |
| 5047 targetTexture, targetInternalformat, | 5108 targetTexture, targetInternalformat, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5278 | 5339 |
| 5279 void WebGLRenderingContextBase::texSubImage2D(GLenum target, | 5340 void WebGLRenderingContextBase::texSubImage2D(GLenum target, |
| 5280 GLint level, | 5341 GLint level, |
| 5281 GLint xoffset, | 5342 GLint xoffset, |
| 5282 GLint yoffset, | 5343 GLint yoffset, |
| 5283 GLenum format, | 5344 GLenum format, |
| 5284 GLenum type, | 5345 GLenum type, |
| 5285 HTMLImageElement* image, | 5346 HTMLImageElement* image, |
| 5286 ExceptionState& exceptionState) { | 5347 ExceptionState& exceptionState) { |
| 5287 texImageHelperHTMLImageElement(TexSubImage2D, target, level, 0, format, type, | 5348 texImageHelperHTMLImageElement(TexSubImage2D, target, level, 0, format, type, |
| 5288 xoffset, yoffset, 0, image, exceptionState); | 5349 xoffset, yoffset, 0, image, |
| 5350 sentinelEmptyRect(), exceptionState); | |
| 5289 } | 5351 } |
| 5290 | 5352 |
| 5291 void WebGLRenderingContextBase::texSubImage2D(GLenum target, | 5353 void WebGLRenderingContextBase::texSubImage2D(GLenum target, |
| 5292 GLint level, | 5354 GLint level, |
| 5293 GLint xoffset, | 5355 GLint xoffset, |
| 5294 GLint yoffset, | 5356 GLint yoffset, |
| 5295 GLenum format, | 5357 GLenum format, |
| 5296 GLenum type, | 5358 GLenum type, |
| 5297 HTMLCanvasElement* canvas, | 5359 HTMLCanvasElement* canvas, |
| 5298 ExceptionState& exceptionState) { | 5360 ExceptionState& exceptionState) { |
| (...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7547 | 7609 |
| 7548 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7610 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7549 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7611 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7550 if (canvas()) | 7612 if (canvas()) |
| 7551 result.setHTMLCanvasElement(canvas()); | 7613 result.setHTMLCanvasElement(canvas()); |
| 7552 else | 7614 else |
| 7553 result.setOffscreenCanvas(getOffscreenCanvas()); | 7615 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7554 } | 7616 } |
| 7555 | 7617 |
| 7556 } // namespace blink | 7618 } // namespace blink |
| OLD | NEW |