| 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 4385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4396 | 4396 |
| 4397 WebGLImageConversion::DataFormat sourceDataFormat = | 4397 WebGLImageConversion::DataFormat sourceDataFormat = |
| 4398 imageExtractor.imageSourceFormat(); | 4398 imageExtractor.imageSourceFormat(); |
| 4399 WebGLImageConversion::AlphaOp alphaOp = imageExtractor.imageAlphaOp(); | 4399 WebGLImageConversion::AlphaOp alphaOp = imageExtractor.imageAlphaOp(); |
| 4400 const void* imagePixelData = imageExtractor.imagePixelData(); | 4400 const void* imagePixelData = imageExtractor.imagePixelData(); |
| 4401 | 4401 |
| 4402 bool needConversion = true; | 4402 bool needConversion = true; |
| 4403 if (type == GL_UNSIGNED_BYTE && | 4403 if (type == GL_UNSIGNED_BYTE && |
| 4404 sourceDataFormat == WebGLImageConversion::DataFormatRGBA8 && | 4404 sourceDataFormat == WebGLImageConversion::DataFormatRGBA8 && |
| 4405 format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNothing && | 4405 format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNothing && |
| 4406 !flipY && !selectingSubRectangle) { | 4406 !flipY && !selectingSubRectangle && depth == 1) { |
| 4407 needConversion = false; | 4407 needConversion = false; |
| 4408 } else { | 4408 } else { |
| 4409 if (!WebGLImageConversion::packImageData( | 4409 if (!WebGLImageConversion::packImageData( |
| 4410 image, imagePixelData, format, type, flipY, alphaOp, | 4410 image, imagePixelData, format, type, flipY, alphaOp, |
| 4411 sourceDataFormat, imageExtractor.imageWidth(), | 4411 sourceDataFormat, imageExtractor.imageWidth(), |
| 4412 imageExtractor.imageHeight(), adjustedSourceImageRect, | 4412 imageExtractor.imageHeight(), adjustedSourceImageRect, depth, |
| 4413 imageExtractor.imageSourceUnpackAlignment(), data)) { | 4413 imageExtractor.imageSourceUnpackAlignment(), unpackImageHeight, |
| 4414 data)) { |
| 4414 synthesizeGLError(GL_INVALID_VALUE, funcName, "packImage error"); | 4415 synthesizeGLError(GL_INVALID_VALUE, funcName, "packImage error"); |
| 4415 return; | 4416 return; |
| 4416 } | 4417 } |
| 4417 } | 4418 } |
| 4418 | 4419 |
| 4419 resetUnpackParameters(); | 4420 resetUnpackParameters(); |
| 4420 if (functionID == TexImage2D) { | 4421 if (functionID == TexImage2D) { |
| 4421 texImage2DBase(target, level, internalformat, | 4422 texImage2DBase(target, level, internalformat, |
| 4422 adjustedSourceImageRect.width(), | 4423 adjustedSourceImageRect.width(), |
| 4423 adjustedSourceImageRect.height(), 0, format, type, | 4424 adjustedSourceImageRect.height(), 0, format, type, |
| 4424 needConversion ? data.data() : imagePixelData); | 4425 needConversion ? data.data() : imagePixelData); |
| 4425 } else if (functionID == TexSubImage2D) { | 4426 } else if (functionID == TexSubImage2D) { |
| 4426 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, | 4427 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, |
| 4427 adjustedSourceImageRect.width(), | 4428 adjustedSourceImageRect.width(), |
| 4428 adjustedSourceImageRect.height(), format, type, | 4429 adjustedSourceImageRect.height(), format, type, |
| 4429 needConversion ? data.data() : imagePixelData); | 4430 needConversion ? data.data() : imagePixelData); |
| 4430 } else { | 4431 } else { |
| 4431 // 3D functions. | 4432 // 3D functions. |
| 4432 GLint uploadHeight = adjustedSourceImageRect.height(); | |
| 4433 if (unpackImageHeight) { | |
| 4434 // GL_UNPACK_IMAGE_HEIGHT overrides the passed-in height. | |
| 4435 uploadHeight = unpackImageHeight; | |
| 4436 } | |
| 4437 if (functionID == TexImage3D) { | 4433 if (functionID == TexImage3D) { |
| 4438 contextGL()->TexImage3D(target, level, internalformat, | 4434 contextGL()->TexImage3D( |
| 4439 adjustedSourceImageRect.width(), uploadHeight, | 4435 target, level, internalformat, adjustedSourceImageRect.width(), |
| 4440 depth, 0, format, type, | 4436 adjustedSourceImageRect.height(), depth, 0, format, type, |
| 4441 needConversion ? data.data() : imagePixelData); | 4437 needConversion ? data.data() : imagePixelData); |
| 4442 } else { | 4438 } else { |
| 4443 DCHECK_EQ(functionID, TexSubImage3D); | 4439 DCHECK_EQ(functionID, TexSubImage3D); |
| 4444 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, | 4440 contextGL()->TexSubImage3D( |
| 4445 adjustedSourceImageRect.width(), uploadHeight, | 4441 target, level, xoffset, yoffset, zoffset, |
| 4446 depth, format, type, | 4442 adjustedSourceImageRect.width(), adjustedSourceImageRect.height(), |
| 4447 needConversion ? data.data() : imagePixelData); | 4443 depth, format, type, needConversion ? data.data() : imagePixelData); |
| 4448 } | 4444 } |
| 4449 } | 4445 } |
| 4450 restoreUnpackParameters(); | 4446 restoreUnpackParameters(); |
| 4451 } | 4447 } |
| 4452 | 4448 |
| 4453 bool WebGLRenderingContextBase::validateTexFunc( | 4449 bool WebGLRenderingContextBase::validateTexFunc( |
| 4454 const char* functionName, | 4450 const char* functionName, |
| 4455 TexImageFunctionType functionType, | 4451 TexImageFunctionType functionType, |
| 4456 TexFuncValidationSourceType sourceType, | 4452 TexFuncValidationSourceType sourceType, |
| 4457 GLenum target, | 4453 GLenum target, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4633 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 4629 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
| 4634 if (sourceType == Tex2D) { | 4630 if (sourceType == Tex2D) { |
| 4635 if (!WebGLImageConversion::extractTextureData( | 4631 if (!WebGLImageConversion::extractTextureData( |
| 4636 width, height, format, type, m_unpackAlignment, m_unpackFlipY, | 4632 width, height, format, type, m_unpackAlignment, m_unpackFlipY, |
| 4637 m_unpackPremultiplyAlpha, data, tempData)) | 4633 m_unpackPremultiplyAlpha, data, tempData)) |
| 4638 return; | 4634 return; |
| 4639 data = tempData.data(); | 4635 data = tempData.data(); |
| 4640 } | 4636 } |
| 4641 changeUnpackAlignment = true; | 4637 changeUnpackAlignment = true; |
| 4642 } | 4638 } |
| 4643 // FIXME: implement flipY and premultiplyAlpha for tex(Sub)3D. | 4639 // TODO(crbug.com/666064): implement flipY and premultiplyAlpha for |
| 4640 // tex(Sub)3D. |
| 4644 if (functionID == TexImage3D) { | 4641 if (functionID == TexImage3D) { |
| 4645 contextGL()->TexImage3D(target, level, | 4642 contextGL()->TexImage3D(target, level, |
| 4646 convertTexInternalFormat(internalformat, type), | 4643 convertTexInternalFormat(internalformat, type), |
| 4647 width, height, depth, border, format, type, data); | 4644 width, height, depth, border, format, type, data); |
| 4648 return; | 4645 return; |
| 4649 } | 4646 } |
| 4650 if (functionID == TexSubImage3D) { | 4647 if (functionID == TexSubImage3D) { |
| 4651 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, | 4648 contextGL()->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, |
| 4652 height, depth, format, type, data); | 4649 height, depth, format, type, data); |
| 4653 return; | 4650 return; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4727 adjustedSourceImageRect.setY(pixels->height() - | 4724 adjustedSourceImageRect.setY(pixels->height() - |
| 4728 adjustedSourceImageRect.maxY()); | 4725 adjustedSourceImageRect.maxY()); |
| 4729 } | 4726 } |
| 4730 | 4727 |
| 4731 Vector<uint8_t> data; | 4728 Vector<uint8_t> data; |
| 4732 bool needConversion = true; | 4729 bool needConversion = true; |
| 4733 // The data from ImageData is always of format RGBA8. | 4730 // The data from ImageData is always of format RGBA8. |
| 4734 // No conversion is needed if destination format is RGBA and type is | 4731 // No conversion is needed if destination format is RGBA and type is |
| 4735 // UNSIGNED_BYTE and no Flip or Premultiply operation is required. | 4732 // UNSIGNED_BYTE and no Flip or Premultiply operation is required. |
| 4736 if (!m_unpackFlipY && !m_unpackPremultiplyAlpha && format == GL_RGBA && | 4733 if (!m_unpackFlipY && !m_unpackPremultiplyAlpha && format == GL_RGBA && |
| 4737 type == GL_UNSIGNED_BYTE && !selectingSubRectangle) { | 4734 type == GL_UNSIGNED_BYTE && !selectingSubRectangle && depth == 1) { |
| 4738 needConversion = false; | 4735 needConversion = false; |
| 4739 } else { | 4736 } else { |
| 4740 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | 4737 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { |
| 4741 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | 4738 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. |
| 4742 type = GL_FLOAT; | 4739 type = GL_FLOAT; |
| 4743 } | 4740 } |
| 4744 if (!WebGLImageConversion::extractImageData( | 4741 if (!WebGLImageConversion::extractImageData( |
| 4745 pixels->data()->data(), | 4742 pixels->data()->data(), |
| 4746 WebGLImageConversion::DataFormat::DataFormatRGBA8, pixels->size(), | 4743 WebGLImageConversion::DataFormat::DataFormatRGBA8, pixels->size(), |
| 4747 adjustedSourceImageRect, format, type, m_unpackFlipY, | 4744 adjustedSourceImageRect, depth, unpackImageHeight, format, type, |
| 4748 m_unpackPremultiplyAlpha, data)) { | 4745 m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { |
| 4749 synthesizeGLError(GL_INVALID_VALUE, funcName, "bad image data"); | 4746 synthesizeGLError(GL_INVALID_VALUE, funcName, "bad image data"); |
| 4750 return; | 4747 return; |
| 4751 } | 4748 } |
| 4752 } | 4749 } |
| 4753 resetUnpackParameters(); | 4750 resetUnpackParameters(); |
| 4754 const uint8_t* bytes = needConversion ? data.data() : pixels->data()->data(); | 4751 const uint8_t* bytes = needConversion ? data.data() : pixels->data()->data(); |
| 4755 if (functionID == TexImage2D) { | 4752 if (functionID == TexImage2D) { |
| 4756 DCHECK_EQ(unpackImageHeight, 0); | 4753 DCHECK_EQ(unpackImageHeight, 0); |
| 4757 texImage2DBase( | 4754 texImage2DBase( |
| 4758 target, level, internalformat, adjustedSourceImageRect.width(), | 4755 target, level, internalformat, adjustedSourceImageRect.width(), |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5024 // Note that the sub-rectangle validation is needed for the GPU-GPU | 5021 // Note that the sub-rectangle validation is needed for the GPU-GPU |
| 5025 // copy case, but is redundant for the software upload case | 5022 // copy case, but is redundant for the software upload case |
| 5026 // (texImageImpl). | 5023 // (texImageImpl). |
| 5027 bool selectingSubRectangle = false; | 5024 bool selectingSubRectangle = false; |
| 5028 if (!validateTexImageSubRectangle( | 5025 if (!validateTexImageSubRectangle( |
| 5029 funcName, functionID, canvas, sourceSubRectangle, depth, | 5026 funcName, functionID, canvas, sourceSubRectangle, depth, |
| 5030 unpackImageHeight, &selectingSubRectangle)) { | 5027 unpackImageHeight, &selectingSubRectangle)) { |
| 5031 return; | 5028 return; |
| 5032 } | 5029 } |
| 5033 | 5030 |
| 5034 if (functionID == TexImage3D || functionID == TexSubImage3D) { | |
| 5035 DCHECK_GE(unpackImageHeight, 0); | |
| 5036 | |
| 5037 // Verify that the image data can cover the required depth. | |
| 5038 CheckedNumeric<GLint> maxDepthSupported = 1; | |
| 5039 if (unpackImageHeight) { | |
| 5040 maxDepthSupported = sourceSubRectangle.height(); | |
| 5041 maxDepthSupported /= unpackImageHeight; | |
| 5042 } | |
| 5043 | |
| 5044 if (!maxDepthSupported.IsValid() || | |
| 5045 maxDepthSupported.ValueOrDie() < depth) { | |
| 5046 synthesizeGLError( | |
| 5047 GL_INVALID_OPERATION, funcName, | |
| 5048 "Not enough data supplied to upload to a 3D texture with depth > 1"); | |
| 5049 return; | |
| 5050 } | |
| 5051 } else { | |
| 5052 DCHECK_EQ(depth, 1); | |
| 5053 DCHECK_EQ(unpackImageHeight, 0); | |
| 5054 } | |
| 5055 | |
| 5056 if (functionID == TexImage2D || functionID == TexSubImage2D) { | 5031 if (functionID == TexImage2D || functionID == TexSubImage2D) { |
| 5057 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support | 5032 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support |
| 5058 // float/integer/sRGB internal format. | 5033 // float/integer/sRGB internal format. |
| 5059 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is | 5034 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is |
| 5060 // upgraded to handle more formats. | 5035 // upgraded to handle more formats. |
| 5061 if (!canvas->renderingContext() || | 5036 if (!canvas->renderingContext() || |
| 5062 !canvas->renderingContext()->isAccelerated() || | 5037 !canvas->renderingContext()->isAccelerated() || |
| 5063 !canUseTexImageByGPU(functionID, internalformat, type)) { | 5038 !canUseTexImageByGPU(functionID, internalformat, type)) { |
| 5064 // 2D canvas has only FrontBuffer. | 5039 // 2D canvas has only FrontBuffer. |
| 5065 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 5040 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5157 if (!validateTexFunc(funcName, functionType, SourceHTMLVideoElement, target, | 5132 if (!validateTexFunc(funcName, functionType, SourceHTMLVideoElement, target, |
| 5158 level, internalformat, video->videoWidth(), | 5133 level, internalformat, video->videoWidth(), |
| 5159 video->videoHeight(), 1, 0, format, type, xoffset, | 5134 video->videoHeight(), 1, 0, format, type, xoffset, |
| 5160 yoffset, zoffset)) | 5135 yoffset, zoffset)) |
| 5161 return; | 5136 return; |
| 5162 | 5137 |
| 5163 bool sourceImageRectIsDefault = | 5138 bool sourceImageRectIsDefault = |
| 5164 sourceImageRect == sentinelEmptyRect() || | 5139 sourceImageRect == sentinelEmptyRect() || |
| 5165 sourceImageRect == | 5140 sourceImageRect == |
| 5166 IntRect(0, 0, video->videoWidth(), video->videoHeight()); | 5141 IntRect(0, 0, video->videoWidth(), video->videoHeight()); |
| 5167 if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1 && | 5142 if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1) { |
| 5168 unpackImageHeight == 0) { | |
| 5169 DCHECK_EQ(xoffset, 0); | 5143 DCHECK_EQ(xoffset, 0); |
| 5170 DCHECK_EQ(yoffset, 0); | 5144 DCHECK_EQ(yoffset, 0); |
| 5171 DCHECK_EQ(zoffset, 0); | 5145 DCHECK_EQ(zoffset, 0); |
| 5172 // Go through the fast path doing a GPU-GPU textures copy without a readback | 5146 // Go through the fast path doing a GPU-GPU textures copy without a readback |
| 5173 // to system memory if possible. Otherwise, it will fall back to the normal | 5147 // to system memory if possible. Otherwise, it will fall back to the normal |
| 5174 // SW path. | 5148 // SW path. |
| 5175 if (GL_TEXTURE_2D == target) { | 5149 if (GL_TEXTURE_2D == target) { |
| 5176 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, | 5150 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, |
| 5177 type, level) && | 5151 type, level) && |
| 5178 video->copyVideoTextureToPlatformTexture( | 5152 video->copyVideoTextureToPlatformTexture( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5290 functionType = TexSubImage; | 5264 functionType = TexSubImage; |
| 5291 | 5265 |
| 5292 GLsizei width = sourceSubRect.width(); | 5266 GLsizei width = sourceSubRect.width(); |
| 5293 GLsizei height = sourceSubRect.height(); | 5267 GLsizei height = sourceSubRect.height(); |
| 5294 if (!validateTexFunc(funcName, functionType, SourceImageBitmap, target, level, | 5268 if (!validateTexFunc(funcName, functionType, SourceImageBitmap, target, level, |
| 5295 internalformat, width, height, depth, 0, format, type, | 5269 internalformat, width, height, depth, 0, format, type, |
| 5296 xoffset, yoffset, zoffset)) | 5270 xoffset, yoffset, zoffset)) |
| 5297 return; | 5271 return; |
| 5298 ASSERT(bitmap->bitmapImage()); | 5272 ASSERT(bitmap->bitmapImage()); |
| 5299 | 5273 |
| 5274 // TODO(kbr): make this work for sub-rectangles of ImageBitmaps. |
| 5300 if (functionID != TexSubImage3D && functionID != TexImage3D && | 5275 if (functionID != TexSubImage3D && functionID != TexImage3D && |
| 5301 bitmap->isAccelerated() && | 5276 bitmap->isAccelerated() && |
| 5302 canUseTexImageByGPU(functionID, internalformat, type) && | 5277 canUseTexImageByGPU(functionID, internalformat, type) && |
| 5303 !selectingSubRectangle) { | 5278 !selectingSubRectangle) { |
| 5304 if (functionID == TexImage2D) { | 5279 if (functionID == TexImage2D) { |
| 5305 texImage2DBase(target, level, internalformat, width, height, 0, format, | 5280 texImage2DBase(target, level, internalformat, width, height, 0, format, |
| 5306 type, 0); | 5281 type, 0); |
| 5307 texImageByGPU(TexImage2DByGPU, texture, target, level, internalformat, | 5282 texImageByGPU(TexImage2DByGPU, texture, target, level, internalformat, |
| 5308 type, 0, 0, 0, bitmap, sourceSubRect); | 5283 type, 0, 0, 0, bitmap, sourceSubRect); |
| 5309 } else if (functionID == TexSubImage2D) { | 5284 } else if (functionID == TexSubImage2D) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5327 bitmap->isPremultiplied() ? PremultiplyAlpha : DontPremultiplyAlpha); | 5302 bitmap->isPremultiplied() ? PremultiplyAlpha : DontPremultiplyAlpha); |
| 5328 pixelDataPtr = pixelData->data(); | 5303 pixelDataPtr = pixelData->data(); |
| 5329 } | 5304 } |
| 5330 Vector<uint8_t> data; | 5305 Vector<uint8_t> data; |
| 5331 bool needConversion = true; | 5306 bool needConversion = true; |
| 5332 bool havePeekableRGBA = | 5307 bool havePeekableRGBA = |
| 5333 (peekSucceed && | 5308 (peekSucceed && |
| 5334 pixmap.colorType() == SkColorType::kRGBA_8888_SkColorType); | 5309 pixmap.colorType() == SkColorType::kRGBA_8888_SkColorType); |
| 5335 bool isPixelDataRGBA = (havePeekableRGBA || !peekSucceed); | 5310 bool isPixelDataRGBA = (havePeekableRGBA || !peekSucceed); |
| 5336 if (isPixelDataRGBA && format == GL_RGBA && type == GL_UNSIGNED_BYTE && | 5311 if (isPixelDataRGBA && format == GL_RGBA && type == GL_UNSIGNED_BYTE && |
| 5337 !selectingSubRectangle) { | 5312 !selectingSubRectangle && depth == 1) { |
| 5338 needConversion = false; | 5313 needConversion = false; |
| 5339 } else { | 5314 } else { |
| 5340 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | 5315 if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { |
| 5341 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | 5316 // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. |
| 5342 type = GL_FLOAT; | 5317 type = GL_FLOAT; |
| 5343 } | 5318 } |
| 5344 // In the case of ImageBitmap, we do not need to apply flipY or | 5319 // In the case of ImageBitmap, we do not need to apply flipY or |
| 5345 // premultiplyAlpha. | 5320 // premultiplyAlpha. |
| 5346 bool isPixelDataBGRA = | 5321 bool isPixelDataBGRA = |
| 5347 pixmap.colorType() == SkColorType::kBGRA_8888_SkColorType; | 5322 pixmap.colorType() == SkColorType::kBGRA_8888_SkColorType; |
| 5348 if ((isPixelDataBGRA && | 5323 if ((isPixelDataBGRA && |
| 5349 !WebGLImageConversion::extractImageData( | 5324 !WebGLImageConversion::extractImageData( |
| 5350 pixelDataPtr, WebGLImageConversion::DataFormat::DataFormatBGRA8, | 5325 pixelDataPtr, WebGLImageConversion::DataFormat::DataFormatBGRA8, |
| 5351 bitmap->size(), sourceSubRect, format, type, false, false, | 5326 bitmap->size(), sourceSubRect, depth, unpackImageHeight, format, |
| 5352 data)) || | 5327 type, false, false, data)) || |
| 5353 (isPixelDataRGBA && | 5328 (isPixelDataRGBA && |
| 5354 !WebGLImageConversion::extractImageData( | 5329 !WebGLImageConversion::extractImageData( |
| 5355 pixelDataPtr, WebGLImageConversion::DataFormat::DataFormatRGBA8, | 5330 pixelDataPtr, WebGLImageConversion::DataFormat::DataFormatRGBA8, |
| 5356 bitmap->size(), sourceSubRect, format, type, false, false, | 5331 bitmap->size(), sourceSubRect, depth, unpackImageHeight, format, |
| 5357 data))) { | 5332 type, false, false, data))) { |
| 5358 synthesizeGLError(GL_INVALID_VALUE, funcName, "bad image data"); | 5333 synthesizeGLError(GL_INVALID_VALUE, funcName, "bad image data"); |
| 5359 return; | 5334 return; |
| 5360 } | 5335 } |
| 5361 } | 5336 } |
| 5362 resetUnpackParameters(); | 5337 resetUnpackParameters(); |
| 5363 if (functionID == TexImage2D) { | 5338 if (functionID == TexImage2D) { |
| 5364 texImage2DBase(target, level, internalformat, width, height, 0, format, | 5339 texImage2DBase(target, level, internalformat, width, height, 0, format, |
| 5365 type, needConversion ? data.data() : pixelDataPtr); | 5340 type, needConversion ? data.data() : pixelDataPtr); |
| 5366 } else if (functionID == TexSubImage2D) { | 5341 } else if (functionID == TexSubImage2D) { |
| 5367 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, | 5342 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, |
| (...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7789 | 7764 |
| 7790 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7765 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7791 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7766 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7792 if (canvas()) | 7767 if (canvas()) |
| 7793 result.setHTMLCanvasElement(canvas()); | 7768 result.setHTMLCanvasElement(canvas()); |
| 7794 else | 7769 else |
| 7795 result.setOffscreenCanvas(getOffscreenCanvas()); | 7770 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7796 } | 7771 } |
| 7797 | 7772 |
| 7798 } // namespace blink | 7773 } // namespace blink |
| OLD | NEW |