| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 sharedContext->genMailboxCHROMIUM(mailbox->name); | 201 sharedContext->genMailboxCHROMIUM(mailbox->name); |
| 202 sharedContext->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, mailbo
x->name); | 202 sharedContext->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, mailbo
x->name); |
| 203 sharedContext->flush(); | 203 sharedContext->flush(); |
| 204 | 204 |
| 205 mailbox->syncPoint = sharedContext->insertSyncPoint(); | 205 mailbox->syncPoint = sharedContext->insertSyncPoint(); |
| 206 | 206 |
| 207 context->waitSyncPoint(mailbox->syncPoint); | 207 context->waitSyncPoint(mailbox->syncPoint); |
| 208 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox->name); | 208 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox->name); |
| 209 | 209 |
| 210 // The canvas is stored in a premultiplied format, so unpremultiply if neces
sary. | 210 // The canvas is stored in a premultiplied format, so unpremultiply if neces
sary. |
| 211 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyA
lpha); | |
| 212 | |
| 213 // The canvas is stored in an inverted position, so the flip semantics are r
eversed. | 211 // The canvas is stored in an inverted position, so the flip semantics are r
eversed. |
| 214 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, !flipY); | |
| 215 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FA
LSE : GL_TRUE); | 212 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FA
LSE : GL_TRUE); |
| 216 | 213 |
| 217 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); | |
| 218 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); | |
| 219 | |
| 220 context->deleteTexture(sourceTexture); | 214 context->deleteTexture(sourceTexture); |
| 221 | 215 |
| 222 context->flush(); | 216 context->flush(); |
| 223 sharedContext->waitSyncPoint(context->insertSyncPoint()); | 217 sharedContext->waitSyncPoint(context->insertSyncPoint()); |
| 224 | 218 |
| 225 // Undo grContext texture binding changes introduced in this function | 219 // Undo grContext texture binding changes introduced in this function |
| 226 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); | 220 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); |
| 227 | 221 |
| 228 return true; | 222 return true; |
| 229 } | 223 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 377 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 384 | 378 |
| 385 Vector<char> encodedImage; | 379 Vector<char> encodedImage; |
| 386 if (!encodeImage(*this, mimeType, quality, &encodedImage)) | 380 if (!encodeImage(*this, mimeType, quality, &encodedImage)) |
| 387 return "data:,"; | 381 return "data:,"; |
| 388 | 382 |
| 389 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 383 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
| 390 } | 384 } |
| 391 | 385 |
| 392 } // namespace blink | 386 } // namespace blink |
| OLD | NEW |