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

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

Issue 1173973003: getTopDevice is deprecated (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « no previous file | Source/platform/graphics/ImageBufferSurface.cpp » ('j') | 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return false; 323 return false;
324 ASSERT(m_layer && !m_isSurfaceValid); 324 ASSERT(m_layer && !m_isSurfaceValid);
325 325
326 WebGraphicsContext3D* sharedContext = 0; 326 WebGraphicsContext3D* sharedContext = 0;
327 m_layer->clearTexture(); 327 m_layer->clearTexture();
328 m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraph icsContext3DProvider()); 328 m_contextProvider = adoptPtr(Platform::current()->createSharedOffscreenGraph icsContext3DProvider());
329 if (m_contextProvider) 329 if (m_contextProvider)
330 sharedContext = m_contextProvider->context3d(); 330 sharedContext = m_contextProvider->context3d();
331 331
332 if (sharedContext && !sharedContext->isContextLost()) { 332 if (sharedContext && !sharedContext->isContextLost()) {
333 IntSize size(m_canvas->getTopDevice()->width(), m_canvas->getTopDevice() ->height()); 333 SkISize skSize = m_canvas->getBaseLayerSize();
334 IntSize size(skSize.width(), skSize.height());
334 RefPtr<SkSurface> surface(createSkSurface(m_contextProvider->grContext() , size, m_msaaSampleCount, m_opacityMode)); 335 RefPtr<SkSurface> surface(createSkSurface(m_contextProvider->grContext() , size, m_msaaSampleCount, m_opacityMode));
335 if (surface.get()) { 336 if (surface.get()) {
336 m_surface = surface.release(); 337 m_surface = surface.release();
337 m_canvas->setSurface(m_surface.get()); 338 m_canvas->setSurface(m_surface.get());
338 m_isSurfaceValid = true; 339 m_isSurfaceValid = true;
339 // FIXME: draw sad canvas picture into new buffer crbug.com/243842 340 // FIXME: draw sad canvas picture into new buffer crbug.com/243842
340 } 341 }
341 } 342 }
342 343
343 return m_isSurfaceValid; 344 return m_isSurfaceValid;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 m_didRecordDrawCommand = true; 513 m_didRecordDrawCommand = true;
513 } 514 }
514 515
515 Platform3DObject Canvas2DLayerBridge::getBackingTexture() 516 Platform3DObject Canvas2DLayerBridge::getBackingTexture()
516 { 517 {
517 ASSERT(!m_destructionInProgress); 518 ASSERT(!m_destructionInProgress);
518 if (!checkSurfaceValid()) 519 if (!checkSurfaceValid())
519 return 0; 520 return 0;
520 m_canvas->flush(); 521 m_canvas->flush();
521 context()->flush(); 522 context()->flush();
522 GrRenderTarget* renderTarget = m_canvas->getTopDevice()->accessRenderTarget( ); 523 GrRenderTarget* renderTarget = m_canvas->getDevice()->accessRenderTarget();
f(malita) 2015/06/10 22:14:21 Are these really interchangeable? IIUC getDevice(
Justin Novosad 2015/06/12 16:11:48 2D canvas never uses saveLayer, So I think this is
523 if (renderTarget) { 524 if (renderTarget) {
524 return renderTarget->asTexture()->getTextureHandle(); 525 return renderTarget->asTexture()->getTextureHandle();
525 } 526 }
526 return 0; 527 return 0;
527 } 528 }
528 529
529 PassRefPtr<SkImage> Canvas2DLayerBridge::newImageSnapshot() 530 PassRefPtr<SkImage> Canvas2DLayerBridge::newImageSnapshot()
530 { 531 {
531 return adoptRef(m_canvas->newImageSnapshot()); 532 return adoptRef(m_canvas->newImageSnapshot());
532 } 533 }
533 534
534 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { 535 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) {
535 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); 536 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox));
536 m_image = other.m_image; 537 m_image = other.m_image;
537 m_parentLayerBridge = other.m_parentLayerBridge; 538 m_parentLayerBridge = other.m_parentLayerBridge;
538 } 539 }
539 540
540 } // namespace blink 541 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/ImageBufferSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698