Skip to content

Commit

Permalink
Merge pull request #12 from mattias-symphony/SDA-2022
Browse files Browse the repository at this point in the history
SDA-2022 Don't save snippet when annotation aborted
  • Loading branch information
mattias-symphony authored May 29, 2020
2 parents da09ae1 + 92971f6 commit 31f9fcb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions ScreenSnippet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,19 @@ int main( int argc, char* argv[] ) {
RECT bounds = { 0, 0, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y };
result = makeAnnotations( monitor, snippet, bounds, snippetScale, lang );
}
// Save bitmap
Gdiplus::Bitmap bmp( snippet, (HPALETTE)0 );
CLSID pngClsid;
if( GetEncoderClsid( L"image/png", &pngClsid ) >= 0 ) {
size_t len = strlen( argv[ 1 ] );
wchar_t* filename = filename = new wchar_t[ len + 1 ];
mbstowcs_s( 0, filename, len + 1, argv[ 1 ], len );
bmp.Save( filename ? filename : L"test_image.png", &pngClsid, NULL );
delete[] filename;
}

if( result == EXIT_SUCCESS ) {
// Save bitmap
Gdiplus::Bitmap bmp( snippet, (HPALETTE)0 );
CLSID pngClsid;
if( GetEncoderClsid( L"image/png", &pngClsid ) >= 0 ) {
size_t len = strlen( argv[ 1 ] );
wchar_t* filename = filename = new wchar_t[ len + 1 ];
mbstowcs_s( 0, filename, len + 1, argv[ 1 ], len );
bmp.Save( filename ? filename : L"test_image.png", &pngClsid, NULL );
delete[] filename;
}
}

DeleteObject( snippet );
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "screen-snippet",
"version": "1.0.8",
"version": "1.0.9",
"description": "screen snippet util for windows, new version",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
2 changes: 1 addition & 1 deletion resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IDR_ERASER CURSOR "eraser.cur"

#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_REVISION 7
#define VER_REVISION 9



Expand Down

0 comments on commit 31f9fcb

Please sign in to comment.