OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MailboxTextureHolder_h |
| 6 #define MailboxTextureHolder_h |
| 7 |
| 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/graphics/TextureHolder.h" |
| 10 #include "third_party/khronos/GLES2/gl2.h" |
| 11 |
| 12 namespace gpu { |
| 13 namespace gles2 { |
| 14 class GLES2Interface; |
| 15 } |
| 16 } |
| 17 |
| 18 namespace blink { |
| 19 |
| 20 class SkiaTextureHolder; |
| 21 |
| 22 class PLATFORM_EXPORT MailboxTextureHolder final : public TextureHolder { |
| 23 public: |
| 24 bool isSkiaTextureHolder() final { return false; } |
| 25 unsigned sharedContextId() final; |
| 26 gpu::Mailbox getMailbox() final { return m_mailbox; } |
| 27 gpu::SyncToken getSyncToken() final { return m_syncToken; } |
| 28 IntSize getMailboxSize() final { return m_size; } |
| 29 void releaseImageThreadSafe() final {} |
| 30 sk_sp<SkImage> getSkImage() final { return nullptr; } |
| 31 WebThread* getImageThread() final; |
| 32 IntSize size() const final { return m_size; } |
| 33 void setSharedContextId(unsigned contextId) final {} |
| 34 void setImageThread(WebThread* thread) final {} |
| 35 void deleteTexture(const int8_t* syncTokenData) final; |
| 36 |
| 37 // In WebGL's commit or transferToImageBitmap calls, it will call the |
| 38 // DrawingBuffer::transferToStaticBitmapImage function, which produces the |
| 39 // input parameters for this method. |
| 40 MailboxTextureHolder(const gpu::Mailbox&, |
| 41 const gpu::SyncToken&, |
| 42 unsigned textureId, |
| 43 gpu::gles2::GLES2Interface*, |
| 44 IntSize mailboxSize); |
| 45 // This function turns a texture-backed SkImage into a mailbox and a |
| 46 // syncToken. |
| 47 MailboxTextureHolder(sk_sp<SkImage>); |
| 48 |
| 49 private: |
| 50 gpu::Mailbox m_mailbox; |
| 51 gpu::SyncToken m_syncToken; |
| 52 unsigned m_textureId; |
| 53 gpu::gles2::GLES2Interface* m_gl; |
| 54 IntSize m_size; |
| 55 }; |
| 56 |
| 57 } // namespace blink |
| 58 |
| 59 #endif // MailboxTextureHolder_h |
OLD | NEW |