Skip to content

Commit

Permalink
minimal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ariccio committed Jan 12, 2015
1 parent a1a4921 commit 7de33be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 41 deletions.
3 changes: 2 additions & 1 deletion WinDirStat/windirstat/SelectDrivesDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ class CDriveInformationThread final : public CWinThread {
const LPARAM m_driveItem; // The list item, we belong to
std::atomic<HWND> m_dialog;
const UINT m_serial; // serial number of m_dialog
const rsize_t m_threadNum;
// "[out]"-parameters
std::atomic<std::wstring> m_name; // Result: name like "BOOT (C:)", valid if m_success
std::atomic<std::uint64_t> m_totalBytes; // Result: capacity of the drive, valid if m_success
std::atomic<std::uint64_t> m_freeBytes; // Result: free space on the drive, valid if m_success
std::atomic<bool> m_success; // Result: false, iff drive is unaccessible.
const rsize_t m_threadNum;

};

class CDrivesList final : public COwnerDrawnListCtrl {
Expand Down
33 changes: 0 additions & 33 deletions WinDirStat/windirstat/treemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,14 @@ namespace {
inline const double pixel_scale_factor( _In_ const std::uint64_t& remainingSize, _In_ const CRect& remaining ) {
ASSERT( remaining.Width( ) != 0 );
ASSERT( remaining.Height( ) != 0 );
//const double sizePerSquarePixel_scaleFactor = ( double ) remainingSize / remaining.Width( ) / remaining.Height( );
return ( ( double ) remainingSize / remaining.Width( ) / remaining.Height( ) );
}

inline const bool is_horizontal( _In_ const CRect& remaining ) {
//const bool horizontal = ( remaining.Width( ) >= remaining.Height( ) );
return ( remaining.Width( ) >= remaining.Height( ) );
}

inline const double gen_ss( const std::uint64_t& sumOfSizesOfChildrenInRow, const std::uint64_t& rmin ) {
//const double ss = ( ( double ) sumOfSizesOfChildrenInRow + rmin ) * ( ( double ) sumOfSizesOfChildrenInRow + rmin );
return ( ( ( double ) sumOfSizesOfChildrenInRow + rmin ) * ( ( double ) sumOfSizesOfChildrenInRow + rmin ) );
}

Expand All @@ -71,9 +68,6 @@ namespace {
const double ss = gen_ss( sumOfSizesOfChildrenInRow, rmin );
const double ratio1 = hh * maximumSizeOfChildrenInRow / ss;
const double ratio2 = ss / hh / rmin;

//const double& hh, const size_t& maximumSizeOfChildrenInRow, const double& ss, const size_t& rmin, const std::uint64_t sumOfSizesOfChildrenInRow )

return gen_nextworst( ratio1, ratio2 );
}

Expand Down Expand Up @@ -381,16 +375,13 @@ namespace {
//Not vectorized: 1200, data dependence
for ( auto ix = loop_rect_start_inner; ix < loop_rect__end__inner; ix++ ) {
const size_t indexAdjusted = ( index_of_this_row_0_in_array + ix );
//const auto nx = -( 2.00 * surface[ 0 ] * ( ix + 0.5 ) + surface[ 2 ] );
//const auto ny = -( 2.00 * surface[ 1 ] * ( iy + 0.5 ) + surface[ 3 ] );

sqrt_array[ indexAdjusted ] =
sqrt(
nx_array[ indexAdjusted ] * nx_array[ indexAdjusted ] +
ny_array[ indexAdjusted ] * ny_array[ indexAdjusted ] +
1.0
);
//cosa_array[ ( indexAdjusted ) ] = ( nx*m_Lx + ny*m_Ly + m_Lz ) / sqrt_val;
}
}
}
Expand All @@ -402,9 +393,6 @@ namespace {
//Not vectorized: 1200, data dependence
for ( auto ix = loop_rect_start_inner; ix < loop_rect__end__inner; ix++ ) {
const size_t indexAdjusted = ( index_of_this_row_0_in_array + ix );
//const auto nx = -( 2.00 * surface[ 0 ] * ( ix + 0.5 ) + surface[ 2 ] );
//const auto ny = -( 2.00 * surface[ 1 ] * ( iy + 0.5 ) + surface[ 3 ] );
//sqrt_array[ indexAdjusted ] = sqrt( nx_array[ ( indexAdjusted ) ] * nx_array[ ( indexAdjusted ) ] + ny_array[ ( indexAdjusted ) ] * ny_array[ ( indexAdjusted ) ] +1.0 );

cosa_array[ indexAdjusted ] =
(
Expand Down Expand Up @@ -628,7 +616,6 @@ void CTreemap::RecurseCheckTree( _In_ const CItemBranch* const item ) const {
return;
}

//if ( item->m_type == IT_FILE ) {
if ( item->m_children == nullptr ) {
//item doesn't have children, nothing to check
ASSERT( item->m_childCount == 0 );
Expand All @@ -638,12 +625,8 @@ void CTreemap::RecurseCheckTree( _In_ const CItemBranch* const item ) const {
const auto item_vector_of_children = item->size_sorted_vector_of_children( );

for ( size_t i = 0; i < item->m_childCount; i++ ) {
//const auto child = item->GetChildGuaranteedValid( i );
const auto child = static_cast< CItemBranch* >( item_vector_of_children.at( i ) );
validateRectangle( child, item->TmiGetRectangle( ) );
//if ( i > 0 ) {
// auto child_2 = item->TmiGetChild( i - 1 );
// }
RecurseCheckTree( child );
}
}
Expand Down Expand Up @@ -792,7 +775,6 @@ _Success_( return != NULL ) _Ret_maybenull_ _Must_inspect_result_ CItemBranch* C

auto gridWidth = m_options.grid ? 1 : 0;

//if ( ( ( rc.Width( ) ) <= gridWidth ) || ( ( rc.Height( ) ) <= gridWidth ) || ( item->m_type == IT_FILE ) ) {
if ( ( ( rc.Width( ) ) <= gridWidth ) || ( ( rc.Height( ) ) <= gridWidth ) || ( item->m_children == nullptr ) ) {
return const_cast<CItemBranch*>( item );
}
Expand Down Expand Up @@ -840,7 +822,6 @@ void CTreemap::DrawColorPreview( _In_ CDC& pdc, _In_ const CRect& rc, _In_ const

void CTreemap::RecurseDrawGraph( _In_ CDC& offscreen_buffer, _In_ const CItemBranch* const item, _In_ const CRect& rc, _In_ const bool asroot, _In_ const DOUBLE ( &psurface )[ 4 ], _In_ const DOUBLE height ) const {
ASSERT( item != NULL );
//if ( item->m_type == IT_FILE ) {
if ( item->m_children == nullptr ) {
if ( !( item->size_recurse( ) > 0 ) ) {
return;
Expand Down Expand Up @@ -868,7 +849,6 @@ void CTreemap::RecurseDrawGraph( _In_ CDC& offscreen_buffer, _In_ const CItemBra
validateRectangle( item, rc );
}
}
//if ( item->m_type == IT_FILE ) {
if ( item->m_children == nullptr ) {
RenderLeaf( offscreen_buffer, item, surface );
}
Expand Down Expand Up @@ -899,7 +879,6 @@ bool CTreemap::KDS_PlaceChildren( _In_ const CItemBranch* const parent, _Inout_
/*
return: whether the rows are horizontal.
*/
//ASSERT( !( parent->m_type == IT_FILE ) );
ASSERT( !( parent->m_children == nullptr ) );

ASSERT( parent->m_childCount > 0 );
Expand Down Expand Up @@ -1337,14 +1316,11 @@ void CTreemap::RenderLeaf( _In_ CDC& offscreen_buffer, _In_ const CItemBranch* c
}
}
rc.NormalizeRect( );
//auto colorOfItem = item->GetGraphColor( );
COLORREF colorOfItem;
//if ( item->m_type == IT_FILE ) {
if ( item->m_children == nullptr ) {
colorOfItem = GetDocument( )->GetCushionColor( item->CStyle_GetExtensionStrPtr( ) );
}
else {
//ASSERT( item->m_type == IT_FILE );
ASSERT( item->m_children == nullptr );
colorOfItem = RGB( 254, 254, 254 );
}
Expand Down Expand Up @@ -1429,11 +1405,6 @@ void CTreemap::DrawCushion( _In_ CDC& offscreen_buffer, const _In_ CRect& rc, _I

const auto offset = static_cast<size_t>( ( loop_rect_start_outer * inner_stride ) + loop_rect_start_inner );
const size_t largestIndexWritten = ( ( loop_rect__end__outer * inner_stride ) - offset ) + loop_rect__end__inner;
//( ( rc.bottom * ( rc.right - rc.left ) ) + rc.right ) + 1;
//const auto vecSize = static_cast< size_t >( static_cast< size_t >( rc.bottom * static_cast< size_t >( rc.right - rc.left ) ) + rc.right ) + 1;
//const auto vecSize = static_cast< size_t >( static_cast< size_t >( loop_rect__end__outer * static_cast< size_t >( loop_rect__end__inner - loop_rect_start_inner ) ) ) + 1;



const auto surface_0 = ( 2.00 * surface[ 0 ] );
const auto surface_1 = ( 2.00 * surface[ 1 ] );
Expand Down Expand Up @@ -1592,7 +1563,6 @@ void CTreemap::SetPixels( _In_ CDC& offscreen_buffer, _In_reads_( maxIndex ) _Pr


const auto index = ( yStart * rcWidth ) + xStart - offset;
//const auto rcHeight = ( yEnd - yStart );
ASSERT( rcHeight == ( yEnd - yStart ) );
ASSERT( rcWidth == ( xEnd - xStart ) );
#ifndef DEBUG
Expand All @@ -1615,9 +1585,6 @@ void CTreemap::SetPixels( _In_ CDC& offscreen_buffer, _In_reads_( maxIndex ) _Pr
std::terminate( );
}
}

//TODO: BUGBUG: offscreen_buffer.SelectObject( m_pOldObject );
//VERIFY( tempDCmem.DeleteDC( ) );
}


Expand Down
17 changes: 10 additions & 7 deletions designPlansGoingForward.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
1: Refactor CItemBranch into two classes:
If static polymorphism for COwnerDrawnListItem works out, these two will become unfeasable, as it'd mean reintroduction of the vfptr.

a folder class - will store the attributes, name, parent pointer, m_rect, m_done, & child vector.
1: Refactor CItemBranch into two classes:

a file class - will store only the attributes, name, parent pointer, m_rect, size, & lastChange.
a folder class - will store the attributes, name, parent pointer, m_rect, m_done, & child vector.

2: Move "recursive" information out of CItemBranch, and into VISIBLEINFO structure:
a file class - will store only the attributes, name, parent pointer, m_rect, size, & lastChange.

Storing the recursive number of children, size, and number of incomplete jobs is VERY storage intensive.

We can build/gather that information when needed, and cache it.

2: Move "recursive" information out of CItemBranch, and into VISIBLEINFO structure:

Storing the recursive number of children, size, and number of incomplete jobs is VERY storage intensive.

We can build/gather that information when needed, and cache it.

3: Open file with NtCreateFile, Query info with NtQueryInformationFile, and THEN close the handle with NtClose

Expand Down

0 comments on commit 7de33be

Please sign in to comment.