fix bug that line alorithm wrongly draws a line when fade_rate is zero
This commit is contained in:
		
							parent
							
								
									1f8f991103
								
							
						
					
					
						commit
						bed829fa26
					
				@ -2002,7 +2002,7 @@ namespace nana {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				auto fgcolor = scheme_->foreground.get_color();
 | 
									auto fgcolor = scheme_->foreground.get_color();
 | 
				
			||||||
				if (!API::window_enabled(window_))
 | 
									if (!API::window_enabled(window_))
 | 
				
			||||||
					fgcolor.blend(bgcolor, 0.5); // do nothing !!! should be replace with <code> fgcolor = fgcolor.blend(bgcolor, 0.5); <\code> or removed
 | 
										fgcolor = fgcolor.blend(bgcolor, 0.5); //Thank to besh81 for getting the fgcolor to be changed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (API::widget_borderless(window_))
 | 
									if (API::widget_borderless(window_))
 | 
				
			||||||
					graph_.rectangle(false, bgcolor);
 | 
										graph_.rectangle(false, bgcolor);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
#include <nana/push_ignore_diagnostic>
 | 
					#include <nana/push_ignore_diagnostic>
 | 
				
			||||||
#include <nana/paint/detail/image_process_provider.hpp>
 | 
					#include <nana/paint/detail/image_process_provider.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <nana/paint/detail/image_processor.hpp>
 | 
					#include "image_processor.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nana
 | 
					namespace nana
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 *	Image Processor Algorithm Implementation
 | 
					 *	Image Processor Algorithm Implementation
 | 
				
			||||||
 *	Nana C++ Library(http://www.nanapro.org)
 | 
					 *	Nana C++ Library(http://www.nanapro.org)
 | 
				
			||||||
 *	Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
 | 
					 *	Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *	Distributed under the Boost Software License, Version 1.0.
 | 
					 *	Distributed under the Boost Software License, Version 1.0.
 | 
				
			||||||
 *	(See accompanying file LICENSE_1_0.txt or copy at
 | 
					 *	(See accompanying file LICENSE_1_0.txt or copy at
 | 
				
			||||||
@ -15,8 +15,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifndef NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP
 | 
					#ifndef NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP
 | 
				
			||||||
#define NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP
 | 
					#define NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP
 | 
				
			||||||
#include "../image_process_interface.hpp"
 | 
					 | 
				
			||||||
#include <nana/paint/pixel_buffer.hpp>
 | 
					#include <nana/paint/pixel_buffer.hpp>
 | 
				
			||||||
 | 
					#include <nana/paint/image_process_interface.hpp>
 | 
				
			||||||
#include <nana/paint/detail/native_paint_interface.hpp>
 | 
					#include <nana/paint/detail/native_paint_interface.hpp>
 | 
				
			||||||
#include <algorithm>
 | 
					#include <algorithm>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -421,15 +421,19 @@ namespace detail
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			virtual void process(paint::pixel_buffer & pixbuf, const nana::point& pos_beg, const nana::point& pos_end, const ::nana::color& clr, double fade_rate) const
 | 
								virtual void process(paint::pixel_buffer & pixbuf, const nana::point& pos_beg, const nana::point& pos_end, const ::nana::color& clr, double fade_rate) const
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									//Return if it is completely transparent
 | 
				
			||||||
 | 
									if (fade_rate <= 0)
 | 
				
			||||||
 | 
										return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				auto rgb_color = clr.px_color().value;
 | 
									auto rgb_color = clr.px_color().value;
 | 
				
			||||||
				const std::size_t bytes_pl = pixbuf.bytes_per_line();
 | 
									const std::size_t bytes_pl = pixbuf.bytes_per_line();
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				unsigned char * fade_table = nullptr;
 | 
									unsigned char * fade_table = nullptr;
 | 
				
			||||||
				std::unique_ptr<unsigned char[]> autoptr;
 | 
									std::unique_ptr<unsigned char[]> autoptr;
 | 
				
			||||||
				nana::pixel_argb_t rgb_imd = {};
 | 
									nana::pixel_argb_t rgb_imd = {};
 | 
				
			||||||
				if(fade_rate != 0.0)
 | 
									if(fade_rate < 1)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					autoptr = detail::alloc_fade_table(1 - fade_rate);
 | 
										autoptr = detail::alloc_fade_table(1.0 - fade_rate);
 | 
				
			||||||
					fade_table = autoptr.get();
 | 
										fade_table = autoptr.get();
 | 
				
			||||||
					rgb_imd.value = rgb_color;
 | 
										rgb_imd.value = rgb_color;
 | 
				
			||||||
					rgb_imd = detail::fade_color_intermedia(rgb_imd, fade_table);
 | 
										rgb_imd = detail::fade_color_intermedia(rgb_imd, fade_table);
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user