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

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

Issue 1812363002: Remove genSyncTokenCHROMIUM from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simples-tplus
Patch Set: gensynctoken: rebase Created 4 years, 9 months 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above shou ld guarantee this 197 ASSERT(textureImage->isTextureBacked()); // isAccelerated() check above shou ld guarantee this
198 // Get the texture ID, flushing pending operations if needed. 198 // Get the texture ID, flushing pending operations if needed.
199 const GrGLTextureInfo* textureInfo = skia::GrBackendObjectToGrGLTextureInfo( textureImage->getTextureHandle(true)); 199 const GrGLTextureInfo* textureInfo = skia::GrBackendObjectToGrGLTextureInfo( textureImage->getTextureHandle(true));
200 if (!textureInfo || !textureInfo->fID) 200 if (!textureInfo || !textureInfo->fID)
201 return false; 201 return false;
202 202
203 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current() ->createSharedOffscreenGraphicsContext3DProvider()); 203 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current() ->createSharedOffscreenGraphicsContext3DProvider());
204 if (!provider) 204 if (!provider)
205 return false; 205 return false;
206 WebGraphicsContext3D* sharedContext = provider->context3d();
207 gpu::gles2::GLES2Interface* sharedGL = provider->contextGL(); 206 gpu::gles2::GLES2Interface* sharedGL = provider->contextGL();
208 207
209 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM ailbox); 208 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM ailbox);
210 mailbox->textureSize = WebSize(textureImage->width(), textureImage->height() ); 209 mailbox->textureSize = WebSize(textureImage->width(), textureImage->height() );
211 210
212 // Contexts may be in a different share group. We must transfer the texture through a mailbox first 211 // Contexts may be in a different share group. We must transfer the texture through a mailbox first
213 sharedGL->GenMailboxCHROMIUM(mailbox->name); 212 sharedGL->GenMailboxCHROMIUM(mailbox->name);
214 sharedGL->ProduceTextureDirectCHROMIUM(textureInfo->fID, textureInfo->fTarge t, mailbox->name); 213 sharedGL->ProduceTextureDirectCHROMIUM(textureInfo->fID, textureInfo->fTarge t, mailbox->name);
215 const GLuint64 sharedFenceSync = sharedGL->InsertFenceSyncCHROMIUM(); 214 const GLuint64 sharedFenceSync = sharedGL->InsertFenceSyncCHROMIUM();
216 sharedGL->Flush(); 215 sharedGL->Flush();
217 216
218 mailbox->validSyncToken = sharedContext->genSyncTokenCHROMIUM(sharedFenceSyn c, mailbox->syncToken); 217 sharedGL->GenSyncTokenCHROMIUM(sharedFenceSync, mailbox->syncToken);
219 if (mailbox->validSyncToken) 218 mailbox->validSyncToken = true;
220 gl->WaitSyncTokenCHROMIUM(mailbox->syncToken); 219 gl->WaitSyncTokenCHROMIUM(mailbox->syncToken);
221 220
222 Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(texture Info->fTarget, mailbox->name); 221 Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(texture Info->fTarget, mailbox->name);
223 222
224 // 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.
225 // 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.
226 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, fl ipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FALSE : GL_TRUE); 225 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, fl ipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FALSE : GL_TRUE);
227 226
228 context->deleteTexture(sourceTexture); 227 context->deleteTexture(sourceTexture);
229 228
230 const GLuint64 contextFenceSync = gl->InsertFenceSyncCHROMIUM(); 229 const GLuint64 contextFenceSync = gl->InsertFenceSyncCHROMIUM();
231 230
232 gl->Flush(); 231 gl->Flush();
233 232
234 WGC3Dbyte syncToken[24]; 233 WGC3Dbyte syncToken[24];
235 if (context->genSyncTokenCHROMIUM(contextFenceSync, syncToken)) 234 gl->GenSyncTokenCHROMIUM(contextFenceSync, syncToken);
236 sharedGL->WaitSyncTokenCHROMIUM(syncToken); 235 sharedGL->WaitSyncTokenCHROMIUM(syncToken);
237 236
238 // Undo grContext texture binding changes introduced in this function 237 // Undo grContext texture binding changes introduced in this function
239 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); 238 provider->grContext()->resetContext(kTextureBinding_GrGLBackendState);
240 239
241 return true; 240 return true;
242 } 241 }
243 242
244 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu ffer, SourceDrawingBuffer sourceBuffer) 243 bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu ffer, SourceDrawingBuffer sourceBuffer)
245 { 244 {
246 if (!drawingBuffer || !m_surface->isAccelerated()) 245 if (!drawingBuffer || !m_surface->isAccelerated())
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 404 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
406 405
407 Vector<unsigned char> result; 406 Vector<unsigned char> result;
408 if (!encodeImage(mimeType, quality, &result)) 407 if (!encodeImage(mimeType, quality, &result))
409 return "data:,"; 408 return "data:,";
410 409
411 return "data:" + mimeType + ";base64," + base64Encode(result); 410 return "data:" + mimeType + ";base64," + base64Encode(result);
412 } 411 }
413 412
414 } // namespace blink 413 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698