| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 // Early exit if canvas was not drawn to since last prepareMailbox | 408 // Early exit if canvas was not drawn to since last prepareMailbox |
| 409 if (image->uniqueID() == m_lastImageId) | 409 if (image->uniqueID() == m_lastImageId) |
| 410 return false; | 410 return false; |
| 411 m_lastImageId = image->uniqueID(); | 411 m_lastImageId = image->uniqueID(); |
| 412 | 412 |
| 413 MailboxInfo* mailboxInfo = createMailboxInfo(); | 413 MailboxInfo* mailboxInfo = createMailboxInfo(); |
| 414 mailboxInfo->m_status = MailboxInUse; | 414 mailboxInfo->m_status = MailboxInUse; |
| 415 mailboxInfo->m_image = image; | 415 mailboxInfo->m_image = image; |
| 416 | 416 |
| 417 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); |
| 418 ASSERT(mailboxInfo->m_image.get()); |
| 419 ASSERT(mailboxInfo->m_image->getTexture()); |
| 420 |
| 417 // Because of texture sharing with the compositor, we must invalidate | 421 // Because of texture sharing with the compositor, we must invalidate |
| 418 // the state cached in skia so that the deferred copy on write | 422 // the state cached in skia so that the deferred copy on write |
| 419 // in SkSurface_Gpu does not make any false assumptions. | 423 // in SkSurface_Gpu does not make any false assumptions. |
| 420 mailboxInfo->m_image->getTexture()->textureParamsModified(); | 424 mailboxInfo->m_image->getTexture()->textureParamsModified(); |
| 421 | 425 |
| 422 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); | |
| 423 ASSERT(mailboxInfo->m_image.get()); | |
| 424 ASSERT(mailboxInfo->m_image->getTexture()); | |
| 425 | |
| 426 webContext->bindTexture(GL_TEXTURE_2D, mailboxInfo->m_image->getTexture()->g
etTextureHandle()); | 426 webContext->bindTexture(GL_TEXTURE_2D, mailboxInfo->m_image->getTexture()->g
etTextureHandle()); |
| 427 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 427 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 428 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 428 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 429 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE
); | 429 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE
); |
| 430 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE
); | 430 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE
); |
| 431 webContext->produceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo->m_mailbox.nam
e); | 431 webContext->produceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo->m_mailbox.nam
e); |
| 432 if (isHidden()) { | 432 if (isHidden()) { |
| 433 // With hidden canvases, we release the SkImage immediately because | 433 // With hidden canvases, we release the SkImage immediately because |
| 434 // there is no need for animations to be double buffered. | 434 // there is no need for animations to be double buffered. |
| 435 mailboxInfo->m_image.clear(); | 435 mailboxInfo->m_image.clear(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { | 533 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { |
| 534 // This copy constructor should only be used for Vector reallocation | 534 // This copy constructor should only be used for Vector reallocation |
| 535 // Assuming 'other' is to be destroyed, we transfer m_image ownership | 535 // Assuming 'other' is to be destroyed, we transfer m_image ownership |
| 536 // rather than do a refcount dance. | 536 // rather than do a refcount dance. |
| 537 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 537 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
| 538 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 538 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
| 539 m_status = other.m_status; | 539 m_status = other.m_status; |
| 540 } | 540 } |
| 541 | 541 |
| 542 } | 542 } |
| OLD | NEW |