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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 mailboxInfo->m_image.swap(&image); | 301 mailboxInfo->m_image.swap(&image); |
302 // Because of texture sharing with the compositor, we must invalidate | 302 // Because of texture sharing with the compositor, we must invalidate |
303 // the state cached in skia so that the deferred copy on write | 303 // the state cached in skia so that the deferred copy on write |
304 // in SkSurface_Gpu does not make any false assumptions. | 304 // in SkSurface_Gpu does not make any false assumptions. |
305 mailboxInfo->m_image->getTexture()->invalidateCachedState(); | 305 mailboxInfo->m_image->getTexture()->invalidateCachedState(); |
306 | 306 |
307 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); | 307 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); |
308 ASSERT(mailboxInfo->m_image.get()); | 308 ASSERT(mailboxInfo->m_image.get()); |
309 ASSERT(mailboxInfo->m_image->getTexture()); | 309 ASSERT(mailboxInfo->m_image->getTexture()); |
310 | 310 |
311 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, mailboxInfo->m_image->
getTexture()->getTextureHandle()); | 311 m_context->bindTexture(GL_TEXTURE_2D, mailboxInfo->m_image->getTexture()->ge
tTextureHandle()); |
312 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); | 312 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
313 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); | 313 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
314 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); | 314 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
; |
315 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); | 315 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
; |
316 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, mailboxInfo
->m_mailbox.name); | 316 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo->m_mailbox.name
); |
317 context()->flush(); | 317 context()->flush(); |
318 mailboxInfo->m_mailbox.syncPoint = context()->insertSyncPoint(); | 318 mailboxInfo->m_mailbox.syncPoint = context()->insertSyncPoint(); |
319 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); | 319 m_context->bindTexture(GL_TEXTURE_2D, 0); |
320 // Because we are changing the texture binding without going through skia, | 320 // Because we are changing the texture binding without going through skia, |
321 // we must dirty the context. | 321 // we must dirty the context. |
322 m_context->grContext()->resetContext(kTextureBinding_GrGLBackendState); | 322 m_context->grContext()->resetContext(kTextureBinding_GrGLBackendState); |
323 | 323 |
324 // set m_parentLayerBridge to make sure 'this' stays alive as long as it has | 324 // set m_parentLayerBridge to make sure 'this' stays alive as long as it has |
325 // live mailboxes | 325 // live mailboxes |
326 ASSERT(!mailboxInfo->m_parentLayerBridge); | 326 ASSERT(!mailboxInfo->m_parentLayerBridge); |
327 mailboxInfo->m_parentLayerBridge = this; | 327 mailboxInfo->m_parentLayerBridge = this; |
328 *outMailbox = mailboxInfo->m_mailbox; | 328 *outMailbox = mailboxInfo->m_mailbox; |
329 return true; | 329 return true; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { | 402 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { |
403 // This copy constructor should only be used for Vector reallocation | 403 // This copy constructor should only be used for Vector reallocation |
404 // Assuming 'other' is to be destroyed, we swap m_image ownership | 404 // Assuming 'other' is to be destroyed, we swap m_image ownership |
405 // rather than do a refcount dance. | 405 // rather than do a refcount dance. |
406 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 406 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
407 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image)); | 407 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image)); |
408 m_status = other.m_status; | 408 m_status = other.m_status; |
409 } | 409 } |
410 | 410 |
411 } | 411 } |
OLD | NEW |