comparison view/View.cpp @ 1408:c8a6fd3f9dff fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:33:54 +0000
parents b0eeec95ab5b
children 2487521e857b
comparison
equal deleted inserted replaced
1407:05d614f6e46d 1408:c8a6fd3f9dff
60 m_followZoom(true), 60 m_followZoom(true),
61 m_followPlay(PlaybackScrollPageWithCentre), 61 m_followPlay(PlaybackScrollPageWithCentre),
62 m_followPlayIsDetached(false), 62 m_followPlayIsDetached(false),
63 m_playPointerFrame(0), 63 m_playPointerFrame(0),
64 m_showProgress(showProgress), 64 m_showProgress(showProgress),
65 m_cache(0), 65 m_cache(nullptr),
66 m_buffer(0), 66 m_buffer(nullptr),
67 m_cacheValid(false), 67 m_cacheValid(false),
68 m_cacheCentreFrame(0), 68 m_cacheCentreFrame(0),
69 m_cacheZoomLevel(ZoomLevel::FramesPerPixel, 1024), 69 m_cacheZoomLevel(ZoomLevel::FramesPerPixel, 1024),
70 m_selectionCached(false), 70 m_selectionCached(false),
71 m_deleting(false), 71 m_deleting(false),
72 m_haveSelectedLayer(false), 72 m_haveSelectedLayer(false),
73 m_manager(0), 73 m_manager(nullptr),
74 m_propertyContainer(new ViewPropertyContainer(this)) 74 m_propertyContainer(new ViewPropertyContainer(this))
75 { 75 {
76 // cerr << "View::View(" << this << ")" << endl; 76 // cerr << "View::View(" << this << ")" << endl;
77 } 77 }
78 78
262 return; 262 return;
263 } 263 }
264 264
265 m_cacheValid = false; 265 m_cacheValid = false;
266 266
267 Layer *selectedLayer = 0; 267 Layer *selectedLayer = nullptr;
268 268
269 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { 269 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) {
270 if (*i == pc) { 270 if (*i == pc) {
271 selectedLayer = *i; 271 selectedLayer = *i;
272 m_layerStack.erase(i); 272 m_layerStack.erase(i);
791 if (!(layer->isLayerDormant(this))) { 791 if (!(layer->isLayerDormant(this))) {
792 return layer; 792 return layer;
793 } 793 }
794 } 794 }
795 } 795 }
796 return 0; 796 return nullptr;
797 } 797 }
798 798
799 const Layer * 799 const Layer *
800 View::getInteractionLayer() const 800 View::getInteractionLayer() const
801 { 801 {
806 View::getSelectedLayer() 806 View::getSelectedLayer()
807 { 807 {
808 if (m_haveSelectedLayer && !m_layerStack.empty()) { 808 if (m_haveSelectedLayer && !m_layerStack.empty()) {
809 return getLayer(getLayerCount() - 1); 809 return getLayer(getLayerCount() - 1);
810 } else { 810 } else {
811 return 0; 811 return nullptr;
812 } 812 }
813 } 813 }
814 814
815 const Layer * 815 const Layer *
816 View::getSelectedLayer() const 816 View::getSelectedLayer() const
1347 View::getAligningModel() const 1347 View::getAligningModel() const
1348 { 1348 {
1349 if (!m_manager || 1349 if (!m_manager ||
1350 !m_manager->getAlignMode() || 1350 !m_manager->getAlignMode() ||
1351 !m_manager->getPlaybackModel()) { 1351 !m_manager->getPlaybackModel()) {
1352 return 0; 1352 return nullptr;
1353 } 1353 }
1354 1354
1355 Model *anyModel = 0; 1355 Model *anyModel = nullptr;
1356 Model *alignedModel = 0; 1356 Model *alignedModel = nullptr;
1357 Model *goodModel = 0; 1357 Model *goodModel = nullptr;
1358 1358
1359 for (LayerList::const_iterator i = m_layerStack.begin(); 1359 for (LayerList::const_iterator i = m_layerStack.begin();
1360 i != m_layerStack.end(); ++i) { 1360 i != m_layerStack.end(); ++i) {
1361 1361
1362 Layer *layer = *i; 1362 Layer *layer = *i;
2020 int dx = dpratio * (getXForFrame(m_cacheCentreFrame) - 2020 int dx = dpratio * (getXForFrame(m_cacheCentreFrame) -
2021 getXForFrame(m_centreFrame)); 2021 getXForFrame(m_centreFrame));
2022 2022
2023 if (dx > -m_cache->width() && dx < m_cache->width()) { 2023 if (dx > -m_cache->width() && dx < m_cache->width()) {
2024 2024
2025 m_cache->scroll(dx, 0, m_cache->rect(), 0); 2025 m_cache->scroll(dx, 0, m_cache->rect(), nullptr);
2026 2026
2027 if (dx < 0) { 2027 if (dx < 0) {
2028 cacheAreaToRepaint = 2028 cacheAreaToRepaint =
2029 QRect(m_cache->width() + dx, 0, -dx, m_cache->height()); 2029 QRect(m_cache->width() + dx, 0, -dx, m_cache->height());
2030 } else { 2030 } else {
2721 2721
2722 QPainter *paint = new QPainter(image); 2722 QPainter *paint = new QPainter(image);
2723 if (!render(*paint, 0, f0, f1)) { 2723 if (!render(*paint, 0, f0, f1)) {
2724 delete paint; 2724 delete paint;
2725 delete image; 2725 delete image;
2726 return 0; 2726 return nullptr;
2727 } else { 2727 } else {
2728 delete paint; 2728 delete paint;
2729 return image; 2729 return image;
2730 } 2730 }
2731 } 2731 }