| 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 5040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5051 } else { | 5051 } else { |
| 5052 DCHECK_EQ(depth, 1); | 5052 DCHECK_EQ(depth, 1); |
| 5053 DCHECK_EQ(unpackImageHeight, 0); | 5053 DCHECK_EQ(unpackImageHeight, 0); |
| 5054 } | 5054 } |
| 5055 | 5055 |
| 5056 if (functionID == TexImage2D || functionID == TexSubImage2D) { | 5056 if (functionID == TexImage2D || functionID == TexSubImage2D) { |
| 5057 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support | 5057 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support |
| 5058 // float/integer/sRGB internal format. | 5058 // float/integer/sRGB internal format. |
| 5059 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is | 5059 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is |
| 5060 // upgraded to handle more formats. | 5060 // upgraded to handle more formats. |
| 5061 if (!canvas->renderingContext() || | 5061 bool forceSoftwareReadbackFrom2DCanvas = |
| 5062 !canvas->renderingContext()->isAccelerated() || | 5062 this->canvas() && this->canvas()->document().settings() && |
| 5063 !canUseTexImageByGPU(functionID, internalformat, type)) { | 5063 this->canvas() |
| 5064 ->document() |
| 5065 .settings() |
| 5066 ->forceSoftwareReadbackFrom2DCanvas(); |
| 5067 CanvasRenderingContext* sourceContext = canvas->renderingContext(); |
| 5068 if (!sourceContext || !sourceContext->isAccelerated() || |
| 5069 !canUseTexImageByGPU(functionID, internalformat, type) || |
| 5070 (forceSoftwareReadbackFrom2DCanvas && sourceContext->is2d())) { |
| 5064 // 2D canvas has only FrontBuffer. | 5071 // 2D canvas has only FrontBuffer. |
| 5065 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 5072 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| 5066 zoffset, format, type, | 5073 zoffset, format, type, |
| 5067 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 5074 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
| 5068 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, | 5075 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, |
| 5069 m_unpackPremultiplyAlpha, sourceSubRectangle, 1, 0); | 5076 m_unpackPremultiplyAlpha, sourceSubRectangle, 1, 0); |
| 5070 return; | 5077 return; |
| 5071 } | 5078 } |
| 5072 | 5079 |
| 5073 // The GPU-GPU copy path uses the Y-up coordinate system. | 5080 // The GPU-GPU copy path uses the Y-up coordinate system. |
| (...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7789 | 7796 |
| 7790 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7797 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7791 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7798 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7792 if (canvas()) | 7799 if (canvas()) |
| 7793 result.setHTMLCanvasElement(canvas()); | 7800 result.setHTMLCanvasElement(canvas()); |
| 7794 else | 7801 else |
| 7795 result.setOffscreenCanvas(getOffscreenCanvas()); | 7802 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7796 } | 7803 } |
| 7797 | 7804 |
| 7798 } // namespace blink | 7805 } // namespace blink |
| OLD | NEW |