mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-01 18:50:16 +03:00
Fix driver-dependent patterned border rasterization
Snap dotted and dashed border geometry to physical pixels so centered patterns cannot begin on ambiguous half-pixel coordinates. This makes rectangular dot placement deterministic across llvmpipe and macOS GPU drivers. Update the old Reddit golden image to use the snapped dot phase. Optimize compile-time header dependencies - Extract lightweight singleton declarations. - Remove unnecessary core.hpp, stream, pack, and container includes. - Add explicit direct dependencies across system, network, graphics, and syntax headers. - Forward-declare stream and pack types where possible. - Normalize selected network headers to LF.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <eepp/core/debug.hpp>
|
||||
#include <eepp/graphics/textureatlas.hpp>
|
||||
#include <eepp/system/lock.hpp>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <eepp/core/debug.hpp>
|
||||
#include <eepp/graphics/texturepackernode.hpp>
|
||||
|
||||
namespace EE { namespace Graphics { namespace Private {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <eepp/core/debug.hpp>
|
||||
#include <eepp/network/uri.hpp>
|
||||
#include <eepp/system/sys.hpp>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <algorithm>
|
||||
#include <eepp/core/memorymanager.hpp>
|
||||
#include <eepp/system/threadpool.hpp>
|
||||
|
||||
namespace EE { namespace System {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <eepp/core/string.hpp>
|
||||
#include <eepp/system/virtualfilesystem.hpp>
|
||||
|
||||
namespace EE { namespace System {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <eepp/system/log.hpp>
|
||||
#include <eepp/system/luapattern.hpp>
|
||||
#include <eepp/system/packregistry.hpp>
|
||||
#include <eepp/system/singleton.hpp>
|
||||
#include <eepp/ui/doc/hextlanguagetype.hpp>
|
||||
#include <eepp/ui/doc/languages/c.hpp>
|
||||
#include <eepp/ui/doc/languages/configfile.hpp>
|
||||
#include <eepp/ui/doc/languages/cpp.hpp>
|
||||
|
||||
@@ -73,23 +73,34 @@ void UIBorderDrawable::draw( const Vector2f& position, const Sizef& size ) {
|
||||
if ( border.width <= 0 ||
|
||||
( border.style != BorderStyle::Dotted && border.style != BorderStyle::Dashed ) )
|
||||
return;
|
||||
// These are axis-aligned physical-pixel primitives. A centered odd-width pattern on an
|
||||
// even-length side otherwise starts at a half pixel, whose coverage is
|
||||
// driver-dependent. Snap the side bounds and choose the lower integer for an
|
||||
// unavoidable asymmetric remainder so every backend rasterizes the same pixels.
|
||||
const Float snappedStart = std::round( start );
|
||||
const Float snappedLimit = std::round( start + length );
|
||||
const Float snappedFixed = std::round( fixed );
|
||||
const Float snappedLength = snappedLimit - snappedStart;
|
||||
const Float segment =
|
||||
border.style == BorderStyle::Dotted ? border.width : border.width * 3.f;
|
||||
const Float step = segment * 2.f;
|
||||
if ( segment <= 0.f || length <= 0.f )
|
||||
if ( segment <= 0.f || snappedLength <= 0.f )
|
||||
return;
|
||||
const Uint32 count =
|
||||
eemax<Uint32>( 1, static_cast<Uint32>( std::ceil( length / step ) ) );
|
||||
eemax<Uint32>( 1, static_cast<Uint32>( std::ceil( snappedLength / step ) ) );
|
||||
const Float used = ( count - 1 ) * step + segment;
|
||||
Float cursor = start + eemax( 0.f, ( length - used ) * 0.5f );
|
||||
Float cursor =
|
||||
std::floor( snappedStart + eemax( 0.f, ( snappedLength - used ) * 0.5f ) );
|
||||
Primitives primitive;
|
||||
primitive.setColor( border.color );
|
||||
for ( Uint32 i = 0; i < count && cursor < start + length; ++i, cursor += step ) {
|
||||
const Float end = eemin( cursor + segment, start + length );
|
||||
for ( Uint32 i = 0; i < count && cursor < snappedLimit; ++i, cursor += step ) {
|
||||
const Float end = eemin( cursor + segment, snappedLimit );
|
||||
if ( horizontal ) {
|
||||
primitive.drawRectangle( Rectf( cursor, fixed, end, fixed + border.width ) );
|
||||
primitive.drawRectangle(
|
||||
Rectf( cursor, snappedFixed, end, snappedFixed + border.width ) );
|
||||
} else {
|
||||
primitive.drawRectangle( Rectf( fixed, cursor, fixed + border.width, end ) );
|
||||
primitive.drawRectangle(
|
||||
Rectf( snappedFixed, cursor, snappedFixed + border.width, end ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef EE_WINDOWCBACKEND_HPP
|
||||
#define EE_WINDOWCBACKEND_HPP
|
||||
|
||||
#include <eepp/core.hpp>
|
||||
#include <eepp/config.hpp>
|
||||
|
||||
namespace EE { namespace Window { namespace Backend {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user