| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above shou
ld guarantee this | 196 ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above shou
ld guarantee this |
| 197 // Get the texture ID, flushing pending operations if needed. | 197 // Get the texture ID, flushing pending operations if needed. |
| 198 const GrGLTextureInfo* textureInfo = skia::GrBackendObjectToGrGLTextureInfo(
textureImage->getTextureHandle(true)); | 198 const GrGLTextureInfo* textureInfo = skia::GrBackendObjectToGrGLTextureInfo(
textureImage->getTextureHandle(true)); |
| 199 if (!textureInfo || !textureInfo->fID) | 199 if (!textureInfo || !textureInfo->fID) |
| 200 return false; | 200 return false; |
| 201 | 201 |
| 202 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); | 202 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); |
| 203 if (!provider) | 203 if (!provider) |
| 204 return false; | 204 return false; |
| 205 WebGraphicsContext3D* sharedContext = provider->context3d(); | 205 WebGraphicsContext3D* sharedContext = provider->context3d(); |
| 206 if (!sharedContext) | |
| 207 return false; | |
| 208 | 206 |
| 209 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM
ailbox); | 207 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM
ailbox); |
| 210 mailbox->textureSize = WebSize(textureImage->width(), textureImage->height()
); | 208 mailbox->textureSize = WebSize(textureImage->width(), textureImage->height()
); |
| 211 | 209 |
| 212 // Contexts may be in a different share group. We must transfer the texture
through a mailbox first | 210 // Contexts may be in a different share group. We must transfer the texture
through a mailbox first |
| 213 sharedContext->genMailboxCHROMIUM(mailbox->name); | 211 sharedContext->genMailboxCHROMIUM(mailbox->name); |
| 214 sharedContext->produceTextureDirectCHROMIUM(textureInfo->fID, textureInfo->f
Target, mailbox->name); | 212 sharedContext->produceTextureDirectCHROMIUM(textureInfo->fID, textureInfo->f
Target, mailbox->name); |
| 215 const WGC3Duint64 sharedFenceSync = sharedContext->insertFenceSyncCHROMIUM()
; | 213 const WGC3Duint64 sharedFenceSync = sharedContext->insertFenceSyncCHROMIUM()
; |
| 216 sharedContext->flush(); | 214 sharedContext->flush(); |
| 217 | 215 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 242 } | 240 } |
| 243 | 241 |
| 244 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) | 242 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu
ffer, SourceDrawingBuffer sourceBuffer) |
| 245 { | 243 { |
| 246 if (!drawingBuffer || !m_surface->isAccelerated()) | 244 if (!drawingBuffer || !m_surface->isAccelerated()) |
| 247 return false; | 245 return false; |
| 248 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); | 246 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current()
->createSharedOffscreenGraphicsContext3DProvider()); |
| 249 if (!provider) | 247 if (!provider) |
| 250 return false; | 248 return false; |
| 251 WebGraphicsContext3D* context3D = provider->context3d(); | 249 WebGraphicsContext3D* context3D = provider->context3d(); |
| 252 if (!context3D) | |
| 253 return false; | |
| 254 Platform3DObject textureId = m_surface->getBackingTextureHandleForOverwrite(
); | 250 Platform3DObject textureId = m_surface->getBackingTextureHandleForOverwrite(
); |
| 255 if (!textureId) | 251 if (!textureId) |
| 256 return false; | 252 return false; |
| 257 | 253 |
| 258 context3D->flush(); | 254 context3D->flush(); |
| 259 | 255 |
| 260 return drawingBuffer->copyToPlatformTexture(context3D, textureId, GL_RGBA, | 256 return drawingBuffer->copyToPlatformTexture(context3D, textureId, GL_RGBA, |
| 261 GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); | 257 GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); |
| 262 } | 258 } |
| 263 | 259 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 402 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
| 407 | 403 |
| 408 Vector<unsigned char> result; | 404 Vector<unsigned char> result; |
| 409 if (!encodeImage(mimeType, quality, &result)) | 405 if (!encodeImage(mimeType, quality, &result)) |
| 410 return "data:,"; | 406 return "data:,"; |
| 411 | 407 |
| 412 return "data:" + mimeType + ";base64," + base64Encode(result); | 408 return "data:" + mimeType + ";base64," + base64Encode(result); |
| 413 } | 409 } |
| 414 | 410 |
| 415 } // namespace blink | 411 } // namespace blink |
| OLD | NEW |