OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!sharedContext) | 207 if (!sharedContext) |
208 return false; | 208 return false; |
209 | 209 |
210 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM
ailbox); | 210 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM
ailbox); |
211 | 211 |
212 // Contexts may be in a different share group. We must transfer the texture
through a mailbox first | 212 // Contexts may be in a different share group. We must transfer the texture
through a mailbox first |
213 sharedContext->genMailboxCHROMIUM(mailbox->name); | 213 sharedContext->genMailboxCHROMIUM(mailbox->name); |
214 sharedContext->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, mailbo
x->name); | 214 sharedContext->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, mailbo
x->name); |
215 sharedContext->flush(); | 215 sharedContext->flush(); |
216 | 216 |
217 mailbox->syncPoint = sharedContext->insertSyncPoint(); | 217 mailbox->validSyncToken = sharedContext->insertSyncPoint(mailbox->syncToken)
; |
| 218 if (mailbox->validSyncToken) |
| 219 context->waitSyncToken(mailbox->syncToken); |
218 | 220 |
219 context->waitSyncPoint(mailbox->syncPoint); | |
220 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox->name); | 221 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox->name); |
221 | 222 |
222 // The canvas is stored in a premultiplied format, so unpremultiply if neces
sary. | 223 // The canvas is stored in a premultiplied format, so unpremultiply if neces
sary. |
223 // The canvas is stored in an inverted position, so the flip semantics are r
eversed. | 224 // The canvas is stored in an inverted position, so the flip semantics are r
eversed. |
224 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FA
LSE : GL_TRUE); | 225 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FA
LSE : GL_TRUE); |
225 | 226 |
226 context->deleteTexture(sourceTexture); | 227 context->deleteTexture(sourceTexture); |
227 | 228 |
228 context->flush(); | 229 context->flush(); |
229 sharedContext->waitSyncPoint(context->insertSyncPoint()); | 230 |
| 231 WGC3Dbyte syncToken[24]; |
| 232 if (context->insertSyncPoint(syncToken)) |
| 233 sharedContext->waitSyncToken(syncToken); |
230 | 234 |
231 // Undo grContext texture binding changes introduced in this function | 235 // Undo grContext texture binding changes introduced in this function |
232 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); | 236 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); |
233 | 237 |
234 return true; | 238 return true; |
235 } | 239 } |
236 | 240 |
237 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) | 241 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) |
238 { | 242 { |
239 if (!drawingBuffer || !m_surface->isAccelerated()) | 243 if (!drawingBuffer || !m_surface->isAccelerated()) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 378 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
375 | 379 |
376 Vector<unsigned char> result; | 380 Vector<unsigned char> result; |
377 if (!encodeImage(mimeType, quality, &result)) | 381 if (!encodeImage(mimeType, quality, &result)) |
378 return "data:,"; | 382 return "data:,"; |
379 | 383 |
380 return "data:" + mimeType + ";base64," + base64Encode(result); | 384 return "data:" + mimeType + ";base64," + base64Encode(result); |
381 } | 385 } |
382 | 386 |
383 } // namespace blink | 387 } // namespace blink |
OLD | NEW |