| 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 5015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5026 funcName, functionID, canvas, sourceSubRectangle, depth, | 5026 funcName, functionID, canvas, sourceSubRectangle, depth, |
| 5027 unpackImageHeight, &selectingSubRectangle)) { | 5027 unpackImageHeight, &selectingSubRectangle)) { |
| 5028 return; | 5028 return; |
| 5029 } | 5029 } |
| 5030 | 5030 |
| 5031 if (functionID == TexImage2D || functionID == TexSubImage2D) { | 5031 if (functionID == TexImage2D || functionID == TexSubImage2D) { |
| 5032 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support | 5032 // texImageByGPU relies on copyTextureCHROMIUM which doesn't support |
| 5033 // float/integer/sRGB internal format. | 5033 // float/integer/sRGB internal format. |
| 5034 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is | 5034 // TODO(crbug.com/622958): relax the constrains if copyTextureCHROMIUM is |
| 5035 // upgraded to handle more formats. | 5035 // upgraded to handle more formats. |
| 5036 bool forceSoftwareReadbackFrom2DCanvas = | 5036 if (!canvas->renderingContext() || |
| 5037 this->canvas() && this->canvas()->document().settings() && | 5037 !canvas->renderingContext()->isAccelerated() || |
| 5038 this->canvas() | 5038 !canUseTexImageByGPU(functionID, internalformat, type)) { |
| 5039 ->document() | |
| 5040 .settings() | |
| 5041 ->forceSoftwareReadbackFrom2DCanvas(); | |
| 5042 CanvasRenderingContext* sourceContext = canvas->renderingContext(); | |
| 5043 if (!sourceContext || !sourceContext->isAccelerated() || | |
| 5044 !canUseTexImageByGPU(functionID, internalformat, type) || | |
| 5045 (forceSoftwareReadbackFrom2DCanvas && sourceContext->is2d())) { | |
| 5046 // 2D canvas has only FrontBuffer. | 5039 // 2D canvas has only FrontBuffer. |
| 5047 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, | 5040 texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, |
| 5048 zoffset, format, type, | 5041 zoffset, format, type, |
| 5049 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), | 5042 canvas->copiedImage(FrontBuffer, PreferAcceleration).get(), |
| 5050 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, | 5043 WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, |
| 5051 m_unpackPremultiplyAlpha, sourceSubRectangle, 1, 0); | 5044 m_unpackPremultiplyAlpha, sourceSubRectangle, 1, 0); |
| 5052 return; | 5045 return; |
| 5053 } | 5046 } |
| 5054 | 5047 |
| 5055 // The GPU-GPU copy path uses the Y-up coordinate system. | 5048 // The GPU-GPU copy path uses the Y-up coordinate system. |
| (...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7771 | 7764 |
| 7772 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7765 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7773 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7766 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7774 if (canvas()) | 7767 if (canvas()) |
| 7775 result.setHTMLCanvasElement(canvas()); | 7768 result.setHTMLCanvasElement(canvas()); |
| 7776 else | 7769 else |
| 7777 result.setOffscreenCanvas(getOffscreenCanvas()); | 7770 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7778 } | 7771 } |
| 7779 | 7772 |
| 7780 } // namespace blink | 7773 } // namespace blink |
| OLD | NEW |