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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 mailboxInfo->m_image.swap(&image); | 315 mailboxInfo->m_image.swap(&image); |
316 // Because of texture sharing with the compositor, we must invalidate | 316 // Because of texture sharing with the compositor, we must invalidate |
317 // the state cached in skia so that the deferred copy on write | 317 // the state cached in skia so that the deferred copy on write |
318 // in SkSurface_Gpu does not make any false assumptions. | 318 // in SkSurface_Gpu does not make any false assumptions. |
319 mailboxInfo->m_image->getTexture()->invalidateCachedState(); | 319 mailboxInfo->m_image->getTexture()->invalidateCachedState(); |
320 | 320 |
321 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); | 321 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); |
322 ASSERT(mailboxInfo->m_image.get()); | 322 ASSERT(mailboxInfo->m_image.get()); |
323 ASSERT(mailboxInfo->m_image->getTexture()); | 323 ASSERT(mailboxInfo->m_image->getTexture()); |
324 | 324 |
325 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, mailboxInfo->m_image->
getTexture()->getTextureHandle()); | 325 m_context->bindTexture(GL_TEXTURE_2D, mailboxInfo->m_image->getTexture()->ge
tTextureHandle()); |
326 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); | 326 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
327 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); | 327 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
328 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); | 328 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
; |
329 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T
EXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); | 329 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
; |
330 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, mailboxInfo
->m_mailbox.name); | 330 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo->m_mailbox.name
); |
331 context()->flush(); | 331 context()->flush(); |
332 mailboxInfo->m_mailbox.syncPoint = context()->insertSyncPoint(); | 332 mailboxInfo->m_mailbox.syncPoint = context()->insertSyncPoint(); |
333 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); | 333 m_context->bindTexture(GL_TEXTURE_2D, 0); |
334 // Because we are changing the texture binding without going through skia, | 334 // Because we are changing the texture binding without going through skia, |
335 // we must dirty the context. | 335 // we must dirty the context. |
336 m_context->grContext()->resetContext(kTextureBinding_GrGLBackendState); | 336 m_context->grContext()->resetContext(kTextureBinding_GrGLBackendState); |
337 | 337 |
338 // set m_parentLayerBridge to make sure 'this' stays alive as long as it has | 338 // set m_parentLayerBridge to make sure 'this' stays alive as long as it has |
339 // live mailboxes | 339 // live mailboxes |
340 ASSERT(!mailboxInfo->m_parentLayerBridge); | 340 ASSERT(!mailboxInfo->m_parentLayerBridge); |
341 mailboxInfo->m_parentLayerBridge = this; | 341 mailboxInfo->m_parentLayerBridge = this; |
342 *outMailbox = mailboxInfo->m_mailbox; | 342 *outMailbox = mailboxInfo->m_mailbox; |
343 return true; | 343 return true; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { | 416 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { |
417 // This copy constructor should only be used for Vector reallocation | 417 // This copy constructor should only be used for Vector reallocation |
418 // Assuming 'other' is to be destroyed, we swap m_image ownership | 418 // Assuming 'other' is to be destroyed, we swap m_image ownership |
419 // rather than do a refcount dance. | 419 // rather than do a refcount dance. |
420 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 420 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
421 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image)); | 421 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image)); |
422 m_status = other.m_status; | 422 m_status = other.m_status; |
423 } | 423 } |
424 | 424 |
425 } | 425 } |
OLD | NEW |