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

Side by Side Diff: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp

Issue 16220002: Use mailboxes for Canvas and WebGL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: flush Created 7 years, 6 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
« no previous file with comments | « Source/core/features.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0); 206 ASSERT(mailboxInfo->m_mailbox.syncPoint == 0);
207 ASSERT(mailboxInfo->m_image.get()); 207 ASSERT(mailboxInfo->m_image.get());
208 ASSERT(mailboxInfo->m_image->getTexture()); 208 ASSERT(mailboxInfo->m_image->getTexture());
209 209
210 // Because we are changing the texture binding without going through skia, 210 // Because we are changing the texture binding without going through skia,
211 // we must restore it to its previous value to keep skia's state cache in 211 // we must restore it to its previous value to keep skia's state cache in
212 // sync. 212 // sync.
213 GC3Dint savedTexBinding = 0; 213 GC3Dint savedTexBinding = 0;
214 m_context->getIntegerv(GraphicsContext3D::TEXTURE_BINDING_2D, &savedTexBindi ng); 214 m_context->getIntegerv(GraphicsContext3D::TEXTURE_BINDING_2D, &savedTexBindi ng);
215 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, mailboxInfo->m_image-> getTexture()->getTextureHandle()); 215 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, mailboxInfo->m_image-> getTexture()->getTextureHandle());
216 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
217 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
218 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
219 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
216 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, mailboxInfo ->m_mailbox.name); 220 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, mailboxInfo ->m_mailbox.name);
221 context()->flush();
217 mailboxInfo->m_mailbox.syncPoint = context()->insertSyncPoint(); 222 mailboxInfo->m_mailbox.syncPoint = context()->insertSyncPoint();
218 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, savedTexBinding); 223 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, savedTexBinding);
219 224
220 *outMailbox = mailboxInfo->m_mailbox; 225 *outMailbox = mailboxInfo->m_mailbox;
221 return true; 226 return true;
222 #else 227 #else
223 ASSERT_NOT_REACHED(); 228 ASSERT_NOT_REACHED();
224 return false; 229 return false;
225 #endif 230 #endif
226 } 231 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // This copy constructor should only be used for Vector reallocation 295 // This copy constructor should only be used for Vector reallocation
291 // Assuming 'other' is to be destroyed, we swap m_image ownership 296 // Assuming 'other' is to be destroyed, we swap m_image ownership
292 // rather than do a refcount dance. 297 // rather than do a refcount dance.
293 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 298 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
294 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image)); 299 m_image.swap(const_cast<SkAutoTUnref<SkImage>*>(&other.m_image));
295 m_status = other.m_status; 300 m_status = other.m_status;
296 } 301 }
297 #endif 302 #endif
298 303
299 } 304 }
OLDNEW
« no previous file with comments | « Source/core/features.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698