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

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

Issue 1195513002: Use SkImage snapshots for ImageBufferSurface texture access (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments Created 5 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 | Annotate | Revision Log
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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 Canvas2DLayerManager::get().layerDidDraw(this); 506 Canvas2DLayerManager::get().layerDidDraw(this);
507 } 507 }
508 508
509 void Canvas2DLayerBridge::finalizeFrame(const FloatRect &dirtyRect) 509 void Canvas2DLayerBridge::finalizeFrame(const FloatRect &dirtyRect)
510 { 510 {
511 ASSERT(!m_destructionInProgress); 511 ASSERT(!m_destructionInProgress);
512 m_layer->layer()->invalidateRect(enclosingIntRect(dirtyRect)); 512 m_layer->layer()->invalidateRect(enclosingIntRect(dirtyRect));
513 m_didRecordDrawCommand = true; 513 m_didRecordDrawCommand = true;
514 } 514 }
515 515
516 Platform3DObject Canvas2DLayerBridge::getBackingTexture() 516 PassRefPtr<SkImage> Canvas2DLayerBridge::getBackingTextureImage()
517 { 517 {
518 ASSERT(!m_destructionInProgress);
519 if (!checkSurfaceValid()) 518 if (!checkSurfaceValid())
520 return 0; 519 return nullptr;
521 m_canvas->flush(); 520
522 context()->flush(); 521 context()->flush();
523 GrRenderTarget* renderTarget = m_canvas->getDevice()->accessRenderTarget(); 522
524 if (renderTarget) { 523 return adoptRef(m_canvas->newImageSnapshot());
525 return renderTarget->asTexture()->getTextureHandle();
526 }
527 return 0;
528 } 524 }
529 525
530 PassRefPtr<SkImage> Canvas2DLayerBridge::newImageSnapshot() 526 PassRefPtr<SkImage> Canvas2DLayerBridge::newImageSnapshot()
531 { 527 {
532 return adoptRef(m_canvas->newImageSnapshot()); 528 return adoptRef(m_canvas->newImageSnapshot());
533 } 529 }
534 530
535 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { 531 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) {
536 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 532 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
537 m_image = other.m_image; 533 m_image = other.m_image;
538 m_parentLayerBridge = other.m_parentLayerBridge; 534 m_parentLayerBridge = other.m_parentLayerBridge;
539 } 535 }
540 536
541 } // namespace blink 537 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698