mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 13:00:05 +00:00 
			
		
		
		
	Remove unnecessary copy, and make callback argument const in geolines
This commit is contained in:
		
							parent
							
								
									087f6ef310
								
							
						
					
					
						commit
						fea9083f7d
					
				
					 3 changed files with 8 additions and 8 deletions
				
			
		|  | @ -494,7 +494,7 @@ void GeoLines::Impl::UpdateModifiedLineBuffers() | ||||||
|    for (auto& di : dirtyLines_) |    for (auto& di : dirtyLines_) | ||||||
|    { |    { | ||||||
|       // Check if modified line is in the current list
 |       // Check if modified line is in the current list
 | ||||||
|       if (currentLineList_.size() < di->lineIndex_ || |       if (di->lineIndex_ >= currentLineList_.size() || | ||||||
|           currentLineList_[di->lineIndex_] != di) |           currentLineList_[di->lineIndex_] != di) | ||||||
|       { |       { | ||||||
|          continue; |          continue; | ||||||
|  | @ -799,8 +799,7 @@ bool GeoLines::RunMousePicking( | ||||||
|       } |       } | ||||||
|       else if (it->second.di_->hoverCallback_ != nullptr) |       else if (it->second.di_->hoverCallback_ != nullptr) | ||||||
|       { |       { | ||||||
|          std::shared_ptr<GeoLineDrawItem> di = it->second.di_; |          it->second.di_->hoverCallback_(it->second.di_, mouseGlobalPos); | ||||||
|          it->second.di_->hoverCallback_(di, mouseGlobalPos); |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (it->second.di_->event_ != nullptr) |       if (it->second.di_->event_ != nullptr) | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ struct GeoLineDrawItem; | ||||||
| class GeoLines : public DrawItem | class GeoLines : public DrawItem | ||||||
| { | { | ||||||
| public: | public: | ||||||
|    typedef std::function<void(std::shared_ptr<GeoLineDrawItem>&, |    typedef std::function<void(const std::shared_ptr<GeoLineDrawItem>&, | ||||||
|                               const QPointF&)> |                               const QPointF&)> | ||||||
|       HoverCallback; |       HoverCallback; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -159,7 +159,8 @@ public: | ||||||
|    void ConnectSignals(); |    void ConnectSignals(); | ||||||
|    void HandleGeoLinesEvent(std::weak_ptr<gl::draw::GeoLineDrawItem>& di, |    void HandleGeoLinesEvent(std::weak_ptr<gl::draw::GeoLineDrawItem>& di, | ||||||
|                             QEvent*                                   ev); |                             QEvent*                                   ev); | ||||||
|    void HandleGeoLinesHover(std::shared_ptr<gl::draw::GeoLineDrawItem>& di, |    void | ||||||
|  |    HandleGeoLinesHover(const std::shared_ptr<gl::draw::GeoLineDrawItem>& di, | ||||||
|                        const QPointF& mouseGlobalPos); |                        const QPointF& mouseGlobalPos); | ||||||
|    void ScheduleRefresh(); |    void ScheduleRefresh(); | ||||||
| 
 | 
 | ||||||
|  | @ -720,7 +721,7 @@ void AlertLayer::Impl::HandleGeoLinesEvent( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void AlertLayer::Impl::HandleGeoLinesHover( | void AlertLayer::Impl::HandleGeoLinesHover( | ||||||
|    std::shared_ptr<gl::draw::GeoLineDrawItem>& di, |    const std::shared_ptr<gl::draw::GeoLineDrawItem>& di, | ||||||
|    const QPointF&                                    mouseGlobalPos) |    const QPointF&                                    mouseGlobalPos) | ||||||
| { | { | ||||||
|    if (di != lastHoverDi_) |    if (di != lastHoverDi_) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak