Skip to content

Commit 773ddcb

Browse files
committed
Fix formatting issue in ci
1 parent c7b13a4 commit 773ddcb

File tree

10 files changed

+120
-112
lines changed

10 files changed

+120
-112
lines changed

bin/generate.dart

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,18 @@ class DiagramGenerator {
285285
for (final AnimationMetadata metadata in metadataList) {
286286
final String prefix = '${metadata.category}/${metadata.name}';
287287

288-
final File destination = File(path.join(destDir.path, '$prefix.${metadata.videoFormat.name}'));
288+
final File destination =
289+
File(path.join(destDir.path, '$prefix.${metadata.videoFormat.name}'));
289290
if (destination.existsSync()) {
290291
destination.deleteSync();
291292
}
292293
if (!destination.parent.existsSync()) {
293294
destination.parent.createSync(recursive: true);
294295
}
295-
print('Converting ${metadata.name} animation to ${metadata.videoFormat.name}.');
296-
_generateCommands(metadata: metadata, destination: destination.path, jobs: jobs);
296+
print(
297+
'Converting ${metadata.name} animation to ${metadata.videoFormat.name}.');
298+
_generateCommands(
299+
metadata: metadata, destination: destination.path, jobs: jobs);
297300
outputs.add(destination);
298301
}
299302
final ProcessPool pool = ProcessPool(processRunner: processRunner);
@@ -310,11 +313,13 @@ class DiagramGenerator {
310313
required String destination,
311314
required Map<int, List<WorkerJob>> jobs,
312315
}) {
313-
switch(metadata.videoFormat) {
316+
switch (metadata.videoFormat) {
314317
case VideoFormat.mp4:
315-
_generateMp4Commands(metadata: metadata, destination: destination, jobs: jobs);
318+
_generateMp4Commands(
319+
metadata: metadata, destination: destination, jobs: jobs);
316320
case VideoFormat.gif:
317-
_generateGifCommands(metadata: metadata, destination: destination, jobs: jobs);
321+
_generateGifCommands(
322+
metadata: metadata, destination: destination, jobs: jobs);
318323
}
319324
}
320325

@@ -324,71 +329,74 @@ class DiagramGenerator {
324329
required Map<int, List<WorkerJob>> jobs,
325330
}) {
326331
jobs.putIfAbsent(0, () => <WorkerJob>[]).add(
327-
WorkerJob(
328-
<String>[
329-
ffmpegCommand,
330-
'-loglevel', 'fatal', // Only print fatal errors.
331-
'-framerate', metadata.frameRate.toStringAsFixed(2),
332-
'-i', '-', // read in the concatenated frame files from stdin.
333-
// Yes, specify the -framerate flag twice: once for input, once for
334-
// output.
335-
'-framerate', metadata.frameRate.toStringAsFixed(2),
336-
'-tune', 'animation', // Optimize the encoder for cell animation.
337-
'-preset',
338-
'veryslow', // Use the slowest (best quality) compression preset.
339-
// Almost lossless quality (can't use lossless '0' because Safari
340-
// doesn't support it).
341-
'-crf', '1',
342-
'-c:v', 'libx264', // encode to mp4 H.264
343-
'-y', // overwrite output
344-
// Video format set to YUV420 color space for compatibility.
345-
'-vf', 'format=yuv420p',
346-
destination, // output movie.
347-
],
348-
workingDirectory: temporaryDirectory,
349-
stdinRaw: _concatInputs(metadata.frameFiles),
350-
printOutput: true,
351-
),
352-
);
332+
WorkerJob(
333+
<String>[
334+
ffmpegCommand,
335+
'-loglevel', 'fatal', // Only print fatal errors.
336+
'-framerate', metadata.frameRate.toStringAsFixed(2),
337+
'-i', '-', // read in the concatenated frame files from stdin.
338+
// Yes, specify the -framerate flag twice: once for input, once for
339+
// output.
340+
'-framerate', metadata.frameRate.toStringAsFixed(2),
341+
'-tune', 'animation', // Optimize the encoder for cell animation.
342+
'-preset',
343+
'veryslow', // Use the slowest (best quality) compression preset.
344+
// Almost lossless quality (can't use lossless '0' because Safari
345+
// doesn't support it).
346+
'-crf', '1',
347+
'-c:v', 'libx264', // encode to mp4 H.264
348+
'-y', // overwrite output
349+
// Video format set to YUV420 color space for compatibility.
350+
'-vf', 'format=yuv420p',
351+
destination, // output movie.
352+
],
353+
workingDirectory: temporaryDirectory,
354+
stdinRaw: _concatInputs(metadata.frameFiles),
355+
printOutput: true,
356+
),
357+
);
353358
}
354359

355360
void _generateGifCommands({
356361
required AnimationMetadata metadata,
357362
required String destination,
358363
required Map<int, List<WorkerJob>> jobs,
359364
}) {
360-
final String palette = path.join(temporaryDirectory.path, '${metadata.category}_${metadata.name}.png');
365+
final String palette = path.join(
366+
temporaryDirectory.path, '${metadata.category}_${metadata.name}.png');
361367
// Generate palette.
362368
jobs.putIfAbsent(0, () => <WorkerJob>[]).add(
363-
WorkerJob(
364-
<String>[
365-
ffmpegCommand,
366-
'-loglevel', 'fatal', // Only print fatal errors.
367-
'-i', '-', // read in the concatenated frame files from stdin.
368-
'-vf', 'fps=${metadata.frameRate.toStringAsFixed(0)},scale=${metadata.width}:-1:flags=lanczos,palettegen',
369-
palette,
370-
],
371-
workingDirectory: temporaryDirectory,
372-
stdinRaw: _concatInputs(metadata.frameFiles),
373-
printOutput: true,
374-
),
375-
);
369+
WorkerJob(
370+
<String>[
371+
ffmpegCommand,
372+
'-loglevel', 'fatal', // Only print fatal errors.
373+
'-i', '-', // read in the concatenated frame files from stdin.
374+
'-vf',
375+
'fps=${metadata.frameRate.toStringAsFixed(0)},scale=${metadata.width}:-1:flags=lanczos,palettegen',
376+
palette,
377+
],
378+
workingDirectory: temporaryDirectory,
379+
stdinRaw: _concatInputs(metadata.frameFiles),
380+
printOutput: true,
381+
),
382+
);
376383
// Create the final gif with the palette.
377384
jobs.putIfAbsent(1, () => <WorkerJob>[]).add(
378-
WorkerJob(
379-
<String>[
380-
ffmpegCommand,
381-
'-loglevel', 'fatal', // Only print fatal errors.
382-
'-i', '-',
383-
'-i', palette,
384-
'-filter_complex', 'fps=${metadata.frameRate.toStringAsFixed(0)},scale=${metadata.width}:-1:flags=lanczos[x];[x][1:v]paletteuse',
385-
destination,
386-
],
387-
workingDirectory: temporaryDirectory,
388-
stdinRaw: _concatInputs(metadata.frameFiles),
389-
printOutput: true,
390-
),
391-
);
385+
WorkerJob(
386+
<String>[
387+
ffmpegCommand,
388+
'-loglevel', 'fatal', // Only print fatal errors.
389+
'-i', '-',
390+
'-i', palette,
391+
'-filter_complex',
392+
'fps=${metadata.frameRate.toStringAsFixed(0)},scale=${metadata.width}:-1:flags=lanczos[x];[x][1:v]paletteuse',
393+
destination,
394+
],
395+
workingDirectory: temporaryDirectory,
396+
stdinRaw: _concatInputs(metadata.frameFiles),
397+
printOutput: true,
398+
),
399+
);
392400
}
393401

394402
Future<List<File>> _combineAnimations(List<File> inputFiles) async {

packages/diagram_capture/example/linux/my_application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
1919
*/
2020
MyApplication *my_application_new();
2121

22-
#endif // FLUTTER_MY_APPLICATION_H_
22+
#endif // FLUTTER_MY_APPLICATION_H_

packages/diagram_generator/linux/my_application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
1919
*/
2020
MyApplication *my_application_new();
2121

22-
#endif // FLUTTER_MY_APPLICATION_H_
22+
#endif // FLUTTER_MY_APPLICATION_H_

packages/diagram_viewer/linux/my_application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
1919
*/
2020
MyApplication *my_application_new();
2121

22-
#endif // FLUTTER_MY_APPLICATION_H_
22+
#endif // FLUTTER_MY_APPLICATION_H_

packages/diagram_viewer/windows/runner/flutter_window.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
6464
}
6565

6666
switch (message) {
67-
case WM_FONTCHANGE:
68-
flutter_controller_->engine()->ReloadSystemFonts();
69-
break;
67+
case WM_FONTCHANGE:
68+
flutter_controller_->engine()->ReloadSystemFonts();
69+
break;
7070
}
7171

7272
return Win32Window::MessageHandler(hwnd, message, wparam, lparam);

packages/diagram_viewer/windows/runner/flutter_window.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414

1515
// A window that does nothing but host a Flutter view.
1616
class FlutterWindow : public Win32Window {
17-
public:
17+
public:
1818
// Creates a new FlutterWindow hosting a Flutter view running |project|.
1919
explicit FlutterWindow(const flutter::DartProject &project);
2020
virtual ~FlutterWindow();
2121

22-
protected:
22+
protected:
2323
// Win32Window:
2424
bool OnCreate() override;
2525
void OnDestroy() override;
2626
LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
2727
LPARAM const lparam) noexcept override;
2828

29-
private:
29+
private:
3030
// The project to run.
3131
flutter::DartProject project_;
3232

3333
// The Flutter instance hosted by this window.
3434
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
3535
};
3636

37-
#endif // RUNNER_FLUTTER_WINDOW_H_
37+
#endif // RUNNER_FLUTTER_WINDOW_H_

packages/diagram_viewer/windows/runner/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ std::string Utf8FromUtf16(const wchar_t *utf16_string) {
5252
unsigned int target_length =
5353
::WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1,
5454
nullptr, 0, nullptr, nullptr) -
55-
1; // remove the trailing null character
55+
1; // remove the trailing null character
5656
int input_length = (int)wcslen(utf16_string);
5757
std::string utf8_string;
5858
if (target_length == 0 || target_length > utf8_string.max_size()) {

packages/diagram_viewer/windows/runner/utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ std::string Utf8FromUtf16(const wchar_t *utf16_string);
2020
// encoded in UTF-8. Returns an empty std::vector<std::string> on failure.
2121
std::vector<std::string> GetCommandLineArguments();
2222

23-
#endif // RUNNER_UTILS_H_
23+
#endif // RUNNER_UTILS_H_

packages/diagram_viewer/windows/runner/win32_window.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ void EnableFullDpiSupportIfAvailable(HWND hwnd) {
5959
FreeLibrary(user32_module);
6060
}
6161

62-
} // namespace
62+
} // namespace
6363

6464
// Manages the Win32Window's window class registration.
6565
class WindowClassRegistrar {
66-
public:
66+
public:
6767
~WindowClassRegistrar() = default;
6868

6969
// Returns the singleton registrar instance.
@@ -82,7 +82,7 @@ class WindowClassRegistrar {
8282
// instances of the window.
8383
void UnregisterWindowClass();
8484

85-
private:
85+
private:
8686
WindowClassRegistrar() = default;
8787

8888
static WindowClassRegistrar *instance_;
@@ -177,43 +177,43 @@ LRESULT
177177
Win32Window::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam,
178178
LPARAM const lparam) noexcept {
179179
switch (message) {
180-
case WM_DESTROY:
181-
window_handle_ = nullptr;
182-
Destroy();
183-
if (quit_on_close_) {
184-
PostQuitMessage(0);
180+
case WM_DESTROY:
181+
window_handle_ = nullptr;
182+
Destroy();
183+
if (quit_on_close_) {
184+
PostQuitMessage(0);
185+
}
186+
return 0;
187+
188+
case WM_DPICHANGED: {
189+
auto newRectSize = reinterpret_cast<RECT *>(lparam);
190+
LONG newWidth = newRectSize->right - newRectSize->left;
191+
LONG newHeight = newRectSize->bottom - newRectSize->top;
192+
193+
SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
194+
newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
195+
196+
return 0;
185197
}
186-
return 0;
187-
188-
case WM_DPICHANGED: {
189-
auto newRectSize = reinterpret_cast<RECT *>(lparam);
190-
LONG newWidth = newRectSize->right - newRectSize->left;
191-
LONG newHeight = newRectSize->bottom - newRectSize->top;
192-
193-
SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
194-
newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
195-
196-
return 0;
197-
}
198-
case WM_SIZE: {
199-
RECT rect = GetClientArea();
200-
if (child_content_ != nullptr) {
201-
// Size and position the child window.
202-
MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
203-
rect.bottom - rect.top, TRUE);
198+
case WM_SIZE: {
199+
RECT rect = GetClientArea();
200+
if (child_content_ != nullptr) {
201+
// Size and position the child window.
202+
MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
203+
rect.bottom - rect.top, TRUE);
204+
}
205+
return 0;
204206
}
205-
return 0;
206-
}
207207

208-
case WM_ACTIVATE:
209-
if (child_content_ != nullptr) {
210-
SetFocus(child_content_);
211-
}
212-
return 0;
208+
case WM_ACTIVATE:
209+
if (child_content_ != nullptr) {
210+
SetFocus(child_content_);
211+
}
212+
return 0;
213213

214-
case WM_DWMCOLORIZATIONCOLORCHANGED:
215-
UpdateTheme(hwnd);
216-
return 0;
214+
case WM_DWMCOLORIZATIONCOLORCHANGED:
215+
UpdateTheme(hwnd);
216+
return 0;
217217
}
218218

219219
return DefWindowProc(window_handle_, message, wparam, lparam);

packages/diagram_viewer/windows/runner/win32_window.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// inherited from by classes that wish to specialize with custom
1616
// rendering and input handling
1717
class Win32Window {
18-
public:
18+
public:
1919
struct Point {
2020
unsigned int x;
2121
unsigned int y;
@@ -59,7 +59,7 @@ class Win32Window {
5959
// Return a RECT representing the bounds of the current client area.
6060
RECT GetClientArea();
6161

62-
protected:
62+
protected:
6363
// Processes and route salient window messages for mouse handling,
6464
// size change and DPI. Delegates handling of these to member overloads that
6565
// inheriting classes can handle.
@@ -74,7 +74,7 @@ class Win32Window {
7474
// Called when Destroy is called.
7575
virtual void OnDestroy();
7676

77-
private:
77+
private:
7878
friend class WindowClassRegistrar;
7979

8080
// OS callback called by message pump. Handles the WM_NCCREATE message which
@@ -101,4 +101,4 @@ class Win32Window {
101101
HWND child_content_ = nullptr;
102102
};
103103

104-
#endif // RUNNER_WIN32_WINDOW_H_
104+
#endif // RUNNER_WIN32_WINDOW_H_

0 commit comments

Comments
 (0)