OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 { | 137 { |
138 releaseResources(); | 138 releaseResources(); |
139 } | 139 } |
140 | 140 |
141 void DrawingBuffer::markContentsChanged() | 141 void DrawingBuffer::markContentsChanged() |
142 { | 142 { |
143 m_contentsChanged = true; | 143 m_contentsChanged = true; |
144 m_contentsChangeCommitted = false; | 144 m_contentsChangeCommitted = false; |
145 } | 145 } |
146 | 146 |
147 WebKit::WebGraphicsContext3D* DrawingBuffer::context() | 147 blink::WebGraphicsContext3D* DrawingBuffer::context() |
148 { | 148 { |
149 if (!m_context) | 149 if (!m_context) |
150 return 0; | 150 return 0; |
151 return m_context->webContext(); | 151 return m_context->webContext(); |
152 } | 152 } |
153 | 153 |
154 bool DrawingBuffer::prepareMailbox(WebKit::WebExternalTextureMailbox* outMailbox
, WebKit::WebExternalBitmap* bitmap) | 154 bool DrawingBuffer::prepareMailbox(blink::WebExternalTextureMailbox* outMailbox,
blink::WebExternalBitmap* bitmap) |
155 { | 155 { |
156 if (!m_context || !m_contentsChanged || !m_lastColorBuffer) | 156 if (!m_context || !m_contentsChanged || !m_lastColorBuffer) |
157 return false; | 157 return false; |
158 | 158 |
159 m_context->makeContextCurrent(); | 159 m_context->makeContextCurrent(); |
160 | 160 |
161 // Resolve the multisampled buffer into the texture referenced by m_lastColo
rBuffer mailbox. | 161 // Resolve the multisampled buffer into the texture referenced by m_lastColo
rBuffer mailbox. |
162 if (multisample()) | 162 if (multisample()) |
163 commit(); | 163 commit(); |
164 | 164 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 context()->bindTexture(GraphicsContext3D::TEXTURE_2D, nextFrontColorBuffer->
textureId); | 213 context()->bindTexture(GraphicsContext3D::TEXTURE_2D, nextFrontColorBuffer->
textureId); |
214 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, nextFrontCo
lorBuffer->mailbox.name); | 214 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, nextFrontCo
lorBuffer->mailbox.name); |
215 context()->flush(); | 215 context()->flush(); |
216 m_context->markLayerComposited(); | 216 m_context->markLayerComposited(); |
217 | 217 |
218 *outMailbox = nextFrontColorBuffer->mailbox; | 218 *outMailbox = nextFrontColorBuffer->mailbox; |
219 m_frontColorBuffer = nextFrontColorBuffer->textureId; | 219 m_frontColorBuffer = nextFrontColorBuffer->textureId; |
220 return true; | 220 return true; |
221 } | 221 } |
222 | 222 |
223 void DrawingBuffer::mailboxReleased(const WebKit::WebExternalTextureMailbox& mai
lbox) | 223 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail
box) |
224 { | 224 { |
225 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | 225 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { |
226 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; | 226 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; |
227 if (!memcmp(mailboxInfo->mailbox.name, mailbox.name, sizeof(mailbox.nam
e))) { | 227 if (!memcmp(mailboxInfo->mailbox.name, mailbox.name, sizeof(mailbox.nam
e))) { |
228 mailboxInfo->mailbox.syncPoint = mailbox.syncPoint; | 228 mailboxInfo->mailbox.syncPoint = mailbox.syncPoint; |
229 m_recycledMailboxes.append(mailboxInfo.release()); | 229 m_recycledMailboxes.append(mailboxInfo.release()); |
230 return; | 230 return; |
231 } | 231 } |
232 } | 232 } |
233 ASSERT_NOT_REACHED(); | 233 ASSERT_NOT_REACHED(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 context.pixelStorei(Extensions3D::UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); | 338 context.pixelStorei(Extensions3D::UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); |
339 | 339 |
340 return true; | 340 return true; |
341 } | 341 } |
342 | 342 |
343 Platform3DObject DrawingBuffer::framebuffer() const | 343 Platform3DObject DrawingBuffer::framebuffer() const |
344 { | 344 { |
345 return m_fbo; | 345 return m_fbo; |
346 } | 346 } |
347 | 347 |
348 WebKit::WebLayer* DrawingBuffer::platformLayer() | 348 blink::WebLayer* DrawingBuffer::platformLayer() |
349 { | 349 { |
350 if (!m_context) | 350 if (!m_context) |
351 return 0; | 351 return 0; |
352 | 352 |
353 if (!m_layer) { | 353 if (!m_layer) { |
354 m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->cre
ateExternalTextureLayer(this)); | 354 m_layer = adoptPtr(blink::Platform::current()->compositorSupport()->crea
teExternalTextureLayer(this)); |
355 | 355 |
356 m_layer->setOpaque(!m_attributes.alpha); | 356 m_layer->setOpaque(!m_attributes.alpha); |
357 m_layer->setBlendBackgroundColor(m_attributes.alpha); | 357 m_layer->setBlendBackgroundColor(m_attributes.alpha); |
358 m_layer->setPremultipliedAlpha(m_attributes.premultipliedAlpha); | 358 m_layer->setPremultipliedAlpha(m_attributes.premultipliedAlpha); |
359 GraphicsLayer::registerContentsLayer(m_layer->layer()); | 359 GraphicsLayer::registerContentsLayer(m_layer->layer()); |
360 } | 360 } |
361 | 361 |
362 return m_layer->layer(); | 362 return m_layer->layer(); |
363 } | 363 } |
364 | 364 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 void DrawingBuffer::bind() | 744 void DrawingBuffer::bind() |
745 { | 745 { |
746 if (!m_context) | 746 if (!m_context) |
747 return; | 747 return; |
748 | 748 |
749 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO
? m_multisampleFBO : m_fbo); | 749 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO
? m_multisampleFBO : m_fbo); |
750 } | 750 } |
751 | 751 |
752 } // namespace WebCore | 752 } // namespace WebCore |
OLD | NEW |