| 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 4844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4855 // TODO(crbug.com/622958): Implement GPU-to-GPU path for WebGL 2 and more | 4855 // TODO(crbug.com/622958): Implement GPU-to-GPU path for WebGL 2 and more |
| 4856 // internal formats. | 4856 // internal formats. |
| 4857 if (functionID == TexSubImage2D && | 4857 if (functionID == TexSubImage2D && |
| 4858 (isWebGL2OrHigher() || extensionEnabled(OESTextureFloatName) || | 4858 (isWebGL2OrHigher() || extensionEnabled(OESTextureFloatName) || |
| 4859 extensionEnabled(OESTextureHalfFloatName) || | 4859 extensionEnabled(OESTextureHalfFloatName) || |
| 4860 extensionEnabled(EXTsRGBName))) | 4860 extensionEnabled(EXTsRGBName))) |
| 4861 return false; | 4861 return false; |
| 4862 return true; | 4862 return true; |
| 4863 } | 4863 } |
| 4864 | 4864 |
| 4865 SnapshotReason WebGLRenderingContextBase::functionIDToSnapshotReason( |
| 4866 TexImageFunctionID id) { |
| 4867 switch (id) { |
| 4868 case TexImage2D: |
| 4869 return SnapshotReasonWebGLTexImage2D; |
| 4870 case TexSubImage2D: |
| 4871 return SnapshotReasonWebGLTexSubImage2D; |
| 4872 case TexImage3D: |
| 4873 return SnapshotReasonWebGLTexImage3D; |
| 4874 case TexSubImage3D: |
| 4875 return SnapshotReasonWebGLTexSubImage3D; |
| 4876 } |
| 4877 NOTREACHED(); |
| 4878 return SnapshotReasonUnknown; |
| 4879 } |
| 4880 |
| 4865 void WebGLRenderingContextBase::texImageCanvasByGPU( | 4881 void WebGLRenderingContextBase::texImageCanvasByGPU( |
| 4882 TexImageFunctionID functionID, |
| 4866 HTMLCanvasElement* canvas, | 4883 HTMLCanvasElement* canvas, |
| 4867 GLuint targetTexture, | 4884 GLuint targetTexture, |
| 4868 GLenum targetInternalformat, | 4885 GLenum targetInternalformat, |
| 4869 GLenum targetType, | 4886 GLenum targetType, |
| 4870 GLint targetLevel, | 4887 GLint targetLevel, |
| 4871 GLint xoffset, | 4888 GLint xoffset, |
| 4872 GLint yoffset, | 4889 GLint yoffset, |
| 4873 const IntRect& sourceSubRectangle) { | 4890 const IntRect& sourceSubRectangle) { |
| 4874 if (!canvas->is3D()) { | 4891 if (!canvas->is3D()) { |
| 4875 ImageBuffer* buffer = canvas->buffer(); | 4892 ImageBuffer* buffer = canvas->buffer(); |
| 4876 if (buffer && | 4893 if (buffer && |
| 4877 !buffer->copyToPlatformTexture( | 4894 !buffer->copyToPlatformTexture( |
| 4878 contextGL(), targetTexture, targetInternalformat, targetType, | 4895 functionIDToSnapshotReason(functionID), contextGL(), targetTexture, |
| 4879 targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY, | 4896 targetInternalformat, targetType, targetLevel, |
| 4880 IntPoint(xoffset, yoffset), sourceSubRectangle)) { | 4897 m_unpackPremultiplyAlpha, m_unpackFlipY, IntPoint(xoffset, yoffset), |
| 4898 sourceSubRectangle)) { |
| 4881 NOTREACHED(); | 4899 NOTREACHED(); |
| 4882 } | 4900 } |
| 4883 } else { | 4901 } else { |
| 4884 WebGLRenderingContextBase* gl = | 4902 WebGLRenderingContextBase* gl = |
| 4885 toWebGLRenderingContextBase(canvas->renderingContext()); | 4903 toWebGLRenderingContextBase(canvas->renderingContext()); |
| 4886 ScopedTexture2DRestorer restorer(gl); | 4904 ScopedTexture2DRestorer restorer(gl); |
| 4887 if (!gl->drawingBuffer()->copyToPlatformTexture( | 4905 if (!gl->drawingBuffer()->copyToPlatformTexture( |
| 4888 contextGL(), targetTexture, targetInternalformat, targetType, | 4906 contextGL(), targetTexture, targetInternalformat, targetType, |
| 4889 targetLevel, m_unpackPremultiplyAlpha, !m_unpackFlipY, | 4907 targetLevel, m_unpackPremultiplyAlpha, !m_unpackFlipY, |
| 4890 IntPoint(xoffset, yoffset), sourceSubRectangle, BackBuffer)) { | 4908 IntPoint(xoffset, yoffset), sourceSubRectangle, BackBuffer)) { |
| 4891 NOTREACHED(); | 4909 NOTREACHED(); |
| 4892 } | 4910 } |
| 4893 } | 4911 } |
| 4894 } | 4912 } |
| 4895 | 4913 |
| 4896 void WebGLRenderingContextBase::texImageByGPU( | 4914 void WebGLRenderingContextBase::texImageByGPU( |
| 4897 TexImageByGPUType functionType, | 4915 TexImageFunctionID functionID, |
| 4898 WebGLTexture* texture, | 4916 WebGLTexture* texture, |
| 4899 GLenum target, | 4917 GLenum target, |
| 4900 GLint level, | 4918 GLint level, |
| 4901 GLint internalformat, | 4919 GLint internalformat, |
| 4902 GLenum type, | 4920 GLenum type, |
| 4903 GLint xoffset, | 4921 GLint xoffset, |
| 4904 GLint yoffset, | 4922 GLint yoffset, |
| 4905 GLint zoffset, | 4923 GLint zoffset, |
| 4906 CanvasImageSource* image, | 4924 CanvasImageSource* image, |
| 4907 const IntRect& sourceSubRectangle) { | 4925 const IntRect& sourceSubRectangle) { |
| 4908 DCHECK(image->isCanvasElement() || image->isImageBitmap()); | 4926 DCHECK(image->isCanvasElement() || image->isImageBitmap()); |
| 4909 int width = sourceSubRectangle.width(); | 4927 int width = sourceSubRectangle.width(); |
| 4910 int height = sourceSubRectangle.height(); | 4928 int height = sourceSubRectangle.height(); |
| 4911 | 4929 |
| 4912 ScopedTexture2DRestorer restorer(this); | 4930 ScopedTexture2DRestorer restorer(this); |
| 4913 | 4931 |
| 4914 GLuint targetTexture = texture->object(); | 4932 GLuint targetTexture = texture->object(); |
| 4915 GLenum targetType = type; | 4933 GLenum targetType = type; |
| 4916 GLenum targetInternalformat = internalformat; | 4934 GLenum targetInternalformat = internalformat; |
| 4917 GLint targetLevel = level; | 4935 GLint targetLevel = level; |
| 4918 bool possibleDirectCopy = false; | 4936 bool possibleDirectCopy = false; |
| 4919 if (functionType == TexImage2DByGPU) { | 4937 if (functionID == TexImage2D) { |
| 4920 possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM( | 4938 possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM( |
| 4921 target, internalformat, type, level); | 4939 target, internalformat, type, level); |
| 4922 } | 4940 } |
| 4923 | 4941 |
| 4924 GLint copyXOffset = xoffset; | 4942 GLint copyXOffset = xoffset; |
| 4925 GLint copyYOffset = yoffset; | 4943 GLint copyYOffset = yoffset; |
| 4926 | 4944 |
| 4927 // if direct copy is not possible, create a temporary texture and then copy | 4945 // if direct copy is not possible, create a temporary texture and then copy |
| 4928 // from canvas to temporary texture to target texture. | 4946 // from canvas to temporary texture to target texture. |
| 4929 if (!possibleDirectCopy) { | 4947 if (!possibleDirectCopy) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4940 GL_CLAMP_TO_EDGE); | 4958 GL_CLAMP_TO_EDGE); |
| 4941 contextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, | 4959 contextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, |
| 4942 GL_CLAMP_TO_EDGE); | 4960 GL_CLAMP_TO_EDGE); |
| 4943 contextGL()->TexImage2D(GL_TEXTURE_2D, 0, targetInternalformat, width, | 4961 contextGL()->TexImage2D(GL_TEXTURE_2D, 0, targetInternalformat, width, |
| 4944 height, 0, GL_RGBA, targetType, 0); | 4962 height, 0, GL_RGBA, targetType, 0); |
| 4945 copyXOffset = 0; | 4963 copyXOffset = 0; |
| 4946 copyYOffset = 0; | 4964 copyYOffset = 0; |
| 4947 } | 4965 } |
| 4948 | 4966 |
| 4949 if (image->isCanvasElement()) { | 4967 if (image->isCanvasElement()) { |
| 4950 texImageCanvasByGPU(static_cast<HTMLCanvasElement*>(image), targetTexture, | 4968 texImageCanvasByGPU(functionID, static_cast<HTMLCanvasElement*>(image), |
| 4951 targetInternalformat, targetType, targetLevel, | 4969 targetTexture, targetInternalformat, targetType, |
| 4952 copyXOffset, copyYOffset, sourceSubRectangle); | 4970 targetLevel, copyXOffset, copyYOffset, |
| 4971 sourceSubRectangle); |
| 4953 } else { | 4972 } else { |
| 4954 texImageBitmapByGPU(static_cast<ImageBitmap*>(image), targetTexture, | 4973 texImageBitmapByGPU(static_cast<ImageBitmap*>(image), targetTexture, |
| 4955 targetInternalformat, targetType, targetLevel, | 4974 targetInternalformat, targetType, targetLevel, |
| 4956 !m_unpackFlipY); | 4975 !m_unpackFlipY); |
| 4957 } | 4976 } |
| 4958 | 4977 |
| 4959 if (!possibleDirectCopy) { | 4978 if (!possibleDirectCopy) { |
| 4960 GLuint tmpFBO; | 4979 GLuint tmpFBO; |
| 4961 contextGL()->GenFramebuffers(1, &tmpFBO); | 4980 contextGL()->GenFramebuffers(1, &tmpFBO); |
| 4962 contextGL()->BindFramebuffer(GL_FRAMEBUFFER, tmpFBO); | 4981 contextGL()->BindFramebuffer(GL_FRAMEBUFFER, tmpFBO); |
| 4963 contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 4982 contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 4964 GL_TEXTURE_2D, targetTexture, 0); | 4983 GL_TEXTURE_2D, targetTexture, 0); |
| 4965 contextGL()->BindTexture(texture->getTarget(), texture->object()); | 4984 contextGL()->BindTexture(texture->getTarget(), texture->object()); |
| 4966 if (functionType == TexImage2DByGPU) { | 4985 if (functionID == TexImage2D) { |
| 4967 contextGL()->CopyTexSubImage2D(target, level, 0, 0, 0, 0, width, height); | 4986 contextGL()->CopyTexSubImage2D(target, level, 0, 0, 0, 0, width, height); |
| 4968 } else if (functionType == TexSubImage2DByGPU) { | 4987 } else if (functionID == TexSubImage2D) { |
| 4969 contextGL()->CopyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, | 4988 contextGL()->CopyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, |
| 4970 width, height); | 4989 width, height); |
| 4971 } else if (functionType == TexSubImage3DByGPU) { | 4990 } else if (functionID == TexSubImage3D) { |
| 4972 contextGL()->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, | 4991 contextGL()->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, |
| 4973 0, 0, width, height); | 4992 0, 0, width, height); |
| 4974 } | 4993 } |
| 4975 contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 4994 contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 4976 GL_TEXTURE_2D, 0, 0); | 4995 GL_TEXTURE_2D, 0, 0); |
| 4977 restoreCurrentFramebuffer(); | 4996 restoreCurrentFramebuffer(); |
| 4978 contextGL()->DeleteFramebuffers(1, &tmpFBO); | 4997 contextGL()->DeleteFramebuffers(1, &tmpFBO); |
| 4979 contextGL()->DeleteTextures(1, &targetTexture); | 4998 contextGL()->DeleteTextures(1, &targetTexture); |
| 4980 } | 4999 } |
| 4981 } | 5000 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5027 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support | 5046 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support |
| 5028 // float/integer/sRGB internal format. | 5047 // float/integer/sRGB internal format. |
| 5029 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is | 5048 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is |
| 5030 // upgraded to handle more formats. | 5049 // upgraded to handle more formats. |
| 5031 if (!canvas->renderingContext() || | 5050 if (!canvas->renderingContext() || |
| 5032 !canvas->renderingContext()->isAccelerated() || | 5051 !canvas->renderingContext()->isAccelerated() || |
| 5033 !canUseTexImageByGPU(functionID, internalformat, type)) { | 5052 !canUseTexImageByGPU(functionID, internalformat, type)) { |
| 5034 // 2D canvas has only FrontBuffer. | 5053 // 2D canvas has only FrontBuffer. |
| 5035 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 5054 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| 5036 zoffset, format, type, | 5055 zoffset, format, type, |
| 5037 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 5056 canvas |
| 5057 ->copiedImage(FrontBuffer, PreferAcceleration, |
| 5058 functionIDToSnapshotReason(functionID)) |
| 5059 .get(), |
| 5038 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, | 5060 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, |
| 5039 m_unpackPremultiplyAlpha, sourceSubRectangle, 1, 0); | 5061 m_unpackPremultiplyAlpha, sourceSubRectangle, 1, 0); |
| 5040 return; | 5062 return; |
| 5041 } | 5063 } |
| 5042 | 5064 |
| 5043 // The GPU-GPU copy path uses the Y-up coordinate system. | 5065 // The GPU-GPU copy path uses the Y-up coordinate system. |
| 5044 IntRect adjustedSourceSubRectangle = sourceSubRectangle; | 5066 IntRect adjustedSourceSubRectangle = sourceSubRectangle; |
| 5045 if (!m_unpackFlipY) { | 5067 if (!m_unpackFlipY) { |
| 5046 adjustedSourceSubRectangle.setY(canvas->height() - | 5068 adjustedSourceSubRectangle.setY(canvas->height() - |
| 5047 adjustedSourceSubRectangle.maxY()); | 5069 adjustedSourceSubRectangle.maxY()); |
| 5048 } | 5070 } |
| 5049 | 5071 |
| 5050 if (functionID == TexImage2D) { | 5072 if (functionID == TexImage2D) { |
| 5051 texImage2DBase(target, level, internalformat, sourceSubRectangle.width(), | 5073 texImage2DBase(target, level, internalformat, sourceSubRectangle.width(), |
| 5052 sourceSubRectangle.height(), 0, format, type, 0); | 5074 sourceSubRectangle.height(), 0, format, type, 0); |
| 5053 texImageByGPU(TexImage2DByGPU, texture, target, level, internalformat, | 5075 texImageByGPU(functionID, texture, target, level, internalformat, type, 0, |
| 5054 type, 0, 0, 0, canvas, adjustedSourceSubRectangle); | 5076 0, 0, canvas, adjustedSourceSubRectangle); |
| 5055 } else { | 5077 } else { |
| 5056 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, type, | 5078 texImageByGPU(functionID, texture, target, level, GL_RGBA, type, xoffset, |
| 5057 xoffset, yoffset, 0, canvas, adjustedSourceSubRectangle); | 5079 yoffset, 0, canvas, adjustedSourceSubRectangle); |
| 5058 } | 5080 } |
| 5059 } else { | 5081 } else { |
| 5060 // 3D functions. | 5082 // 3D functions. |
| 5061 | 5083 |
| 5062 // TODO(zmo): Implement GPU-to-GPU copy path (crbug.com/612542). | 5084 // TODO(zmo): Implement GPU-to-GPU copy path (crbug.com/612542). |
| 5063 // Note that code will also be needed to copy to layers of 3D | 5085 // Note that code will also be needed to copy to layers of 3D |
| 5064 // textures, and elements of 2D texture arrays. | 5086 // textures, and elements of 2D texture arrays. |
| 5065 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 5087 texImageImpl( |
| 5066 zoffset, format, type, | 5088 functionID, target, level, internalformat, xoffset, yoffset, zoffset, |
| 5067 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 5089 format, type, canvas |
| 5068 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, | 5090 ->copiedImage(FrontBuffer, PreferAcceleration, |
| 5069 m_unpackPremultiplyAlpha, sourceSubRectangle, depth, | 5091 functionIDToSnapshotReason(functionID)) |
| 5070 unpackImageHeight); | 5092 .get(), |
| 5093 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, |
| 5094 m_unpackPremultiplyAlpha, sourceSubRectangle, depth, unpackImageHeight); |
| 5071 } | 5095 } |
| 5072 } | 5096 } |
| 5073 | 5097 |
| 5074 void WebGLRenderingContextBase::texImage2D(GLenum target, | 5098 void WebGLRenderingContextBase::texImage2D(GLenum target, |
| 5075 GLint level, | 5099 GLint level, |
| 5076 GLint internalformat, | 5100 GLint internalformat, |
| 5077 GLenum format, | 5101 GLenum format, |
| 5078 GLenum type, | 5102 GLenum type, |
| 5079 HTMLCanvasElement* canvas, | 5103 HTMLCanvasElement* canvas, |
| 5080 ExceptionState& exceptionState) { | 5104 ExceptionState& exceptionState) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5168 | 5192 |
| 5169 // This is a straight GPU-GPU copy, any necessary color space conversion | 5193 // This is a straight GPU-GPU copy, any necessary color space conversion |
| 5170 // was handled in the paintCurrentFrameInContext() call. | 5194 // was handled in the paintCurrentFrameInContext() call. |
| 5171 | 5195 |
| 5172 // Note that copyToPlatformTexture no longer allocates the destination | 5196 // Note that copyToPlatformTexture no longer allocates the destination |
| 5173 // texture. | 5197 // texture. |
| 5174 texImage2DBase(target, level, internalformat, video->videoWidth(), | 5198 texImage2DBase(target, level, internalformat, video->videoWidth(), |
| 5175 video->videoHeight(), 0, format, type, nullptr); | 5199 video->videoHeight(), 0, format, type, nullptr); |
| 5176 | 5200 |
| 5177 if (imageBuffer->copyToPlatformTexture( | 5201 if (imageBuffer->copyToPlatformTexture( |
| 5178 contextGL(), texture->object(), internalformat, type, level, | 5202 functionIDToSnapshotReason(functionID), contextGL(), |
| 5203 texture->object(), internalformat, type, level, |
| 5179 m_unpackPremultiplyAlpha, m_unpackFlipY, IntPoint(0, 0), | 5204 m_unpackPremultiplyAlpha, m_unpackFlipY, IntPoint(0, 0), |
| 5180 IntRect(0, 0, video->videoWidth(), video->videoHeight()))) { | 5205 IntRect(0, 0, video->videoWidth(), video->videoHeight()))) { |
| 5181 return; | 5206 return; |
| 5182 } | 5207 } |
| 5183 } | 5208 } |
| 5184 } | 5209 } |
| 5185 } | 5210 } |
| 5186 | 5211 |
| 5187 if (sourceImageRectIsDefault) { | 5212 if (sourceImageRectIsDefault) { |
| 5188 // Try using optimized CPU-GPU path for some formats: e.g. Y16 and Y8. It | 5213 // Try using optimized CPU-GPU path for some formats: e.g. Y16 and Y8. It |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5277 ASSERT(bitmap->bitmapImage()); | 5302 ASSERT(bitmap->bitmapImage()); |
| 5278 | 5303 |
| 5279 // TODO(kbr): make this work for sub-rectangles of ImageBitmaps. | 5304 // TODO(kbr): make this work for sub-rectangles of ImageBitmaps. |
| 5280 if (functionID != TexSubImage3D && functionID != TexImage3D && | 5305 if (functionID != TexSubImage3D && functionID != TexImage3D && |
| 5281 bitmap->isAccelerated() && | 5306 bitmap->isAccelerated() && |
| 5282 canUseTexImageByGPU(functionID, internalformat, type) && | 5307 canUseTexImageByGPU(functionID, internalformat, type) && |
| 5283 !selectingSubRectangle) { | 5308 !selectingSubRectangle) { |
| 5284 if (functionID == TexImage2D) { | 5309 if (functionID == TexImage2D) { |
| 5285 texImage2DBase(target, level, internalformat, width, height, 0, format, | 5310 texImage2DBase(target, level, internalformat, width, height, 0, format, |
| 5286 type, 0); | 5311 type, 0); |
| 5287 texImageByGPU(TexImage2DByGPU, texture, target, level, internalformat, | 5312 texImageByGPU(functionID, texture, target, level, internalformat, type, 0, |
| 5288 type, 0, 0, 0, bitmap, sourceSubRect); | 5313 0, 0, bitmap, sourceSubRect); |
| 5289 } else if (functionID == TexSubImage2D) { | 5314 } else if (functionID == TexSubImage2D) { |
| 5290 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, type, | 5315 texImageByGPU(functionID, texture, target, level, GL_RGBA, type, xoffset, |
| 5291 xoffset, yoffset, 0, bitmap, sourceSubRect); | 5316 yoffset, 0, bitmap, sourceSubRect); |
| 5292 } | 5317 } |
| 5293 return; | 5318 return; |
| 5294 } | 5319 } |
| 5295 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); | 5320 sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); |
| 5296 SkPixmap pixmap; | 5321 SkPixmap pixmap; |
| 5297 uint8_t* pixelDataPtr = nullptr; | 5322 uint8_t* pixelDataPtr = nullptr; |
| 5298 RefPtr<Uint8Array> pixelData; | 5323 RefPtr<Uint8Array> pixelData; |
| 5299 // In the case where an ImageBitmap is not texture backed, peekPixels() always | 5324 // In the case where an ImageBitmap is not texture backed, peekPixels() always |
| 5300 // succeed. However, when it is texture backed and !canUseTexImageByGPU, we | 5325 // succeed. However, when it is texture backed and !canUseTexImageByGPU, we |
| 5301 // do a GPU read back. | 5326 // do a GPU read back. |
| (...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7743 | 7768 |
| 7744 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7769 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7745 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7770 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7746 if (canvas()) | 7771 if (canvas()) |
| 7747 result.setHTMLCanvasElement(canvas()); | 7772 result.setHTMLCanvasElement(canvas()); |
| 7748 else | 7773 else |
| 7749 result.setOffscreenCanvas(getOffscreenCanvas()); | 7774 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7750 } | 7775 } |
| 7751 | 7776 |
| 7752 } // namespace blink | 7777 } // namespace blink |
| OLD | NEW |