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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "modules/webgl/WebGLDrawBuffers.h" | 76 #include "modules/webgl/WebGLDrawBuffers.h" |
77 #include "modules/webgl/WebGLFramebuffer.h" | 77 #include "modules/webgl/WebGLFramebuffer.h" |
78 #include "modules/webgl/WebGLLoseContext.h" | 78 #include "modules/webgl/WebGLLoseContext.h" |
79 #include "modules/webgl/WebGLProgram.h" | 79 #include "modules/webgl/WebGLProgram.h" |
80 #include "modules/webgl/WebGLRenderbuffer.h" | 80 #include "modules/webgl/WebGLRenderbuffer.h" |
81 #include "modules/webgl/WebGLShader.h" | 81 #include "modules/webgl/WebGLShader.h" |
82 #include "modules/webgl/WebGLShaderPrecisionFormat.h" | 82 #include "modules/webgl/WebGLShaderPrecisionFormat.h" |
83 #include "modules/webgl/WebGLUniformLocation.h" | 83 #include "modules/webgl/WebGLUniformLocation.h" |
84 #include "modules/webgl/WebGLVertexArrayObject.h" | 84 #include "modules/webgl/WebGLVertexArrayObject.h" |
85 #include "modules/webgl/WebGLVertexArrayObjectOES.h" | 85 #include "modules/webgl/WebGLVertexArrayObjectOES.h" |
86 #include "platform/CheckedInt.h" | |
87 #include "platform/CrossThreadFunctional.h" | 86 #include "platform/CrossThreadFunctional.h" |
88 #include "platform/RuntimeEnabledFeatures.h" | 87 #include "platform/RuntimeEnabledFeatures.h" |
89 #include "platform/WaitableEvent.h" | 88 #include "platform/WaitableEvent.h" |
90 #include "platform/geometry/IntSize.h" | 89 #include "platform/geometry/IntSize.h" |
91 #include "platform/graphics/GraphicsContext.h" | 90 #include "platform/graphics/GraphicsContext.h" |
92 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 91 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
93 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" | 92 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
94 #include "public/platform/Platform.h" | 93 #include "public/platform/Platform.h" |
95 #include "public/platform/functional/WebFunction.h" | 94 #include "public/platform/functional/WebFunction.h" |
| 95 #include "wtf/CheckedNumeric.h" |
96 #include "wtf/Functional.h" | 96 #include "wtf/Functional.h" |
97 #include "wtf/PtrUtil.h" | 97 #include "wtf/PtrUtil.h" |
98 #include "wtf/text/StringBuilder.h" | 98 #include "wtf/text/StringBuilder.h" |
99 #include "wtf/text/StringUTF8Adaptor.h" | 99 #include "wtf/text/StringUTF8Adaptor.h" |
100 #include "wtf/typed_arrays/ArrayBufferContents.h" | 100 #include "wtf/typed_arrays/ArrayBufferContents.h" |
101 #include <memory> | 101 #include <memory> |
102 | 102 |
103 namespace blink { | 103 namespace blink { |
104 | 104 |
105 namespace { | 105 namespace { |
(...skipping 5652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5758 default: | 5758 default: |
5759 ASSERT_NOT_REACHED(); | 5759 ASSERT_NOT_REACHED(); |
5760 } | 5760 } |
5761 | 5761 |
5762 unsigned totalBytesRequired, skipBytes; | 5762 unsigned totalBytesRequired, skipBytes; |
5763 GLenum error = WebGLImageConversion::computeImageSizeInBytes(format, type, w
idth, height, depth, getUnpackPixelStoreParams(texDimension), &totalBytesRequire
d, 0, &skipBytes); | 5763 GLenum error = WebGLImageConversion::computeImageSizeInBytes(format, type, w
idth, height, depth, getUnpackPixelStoreParams(texDimension), &totalBytesRequire
d, 0, &skipBytes); |
5764 if (error != GL_NO_ERROR) { | 5764 if (error != GL_NO_ERROR) { |
5765 synthesizeGLError(error, functionName, "invalid texture dimensions"); | 5765 synthesizeGLError(error, functionName, "invalid texture dimensions"); |
5766 return false; | 5766 return false; |
5767 } | 5767 } |
5768 CheckedInt<uint32_t> total = srcOffset; | 5768 CheckedNumeric<uint32_t> total = srcOffset; |
5769 total *= pixels->typeSize(); | 5769 total *= pixels->typeSize(); |
5770 total += totalBytesRequired; | 5770 total += totalBytesRequired; |
5771 total += skipBytes; | 5771 total += skipBytes; |
5772 if (!total.isValid() || pixels->byteLength() < total.value()) { | 5772 if (!total.IsValid() || pixels->byteLength() < total.ValueOrDie()) { |
5773 synthesizeGLError(GL_INVALID_OPERATION, functionName, "ArrayBufferView n
ot big enough for request"); | 5773 synthesizeGLError(GL_INVALID_OPERATION, functionName, "ArrayBufferView n
ot big enough for request"); |
5774 return false; | 5774 return false; |
5775 } | 5775 } |
5776 return true; | 5776 return true; |
5777 } | 5777 } |
5778 | 5778 |
5779 bool WebGLRenderingContextBase::validateCompressedTexFormat(const char* function
Name, GLenum format) | 5779 bool WebGLRenderingContextBase::validateCompressedTexFormat(const char* function
Name, GLenum format) |
5780 { | 5780 { |
5781 if (!m_compressedTextureFormats.contains(format)) { | 5781 if (!m_compressedTextureFormats.contains(format)) { |
5782 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid format"); | 5782 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid format"); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6454 | 6454 |
6455 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const | 6455 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffs
creenCanvas& result) const |
6456 { | 6456 { |
6457 if (canvas()) | 6457 if (canvas()) |
6458 result.setHTMLCanvasElement(canvas()); | 6458 result.setHTMLCanvasElement(canvas()); |
6459 else | 6459 else |
6460 result.setOffscreenCanvas(getOffscreenCanvas()); | 6460 result.setOffscreenCanvas(getOffscreenCanvas()); |
6461 } | 6461 } |
6462 | 6462 |
6463 } // namespace blink | 6463 } // namespace blink |
OLD | NEW |