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

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

Issue 1823133002: Use sk_sp-based picture recording APIs in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 8 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) 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 ASSERT(!m_haveRecordedDrawCommands); 656 ASSERT(!m_haveRecordedDrawCommands);
657 // call write pixels on the surface, not the recording canvas. 657 // call write pixels on the surface, not the recording canvas.
658 // No need to call beginDirectSurfaceAccessModeIfNeeded() because writePixel s 658 // No need to call beginDirectSurfaceAccessModeIfNeeded() because writePixel s
659 // ignores the matrix and clip state. 659 // ignores the matrix and clip state.
660 return getOrCreateSurface()->getCanvas()->writePixels(origInfo, pixels, rowB ytes, x, y); 660 return getOrCreateSurface()->getCanvas()->writePixels(origInfo, pixels, rowB ytes, x, y);
661 } 661 }
662 662
663 void Canvas2DLayerBridge::skipQueuedDrawCommands() 663 void Canvas2DLayerBridge::skipQueuedDrawCommands()
664 { 664 {
665 if (m_haveRecordedDrawCommands) { 665 if (m_haveRecordedDrawCommands) {
666 adoptRef(m_recorder->endRecording()); 666 m_recorder->finishRecordingAsPicture();
667 startRecording(); 667 startRecording();
668 m_haveRecordedDrawCommands = false; 668 m_haveRecordedDrawCommands = false;
669 } 669 }
670 670
671 if (m_isDeferralEnabled) { 671 if (m_isDeferralEnabled) {
672 unregisterTaskObserver(); 672 unregisterTaskObserver();
673 if (m_rateLimiter) 673 if (m_rateLimiter)
674 m_rateLimiter->reset(); 674 m_rateLimiter->reset();
675 } 675 }
676 } 676 }
677 677
678 void Canvas2DLayerBridge::flushRecordingOnly() 678 void Canvas2DLayerBridge::flushRecordingOnly()
679 { 679 {
680 ASSERT(!m_destructionInProgress); 680 ASSERT(!m_destructionInProgress);
681 681
682 if (m_haveRecordedDrawCommands && getOrCreateSurface()) { 682 if (m_haveRecordedDrawCommands && getOrCreateSurface()) {
683 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushRecordingOnly"); 683 TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushRecordingOnly");
684 RefPtr<SkPicture> picture = adoptRef(m_recorder->endRecording()); 684 m_recorder->finishRecordingAsPicture()->playback(getOrCreateSurface()->g etCanvas());
685 picture->playback(getOrCreateSurface()->getCanvas());
686 if (m_isDeferralEnabled) 685 if (m_isDeferralEnabled)
687 startRecording(); 686 startRecording();
688 m_haveRecordedDrawCommands = false; 687 m_haveRecordedDrawCommands = false;
689 } 688 }
690 } 689 }
691 690
692 void Canvas2DLayerBridge::flush() 691 void Canvas2DLayerBridge::flush()
693 { 692 {
694 if (!getOrCreateSurface()) 693 if (!getOrCreateSurface())
695 return; 694 return;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 #endif // USE_IOSURFACE_FOR_2D_CANVAS 1000 #endif // USE_IOSURFACE_FOR_2D_CANVAS
1002 } 1001 }
1003 1002
1004 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 1003 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
1005 { 1004 {
1006 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); 1005 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount));
1007 hibernationHistogram.count(event); 1006 hibernationHistogram.count(event);
1008 } 1007 }
1009 1008
1010 } // namespace blink 1009 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698