| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 422 } |
| 423 if (m_requestedAttributes.stencil) { | 423 if (m_requestedAttributes.stencil) { |
| 424 blink::WGC3Dint stencilBits = 0; | 424 blink::WGC3Dint stencilBits = 0; |
| 425 m_context->getIntegerv(GL_STENCIL_BITS, &stencilBits); | 425 m_context->getIntegerv(GL_STENCIL_BITS, &stencilBits); |
| 426 m_actualAttributes.stencil = stencilBits > 0; | 426 m_actualAttributes.stencil = stencilBits > 0; |
| 427 } | 427 } |
| 428 m_actualAttributes.antialias = multisample(); | 428 m_actualAttributes.antialias = multisample(); |
| 429 return true; | 429 return true; |
| 430 } | 430 } |
| 431 | 431 |
| 432 bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, b
ool premultiplyAlpha, bool flipY) | 432 bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, b
ool premultiplyAlpha, bool flipY, bool fromFrontBuffer) |
| 433 { | 433 { |
| 434 if (!m_context->makeContextCurrent()) | 434 if (!m_context->makeContextCurrent()) |
| 435 return false; | 435 return false; |
| 436 |
| 437 GLint textureId = m_colorBuffer.textureId; |
| 438 if (fromFrontBuffer) |
| 439 textureId = m_frontColorBuffer.textureId; |
| 440 |
| 436 if (m_contentsChanged) { | 441 if (m_contentsChanged) { |
| 437 if (m_multisampleMode != None) { | 442 if (m_multisampleMode != None) { |
| 438 commit(); | 443 commit(); |
| 439 if (!m_framebufferBinding) | 444 if (!m_framebufferBinding) |
| 440 bind(); | 445 bind(); |
| 441 else | 446 else |
| 442 restoreFramebufferBinding(); | 447 restoreFramebufferBinding(); |
| 443 } | 448 } |
| 444 m_context->flush(); | 449 m_context->flush(); |
| 445 } | 450 } |
| 446 | 451 |
| 447 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l
evel)) | 452 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l
evel)) |
| 448 return false; | 453 return false; |
| 449 | 454 |
| 450 // Contexts may be in a different share group. We must transfer the texture
through a mailbox first | 455 // Contexts may be in a different share group. We must transfer the texture
through a mailbox first |
| 451 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo()); | 456 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo()); |
| 452 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name); | 457 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name); |
| 453 m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer.textureId); | 458 m_context->bindTexture(GL_TEXTURE_2D, textureId); |
| 454 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name
); | 459 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name
); |
| 455 m_context->flush(); | 460 m_context->flush(); |
| 456 | 461 |
| 457 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); | 462 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); |
| 458 | 463 |
| 459 if (!context->makeContextCurrent()) | 464 if (!context->makeContextCurrent()) |
| 460 return false; | 465 return false; |
| 461 | 466 |
| 462 Platform3DObject sourceTexture = context->createTexture(); | 467 Platform3DObject sourceTexture = context->createTexture(); |
| 463 | 468 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 1073 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
| 1069 { | 1074 { |
| 1070 if (info->imageId) { | 1075 if (info->imageId) { |
| 1071 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 1076 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
| 1072 m_context->destroyImageCHROMIUM(info->imageId); | 1077 m_context->destroyImageCHROMIUM(info->imageId); |
| 1073 info->imageId = 0; | 1078 info->imageId = 0; |
| 1074 } | 1079 } |
| 1075 } | 1080 } |
| 1076 | 1081 |
| 1077 } // namespace WebCore | 1082 } // namespace WebCore |
| OLD | NEW |