Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Folded sync_point into sync_tokens Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 380 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
377 381
378 Vector<char> encodedImage; 382 Vector<char> encodedImage;
379 if (!encodeImage(mimeType, quality, &encodedImage)) 383 if (!encodeImage(mimeType, quality, &encodedImage))
380 return "data:,"; 384 return "data:,";
381 385
382 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); 386 return "data:" + mimeType + ";base64," + base64Encode(encodedImage);
383 } 387 }
384 388
385 } // namespace blink 389 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698