| 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 25 matching lines...) Expand all Loading... |
| 36 #include "public/platform/Platform.h" | 36 #include "public/platform/Platform.h" |
| 37 #include "public/platform/WebCompositorSupport.h" | 37 #include "public/platform/WebCompositorSupport.h" |
| 38 #include "public/platform/WebGraphicsContext3D.h" | 38 #include "public/platform/WebGraphicsContext3D.h" |
| 39 #include "public/platform/WebGraphicsContext3DProvider.h" | 39 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 40 #include "public/platform/WebScheduler.h" | 40 #include "public/platform/WebScheduler.h" |
| 41 #include "public/platform/WebTraceLocation.h" | 41 #include "public/platform/WebTraceLocation.h" |
| 42 #include "third_party/skia/include/core/SkData.h" | 42 #include "third_party/skia/include/core/SkData.h" |
| 43 #include "third_party/skia/include/core/SkPictureRecorder.h" | 43 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 44 #include "third_party/skia/include/core/SkSurface.h" | 44 #include "third_party/skia/include/core/SkSurface.h" |
| 45 #include "third_party/skia/include/gpu/GrContext.h" | 45 #include "third_party/skia/include/gpu/GrContext.h" |
| 46 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 46 #include "wtf/RefCountedLeakCounter.h" | 47 #include "wtf/RefCountedLeakCounter.h" |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 enum { | 50 enum { |
| 50 InvalidMailboxIndex = -1, | 51 InvalidMailboxIndex = -1, |
| 51 MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than t
wo animation frames behind. | 52 MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than t
wo animation frames behind. |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 #ifndef NDEBUG | 55 #ifndef NDEBUG |
| 55 WTF::RefCountedLeakCounter& canvas2DLayerBridgeInstanceCounter() | 56 WTF::RefCountedLeakCounter& canvas2DLayerBridgeInstanceCounter() |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 // Need to flush skia's internal queue because texture is about to be access
ed directly | 596 // Need to flush skia's internal queue because texture is about to be access
ed directly |
| 596 grContext->flush(); | 597 grContext->flush(); |
| 597 | 598 |
| 598 ASSERT(image->getTexture()); | 599 ASSERT(image->getTexture()); |
| 599 | 600 |
| 600 // Because of texture sharing with the compositor, we must invalidate | 601 // Because of texture sharing with the compositor, we must invalidate |
| 601 // the state cached in skia so that the deferred copy on write | 602 // the state cached in skia so that the deferred copy on write |
| 602 // in SkSurface_Gpu does not make any false assumptions. | 603 // in SkSurface_Gpu does not make any false assumptions. |
| 603 mailboxInfo.m_image->getTexture()->textureParamsModified(); | 604 mailboxInfo.m_image->getTexture()->textureParamsModified(); |
| 604 | 605 |
| 605 webContext->bindTexture(GL_TEXTURE_2D, mailboxInfo.m_image->getTexture()->ge
tTextureHandle()); | 606 GLuint textureID = reinterpret_cast<const GrGLTextureInfo*>(mailboxInfo.m_im
age->getTexture()->getTextureHandle())->fID; |
| 607 webContext->bindTexture(GL_TEXTURE_2D, textureID); |
| 606 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); | 608 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); |
| 607 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); | 609 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); |
| 608 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE
); | 610 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE
); |
| 609 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE
); | 611 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE
); |
| 610 | 612 |
| 611 // Re-use the texture's existing mailbox, if there is one. | 613 // Re-use the texture's existing mailbox, if there is one. |
| 612 if (image->getTexture()->getCustomData()) { | 614 if (image->getTexture()->getCustomData()) { |
| 613 ASSERT(image->getTexture()->getCustomData()->size() == sizeof(mailboxInf
o.m_mailbox.name)); | 615 ASSERT(image->getTexture()->getCustomData()->size() == sizeof(mailboxInf
o.m_mailbox.name)); |
| 614 memcpy(&mailboxInfo.m_mailbox.name[0], image->getTexture()->getCustomDat
a()->data(), sizeof(mailboxInfo.m_mailbox.name)); | 616 memcpy(&mailboxInfo.m_mailbox.name[0], image->getTexture()->getCustomDat
a()->data(), sizeof(mailboxInfo.m_mailbox.name)); |
| 615 } else { | 617 } else { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 m_image = other.m_image; | 787 m_image = other.m_image; |
| 786 m_parentLayerBridge = other.m_parentLayerBridge; | 788 m_parentLayerBridge = other.m_parentLayerBridge; |
| 787 } | 789 } |
| 788 | 790 |
| 789 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 791 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
| 790 { | 792 { |
| 791 blink::Platform::current()->histogramEnumeration("Canvas.HibernationEvents",
event, HibernationEventCount); | 793 blink::Platform::current()->histogramEnumeration("Canvas.HibernationEvents",
event, HibernationEventCount); |
| 792 } | 794 } |
| 793 | 795 |
| 794 } // namespace blink | 796 } // namespace blink |
| OLD | NEW |