| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Because of texture sharing with the compositor, we must invalidate | 340 // Because of texture sharing with the compositor, we must invalidate |
| 341 // the state cached in skia so that the deferred copy on write | 341 // the state cached in skia so that the deferred copy on write |
| 342 // in SkSurface_Gpu does not make any false assumptions. | 342 // in SkSurface_Gpu does not make any false assumptions. |
| 343 mailboxInfo.m_image->getTexture()->textureParamsModified(); | 343 mailboxInfo.m_image->getTexture()->textureParamsModified(); |
| 344 mailboxInfo.m_mailbox.textureTarget = GL_TEXTURE_2D; | 344 mailboxInfo.m_mailbox.textureTarget = GL_TEXTURE_2D; |
| 345 | 345 |
| 346 WebGraphicsContext3D* webContext = context(); | 346 WebGraphicsContext3D* webContext = context(); |
| 347 gpu::gles2::GLES2Interface* gl = contextGL(); | 347 gpu::gles2::GLES2Interface* gl = contextGL(); |
| 348 GLuint textureID = skia::GrBackendObjectToGrGLTextureInfo(mailboxInfo.m_imag
e->getTextureHandle(true))->fID; | 348 GLuint textureID = skia::GrBackendObjectToGrGLTextureInfo(mailboxInfo.m_imag
e->getTextureHandle(true))->fID; |
| 349 gl->BindTexture(GL_TEXTURE_2D, textureID); | 349 gl->BindTexture(GL_TEXTURE_2D, textureID); |
| 350 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getGLFilter(
)); | 350 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getGLFilter()); |
| 351 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getGLFilter(
)); | 351 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getGLFilter()); |
| 352 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE
); | 352 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 353 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE
); | 353 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 354 | 354 |
| 355 // Re-use the texture's existing mailbox, if there is one. | 355 // Re-use the texture's existing mailbox, if there is one. |
| 356 if (mailboxInfo.m_image->getTexture()->getCustomData()) { | 356 if (mailboxInfo.m_image->getTexture()->getCustomData()) { |
| 357 ASSERT(mailboxInfo.m_image->getTexture()->getCustomData()->size() == siz
eof(mailboxInfo.m_mailbox.name)); | 357 ASSERT(mailboxInfo.m_image->getTexture()->getCustomData()->size() == siz
eof(mailboxInfo.m_mailbox.name)); |
| 358 memcpy(&mailboxInfo.m_mailbox.name[0], mailboxInfo.m_image->getTexture()
->getCustomData()->data(), sizeof(mailboxInfo.m_mailbox.name)); | 358 memcpy(&mailboxInfo.m_mailbox.name[0], mailboxInfo.m_image->getTexture()
->getCustomData()->data(), sizeof(mailboxInfo.m_mailbox.name)); |
| 359 } else { | 359 } else { |
| 360 gl->GenMailboxCHROMIUM(mailboxInfo.m_mailbox.name); | 360 gl->GenMailboxCHROMIUM(mailboxInfo.m_mailbox.name); |
| 361 RefPtr<SkData> mailboxNameData = adoptRef(SkData::NewWithCopy(&mailboxIn
fo.m_mailbox.name[0], sizeof(mailboxInfo.m_mailbox.name))); | 361 RefPtr<SkData> mailboxNameData = adoptRef(SkData::NewWithCopy(&mailboxIn
fo.m_mailbox.name[0], sizeof(mailboxInfo.m_mailbox.name))); |
| 362 mailboxInfo.m_image->getTexture()->setCustomData(mailboxNameData.get()); | 362 mailboxInfo.m_image->getTexture()->setCustomData(mailboxNameData.get()); |
| 363 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo.m_mailbox.name); | 363 gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo.m_mailbox.name); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 1006 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 1009 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
| 1010 { | 1010 { |
| 1011 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); | 1011 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); |
| 1012 hibernationHistogram.count(event); | 1012 hibernationHistogram.count(event); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 } // namespace blink | 1015 } // namespace blink |
| OLD | NEW |