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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->syncPoint = sharedContext->insertSyncPoint(); |
218 | 218 |
219 context->waitSyncPoint(mailbox->syncPoint); | 219 context->waitSyncPoint(mailbox->syncPoint, mailbox->validSyncToken ? mailbox
->syncToken : nullptr); |
| 220 |
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 sharedContext->waitSyncPoint(context->insertSyncPoint(), nullptr); |
230 | 231 |
231 // Undo grContext texture binding changes introduced in this function | 232 // Undo grContext texture binding changes introduced in this function |
232 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); | 233 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); |
233 | 234 |
234 return true; | 235 return true; |
235 } | 236 } |
236 | 237 |
237 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) | 238 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) |
238 { | 239 { |
239 if (!drawingBuffer || !m_surface->isAccelerated()) | 240 if (!drawingBuffer || !m_surface->isAccelerated()) |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 377 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
377 | 378 |
378 Vector<char> encodedImage; | 379 Vector<char> encodedImage; |
379 if (!encodeImage(mimeType, quality, &encodedImage)) | 380 if (!encodeImage(mimeType, quality, &encodedImage)) |
380 return "data:,"; | 381 return "data:,"; |
381 | 382 |
382 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 383 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
383 } | 384 } |
384 | 385 |
385 } // namespace blink | 386 } // namespace blink |
OLD | NEW |