| 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 4083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4094 return; | 4094 return; |
| 4095 } | 4095 } |
| 4096 const char* reason = "framebuffer incomplete"; | 4096 const char* reason = "framebuffer incomplete"; |
| 4097 WebGLFramebuffer* framebuffer = getReadFramebufferBinding(); | 4097 WebGLFramebuffer* framebuffer = getReadFramebufferBinding(); |
| 4098 if (framebuffer && | 4098 if (framebuffer && |
| 4099 framebuffer->checkDepthStencilStatus(&reason) != | 4099 framebuffer->checkDepthStencilStatus(&reason) != |
| 4100 GL_FRAMEBUFFER_COMPLETE) { | 4100 GL_FRAMEBUFFER_COMPLETE) { |
| 4101 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason); | 4101 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason); |
| 4102 return; | 4102 return; |
| 4103 } | 4103 } |
| 4104 if (!validateReadPixelsFuncParameters( | 4104 CheckedNumeric<GLuint> bufferSize = pixels->byteLength() - offsetInBytes; |
| 4105 width, height, format, type, pixels, | 4105 if (!bufferSize.IsValid()) { |
| 4106 (pixels->byteLength() - offsetInBytes).ValueOrDie())) { | 4106 synthesizeGLError(GL_INVALID_VALUE, "readPixels", |
| 4107 "destination offset out of range"); |
| 4108 return; |
| 4109 } |
| 4110 if (!validateReadPixelsFuncParameters(width, height, format, type, pixels, |
| 4111 bufferSize.ValueOrDie())) { |
| 4107 return; | 4112 return; |
| 4108 } | 4113 } |
| 4109 clearIfComposited(); | 4114 clearIfComposited(); |
| 4110 uint8_t* data = | 4115 uint8_t* data = |
| 4111 static_cast<uint8_t*>(pixels->baseAddress()) + offsetInBytes.ValueOrDie(); | 4116 static_cast<uint8_t*>(pixels->baseAddress()) + offsetInBytes.ValueOrDie(); |
| 4112 { | 4117 { |
| 4113 ScopedDrawingBufferBinder binder(drawingBuffer(), framebuffer); | 4118 ScopedDrawingBufferBinder binder(drawingBuffer(), framebuffer); |
| 4114 contextGL()->ReadPixels(x, y, width, height, format, type, data); | 4119 contextGL()->ReadPixels(x, y, width, height, format, type, data); |
| 4115 } | 4120 } |
| 4116 } | 4121 } |
| (...skipping 3645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7762 | 7767 |
| 7763 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7768 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7764 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7769 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7765 if (canvas()) | 7770 if (canvas()) |
| 7766 result.setHTMLCanvasElement(canvas()); | 7771 result.setHTMLCanvasElement(canvas()); |
| 7767 else | 7772 else |
| 7768 result.setOffscreenCanvas(getOffscreenCanvas()); | 7773 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7769 } | 7774 } |
| 7770 | 7775 |
| 7771 } // namespace blink | 7776 } // namespace blink |
| OLD | NEW |