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 4358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4369 functionType = TexImage; | 4369 functionType = TexImage; |
4370 else | 4370 else |
4371 functionType = TexSubImage; | 4371 functionType = TexSubImage; |
4372 if (!validateTexFunc(funcName, functionType, SourceHTMLCanvasElement, target
, level, internalformat, canvas->width(), canvas->height(), 1, 0, format, type,
xoffset, yoffset, zoffset)) | 4372 if (!validateTexFunc(funcName, functionType, SourceHTMLCanvasElement, target
, level, internalformat, canvas->width(), canvas->height(), 1, 0, format, type,
xoffset, yoffset, zoffset)) |
4373 return; | 4373 return; |
4374 if (functionID == TexImage2D || functionID == TexSubImage2D) { | 4374 if (functionID == TexImage2D || functionID == TexSubImage2D) { |
4375 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support flo
at/integer/sRGB internal format. | 4375 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support flo
at/integer/sRGB internal format. |
4376 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM i
s upgraded to handle more formats. | 4376 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM i
s upgraded to handle more formats. |
4377 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccele
rated() || !canUseTexImageByGPU(functionID, internalformat, type)) { | 4377 if (!canvas->renderingContext() || !canvas->renderingContext()->isAccele
rated() || !canUseTexImageByGPU(functionID, internalformat, type)) { |
4378 // 2D canvas has only FrontBuffer. | 4378 // 2D canvas has only FrontBuffer. |
4379 texImageImpl(functionID, target, level, internalformat, xoffset, yof
fset, zoffset, format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration
).get(), | 4379 texImageImpl(functionID, target, level, internalformat, xoffset, yof
fset, zoffset, format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration
), |
4380 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPrem
ultiplyAlpha); | 4380 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPrem
ultiplyAlpha); |
4381 return; | 4381 return; |
4382 } | 4382 } |
4383 | 4383 |
4384 if (functionID == TexImage2D) { | 4384 if (functionID == TexImage2D) { |
4385 texImage2DBase(target, level, internalformat, canvas->width(), canva
s->height(), 0, format, type, 0); | 4385 texImage2DBase(target, level, internalformat, canvas->width(), canva
s->height(), 0, format, type, 0); |
4386 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma
t, type, 0, 0, 0, canvas); | 4386 texImageByGPU(TexImage2DByGPU, texture, target, level, internalforma
t, type, 0, 0, 0, canvas); |
4387 } else { | 4387 } else { |
4388 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t
ype, xoffset, yoffset, 0, canvas); | 4388 texImageByGPU(TexSubImage2DByGPU, texture, target, level, GL_RGBA, t
ype, xoffset, yoffset, 0, canvas); |
4389 } | 4389 } |
4390 } else { | 4390 } else { |
4391 DCHECK_EQ(functionID, TexSubImage3D); | 4391 DCHECK_EQ(functionID, TexSubImage3D); |
4392 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269). | 4392 // FIXME: Implement GPU-to-GPU copy path (crbug.com/586269). |
4393 texImageImpl(TexSubImage3D, target, level, 0, xoffset, yoffset, zoffset,
format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 4393 texImageImpl(TexSubImage3D, target, level, 0, xoffset, yoffset, zoffset,
format, type, canvas->copiedImage(FrontBuffer, PreferAcceleration), |
4394 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti
plyAlpha); | 4394 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremulti
plyAlpha); |
4395 } | 4395 } |
4396 } | 4396 } |
4397 | 4397 |
4398 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int
ernalformat, | 4398 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int
ernalformat, |
4399 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep
tionState) | 4399 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep
tionState) |
4400 { | 4400 { |
4401 texImageHelperHTMLCanvasElement(TexImage2D, target, level, internalformat, f
ormat, type, 0, 0, 0, canvas, exceptionState); | 4401 texImageHelperHTMLCanvasElement(TexImage2D, target, level, internalformat, f
ormat, type, 0, 0, 0, canvas, exceptionState); |
4402 } | 4402 } |
4403 | 4403 |
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6471 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6471 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
6472 } | 6472 } |
6473 | 6473 |
6474 void WebGLRenderingContextBase::restoreUnpackParameters() | 6474 void WebGLRenderingContextBase::restoreUnpackParameters() |
6475 { | 6475 { |
6476 if (m_unpackAlignment != 1) | 6476 if (m_unpackAlignment != 1) |
6477 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6477 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
6478 } | 6478 } |
6479 | 6479 |
6480 } // namespace blink | 6480 } // namespace blink |
OLD | NEW |