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

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

Issue 481433002: gpu: Remove WebGraphicsContext3D::makeContextCurrent() in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to ToT Created 6 years, 3 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (!m_surface->isAccelerated() || !platformLayer() || !isSurfaceValid()) 173 if (!m_surface->isAccelerated() || !platformLayer() || !isSurfaceValid())
174 return false; 174 return false;
175 175
176 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel)) 176 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel))
177 return false; 177 return false;
178 178
179 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current() ->createSharedOffscreenGraphicsContext3DProvider()); 179 OwnPtr<WebGraphicsContext3DProvider> provider = adoptPtr(Platform::current() ->createSharedOffscreenGraphicsContext3DProvider());
180 if (!provider) 180 if (!provider)
181 return false; 181 return false;
182 WebGraphicsContext3D* sharedContext = provider->context3d(); 182 WebGraphicsContext3D* sharedContext = provider->context3d();
183 if (!sharedContext || !sharedContext->makeContextCurrent()) 183 if (!sharedContext)
184 return false; 184 return false;
185 185
186 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM ailbox); 186 OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureM ailbox);
187 187
188 // Contexts may be in a different share group. We must transfer the texture through a mailbox first 188 // Contexts may be in a different share group. We must transfer the texture through a mailbox first
189 sharedContext->genMailboxCHROMIUM(mailbox->name); 189 sharedContext->genMailboxCHROMIUM(mailbox->name);
190 sharedContext->produceTextureDirectCHROMIUM(getBackingTexture(), GL_TEXTURE_ 2D, mailbox->name); 190 sharedContext->produceTextureDirectCHROMIUM(getBackingTexture(), GL_TEXTURE_ 2D, mailbox->name);
191 sharedContext->flush(); 191 sharedContext->flush();
192 192
193 mailbox->syncPoint = sharedContext->insertSyncPoint(); 193 mailbox->syncPoint = sharedContext->insertSyncPoint();
194 194
195 if (!context->makeContextCurrent())
196 return false;
197
198 context->waitSyncPoint(mailbox->syncPoint); 195 context->waitSyncPoint(mailbox->syncPoint);
199 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL _TEXTURE_2D, mailbox->name); 196 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL _TEXTURE_2D, mailbox->name);
200 197
201 // The canvas is stored in a premultiplied format, so unpremultiply if neces sary. 198 // The canvas is stored in a premultiplied format, so unpremultiply if neces sary.
202 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyA lpha); 199 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyA lpha);
203 200
204 // The canvas is stored in an inverted position, so the flip semantics are r eversed. 201 // The canvas is stored in an inverted position, so the flip semantics are r eversed.
205 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, !flipY); 202 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, !flipY);
206 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType); 203 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType);
207 204
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) 431 if (!encodeImage(imageData, mimeType, quality, &encodedImage))
435 return "data:,"; 432 return "data:,";
436 433
437 Vector<char> base64Data; 434 Vector<char> base64Data;
438 base64Encode(encodedImage, base64Data); 435 base64Encode(encodedImage, base64Data);
439 436
440 return "data:" + mimeType + ";base64," + base64Data; 437 return "data:" + mimeType + ";base64," + base64Data;
441 } 438 }
442 439
443 } // namespace blink 440 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/Canvas2DLayerBridge.cpp ('k') | Source/platform/graphics/gpu/DrawingBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698