| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 mailbox->syncPoint = sharedContext->insertSyncPoint(); | 195 mailbox->syncPoint = sharedContext->insertSyncPoint(); |
| 196 | 196 |
| 197 context->waitSyncPoint(mailbox->syncPoint); | 197 context->waitSyncPoint(mailbox->syncPoint); |
| 198 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox->name); | 198 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox->name); |
| 199 | 199 |
| 200 // The canvas is stored in a premultiplied format, so unpremultiply if neces
sary. | 200 // The canvas is stored in a premultiplied format, so unpremultiply if neces
sary. |
| 201 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyA
lpha); | 201 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyA
lpha); |
| 202 | 202 |
| 203 // The canvas is stored in an inverted position, so the flip semantics are r
eversed. | 203 // The canvas is stored in an inverted position, so the flip semantics are r
eversed. |
| 204 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, !flipY); | 204 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, !flipY); |
| 205 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType); | 205 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FA
LSE : GL_TRUE); |
| 206 | 206 |
| 207 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); | 207 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); |
| 208 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); | 208 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); |
| 209 | 209 |
| 210 context->deleteTexture(sourceTexture); | 210 context->deleteTexture(sourceTexture); |
| 211 | 211 |
| 212 context->flush(); | 212 context->flush(); |
| 213 sharedContext->waitSyncPoint(context->insertSyncPoint()); | 213 sharedContext->waitSyncPoint(context->insertSyncPoint()); |
| 214 | 214 |
| 215 // Undo grContext texture binding changes introduced in this function | 215 // Undo grContext texture binding changes introduced in this function |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 376 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 377 | 377 |
| 378 Vector<char> encodedImage; | 378 Vector<char> encodedImage; |
| 379 if (!encodeImage(*this, mimeType, quality, &encodedImage)) | 379 if (!encodeImage(*this, mimeType, quality, &encodedImage)) |
| 380 return "data:,"; | 380 return "data:,"; |
| 381 | 381 |
| 382 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); | 382 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace blink | 385 } // namespace blink |
| OLD | NEW |