Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JMKh3r committed May 6, 2018
1 parent 5567ccd commit ae5108d
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 7 deletions.
56 changes: 54 additions & 2 deletions 2DTest.cpp
Expand Up @@ -2,10 +2,12 @@
#include "2DTest.h"


#define Rectangle_(hdc, r) Rectangle(hdc, r.left, r.top, r.right, r.bottom)
/*#define Rectangle_(hdc, r) Rectangle(hdc, r.left, r.top, r.right, r.bottom)
#define Ellipse_(hdc, r) Ellipse(hdc, r.left, r.top, r.right, r.bottom)
#define Line_(hdc, r) {MoveToEx(hdc, r.left, r.top, NULL); LineTo(hdc, r.right, r.bottom);}

*/
#define Line_(hdc, x1, y1, x2, y2) {MoveToEx(hdc, x1, y1, NULL); LineTo(hdc, x2, y2);}
#define arrlen(a) (sizeof(a)/sizeof(a[0]))



Expand All @@ -15,6 +17,11 @@
#define WINDOW_HEIGHT 700


#define DRAW_LEFT 4
#define DRAW_TOP 26
#define DRAW_RIGHT (WINDOW_WIDTH-12)
#define DRAW_BOTTOM (WINDOW_HEIGHT-30)



#define MAX_LOADSTRING 100
Expand Down Expand Up @@ -167,6 +174,7 @@ void DrawDurations(HDC hdc)
{
TCHAR Str1[100];

/*
_tcscpy_s(Str1, _T("Îáùåå âðåìÿ îòðèñîâêè:"));
TextOut(hdc, 5, 4, Str1, _tcslen(Str1));
_sntprintf_s(Str1, _countof(Str1), _T("%.6f"), MedianTotal);
Expand All @@ -190,13 +198,20 @@ void DrawDurations(HDC hdc)
_sntprintf_s(Str1, _countof(Str1), _T("%.6f"), Median3);
_tcscat_s(Str1, _T(" ìñåê"));
TextOut(hdc, 250, 8+3*15, Str1, _tcslen(Str1));
*/
_tcscpy_s(Str1, _T("Âðåìÿ îòðèñîâêè ëèíèé:"));
TextOut(hdc, 5, 4, Str1, _tcslen(Str1));
_sntprintf_s(Str1, _countof(Str1), _T("%.6f"), Median3);
_tcscat_s(Str1, _T(" ìñåê"));
TextOut(hdc, 250, 4, Str1, _tcslen(Str1));
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void DrawShapes(HWND hWnd)
{
HDC hdc;
/*
double ElapsedTimeTotal = 0;
double ElapsedTime1 = 0;
double ElapsedTime2 = 0;
Expand Down Expand Up @@ -259,6 +274,43 @@ void DrawShapes(HWND hWnd)
DrawDurations(hdc);
ReleaseDC(hWnd, hdc);
*/

double ElapsedTime3 = 0;
LARGE_INTEGER Frequency;
LARGE_INTEGER StartTime3, EndTime3;
int x,y;
COLORREF PenColor[] = {RGB(0,0,0), RGB(255,0,0), RGB(0,0,255)};
int i;
RECT r = {DRAW_LEFT, DRAW_TOP, DRAW_RIGHT, DRAW_BOTTOM};


if (!(hdc = GetDC(hWnd))) return;

SelectObject(hdc, GetStockObject(DC_PEN));
FillRect(hdc, &r, (HBRUSH) (COLOR_WINDOW+1));

QueryPerformanceFrequency(&Frequency);

QueryPerformanceCounter(&StartTime3);
for (i = 0; i < arrlen(PenColor); i++)
{
SetDCPenColor(hdc, PenColor[i]);
for (y = DRAW_TOP; y < DRAW_BOTTOM; y+=4) Line_(hdc, DRAW_LEFT, y, DRAW_RIGHT, y);
for (x = DRAW_LEFT; x < DRAW_RIGHT; x+=4) Line_(hdc, x, DRAW_TOP, x, DRAW_BOTTOM);
}
QueryPerformanceCounter(&EndTime3);

ElapsedTime3 = (EndTime3.QuadPart - StartTime3.QuadPart) * 1000.0 / Frequency.QuadPart;

ElapsedTime3Array.push_back(ElapsedTime3);
std::nth_element(ElapsedTime3Array.begin(), ElapsedTime3Array.begin() + ElapsedTime3Array.size()/2, ElapsedTime3Array.end());
Median3 = ElapsedTime3Array[ElapsedTime3Array.size() / 2];

DrawDurations(hdc);

ReleaseDC(hWnd, hdc);

}


4 changes: 4 additions & 0 deletions 2DTest.vcproj
Expand Up @@ -376,6 +376,10 @@
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\resource1.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
Expand Down
15 changes: 15 additions & 0 deletions resource1.h
@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by version.rc
//

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
10 changes: 5 additions & 5 deletions version.rc
@@ -1,6 +1,6 @@
// Microsoft Visual C++ generated resource script.
//
#include "version.h"
#include "resource1.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -53,8 +53,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -70,12 +70,12 @@ BEGIN
BLOCK "041904b0"
BEGIN
VALUE "FileDescription", "2DTest Application"
VALUE "FileVersion", "1, 0, 0, 0"
VALUE "FileVersion", "1, 1, 0, 0"
VALUE "InternalName", "2DTest"
VALUE "LegalCopyright", "Copyright (C) 2018"
VALUE "OriginalFilename", "2DTest.exe"
VALUE "ProductName", "2DTest Application"
VALUE "ProductVersion", "1, 0, 0, 0"
VALUE "ProductVersion", "1, 1, 0, 0"
END
END
BLOCK "VarFileInfo"
Expand Down

0 comments on commit ae5108d

Please sign in to comment.