Chromium Code Reviews| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 627 PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGra phicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes attribut es, unsigned webGLVersion) | 627 PassOwnPtr<WebGraphicsContext3DProvider> WebGLRenderingContextBase::createWebGra phicsContext3DProvider(ScriptState* scriptState, WebGLContextAttributes attribut es, unsigned webGLVersion) |
| 628 { | 628 { |
| 629 return createContextProviderInternal(nullptr, scriptState, attributes, webGL Version); | 629 return createContextProviderInternal(nullptr, scriptState, attributes, webGL Version); |
| 630 } | 630 } |
| 631 | 631 |
| 632 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() | 632 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() |
| 633 { | 633 { |
| 634 shouldFailContextCreationForTesting = true; | 634 shouldFailContextCreationForTesting = true; |
| 635 } | 635 } |
| 636 | 636 |
| 637 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() | |
| 638 { | |
| 639 if (!drawingBuffer()) | |
| 640 return nullptr; | |
| 641 WebExternalTextureMailbox mailbox; | |
| 642 drawingBuffer()->prepareMailbox(&mailbox, 0); | |
| 643 ImageBitmap* imageBitmap = ImageBitmap::create(mailbox); | |
| 644 return imageBitmap; | |
|
Ken Russell (switch to Gerrit)
2016/05/19 00:15:11
This is a good start. Please add a TODO like:
TOD
xidachen
2016/05/19 13:48:29
Done.
| |
| 645 } | |
| 646 | |
| 637 namespace { | 647 namespace { |
| 638 | 648 |
| 639 // ES2 enums | 649 // ES2 enums |
| 640 static const GLenum kSupportedInternalFormatsES2[] = { | 650 static const GLenum kSupportedInternalFormatsES2[] = { |
| 641 GL_RGB, | 651 GL_RGB, |
| 642 GL_RGBA, | 652 GL_RGBA, |
| 643 GL_LUMINANCE_ALPHA, | 653 GL_LUMINANCE_ALPHA, |
| 644 GL_LUMINANCE, | 654 GL_LUMINANCE, |
| 645 GL_ALPHA, | 655 GL_ALPHA, |
| 646 }; | 656 }; |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1158 m_drawingBuffer.clear(); | 1168 m_drawingBuffer.clear(); |
| 1159 } | 1169 } |
| 1160 | 1170 |
| 1161 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) | 1171 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) |
| 1162 { | 1172 { |
| 1163 if (m_framebufferBinding || isContextLost()) | 1173 if (m_framebufferBinding || isContextLost()) |
| 1164 return; | 1174 return; |
| 1165 | 1175 |
| 1166 drawingBuffer()->markContentsChanged(); | 1176 drawingBuffer()->markContentsChanged(); |
| 1167 | 1177 |
| 1178 if (!canvas()) | |
| 1179 return; | |
| 1180 | |
| 1168 LayoutBox* layoutBox = canvas()->layoutBox(); | 1181 LayoutBox* layoutBox = canvas()->layoutBox(); |
| 1169 if (layoutBox && layoutBox->hasAcceleratedCompositing()) { | 1182 if (layoutBox && layoutBox->hasAcceleratedCompositing()) { |
| 1170 m_markedCanvasDirty = true; | 1183 m_markedCanvasDirty = true; |
| 1171 canvas()->clearCopiedImage(); | 1184 canvas()->clearCopiedImage(); |
| 1172 layoutBox->contentChanged(changeType); | 1185 layoutBox->contentChanged(changeType); |
| 1173 } else { | 1186 } else { |
| 1174 if (!m_markedCanvasDirty) { | 1187 if (!m_markedCanvasDirty) { |
| 1175 m_markedCanvasDirty = true; | 1188 m_markedCanvasDirty = true; |
| 1176 canvas()->didDraw(FloatRect(FloatPoint(0, 0), FloatSize(clampedCanva sSize()))); | 1189 canvas()->didDraw(FloatRect(FloatPoint(0, 0), FloatSize(clampedCanva sSize()))); |
| 1177 } | 1190 } |
| (...skipping 5206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6384 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6397 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6385 } | 6398 } |
| 6386 | 6399 |
| 6387 void WebGLRenderingContextBase::restoreUnpackParameters() | 6400 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6388 { | 6401 { |
| 6389 if (m_unpackAlignment != 1) | 6402 if (m_unpackAlignment != 1) |
| 6390 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6403 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6391 } | 6404 } |
| 6392 | 6405 |
| 6393 } // namespace blink | 6406 } // namespace blink |
| OLD | NEW |