| 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 // TODO(xidachen): Create a small pool of recycled textures from ImageBitmap
RenderingContext's |
| 645 // transferFromImageBitmap, and try to use them in DrawingBuffer. |
| 646 return imageBitmap; |
| 647 } |
| 648 |
| 637 namespace { | 649 namespace { |
| 638 | 650 |
| 639 // ES2 enums | 651 // ES2 enums |
| 640 static const GLenum kSupportedInternalFormatsES2[] = { | 652 static const GLenum kSupportedInternalFormatsES2[] = { |
| 641 GL_RGB, | 653 GL_RGB, |
| 642 GL_RGBA, | 654 GL_RGBA, |
| 643 GL_LUMINANCE_ALPHA, | 655 GL_LUMINANCE_ALPHA, |
| 644 GL_LUMINANCE, | 656 GL_LUMINANCE, |
| 645 GL_ALPHA, | 657 GL_ALPHA, |
| 646 }; | 658 }; |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 m_drawingBuffer.clear(); | 1170 m_drawingBuffer.clear(); |
| 1159 } | 1171 } |
| 1160 | 1172 |
| 1161 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) | 1173 void WebGLRenderingContextBase::markContextChanged(ContentChangeType changeType) |
| 1162 { | 1174 { |
| 1163 if (m_framebufferBinding || isContextLost()) | 1175 if (m_framebufferBinding || isContextLost()) |
| 1164 return; | 1176 return; |
| 1165 | 1177 |
| 1166 drawingBuffer()->markContentsChanged(); | 1178 drawingBuffer()->markContentsChanged(); |
| 1167 | 1179 |
| 1180 if (!canvas()) |
| 1181 return; |
| 1182 |
| 1168 LayoutBox* layoutBox = canvas()->layoutBox(); | 1183 LayoutBox* layoutBox = canvas()->layoutBox(); |
| 1169 if (layoutBox && layoutBox->hasAcceleratedCompositing()) { | 1184 if (layoutBox && layoutBox->hasAcceleratedCompositing()) { |
| 1170 m_markedCanvasDirty = true; | 1185 m_markedCanvasDirty = true; |
| 1171 canvas()->clearCopiedImage(); | 1186 canvas()->clearCopiedImage(); |
| 1172 layoutBox->contentChanged(changeType); | 1187 layoutBox->contentChanged(changeType); |
| 1173 } else { | 1188 } else { |
| 1174 if (!m_markedCanvasDirty) { | 1189 if (!m_markedCanvasDirty) { |
| 1175 m_markedCanvasDirty = true; | 1190 m_markedCanvasDirty = true; |
| 1176 canvas()->didDraw(FloatRect(FloatPoint(0, 0), FloatSize(clampedCanva
sSize()))); | 1191 canvas()->didDraw(FloatRect(FloatPoint(0, 0), FloatSize(clampedCanva
sSize()))); |
| 1177 } | 1192 } |
| (...skipping 5206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6384 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6399 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6385 } | 6400 } |
| 6386 | 6401 |
| 6387 void WebGLRenderingContextBase::restoreUnpackParameters() | 6402 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6388 { | 6403 { |
| 6389 if (m_unpackAlignment != 1) | 6404 if (m_unpackAlignment != 1) |
| 6390 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6405 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6391 } | 6406 } |
| 6392 | 6407 |
| 6393 } // namespace blink | 6408 } // namespace blink |
| OLD | NEW |