xref: /aosp_15_r20/external/skia/tools/testrunners/gm/vias/Draw.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2023 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef Draw_DEFINED
9 #define Draw_DEFINED
10 
11 #include "gm/gm.h"
12 #include "include/core/SkBitmap.h"
13 #include "include/core/SkSurface.h"
14 
15 #include <string>
16 
17 // Holds the result of the draw() function.
18 struct GMOutput {
19     skiagm::GM::DrawResult result;
20     std::string msg;
21     SkBitmap bitmap;
22 
23     GMOutput(skiagm::GM::DrawResult result = skiagm::DrawResult::kFail,
24              std::string msg = "",
25              SkBitmap bitmap = SkBitmap())
resultGMOutput26             : result(result), msg(msg), bitmap(bitmap) {}
27 };
28 
29 // Draws a GM on a surface.
30 //
31 // To make the Bazel build more modular, multiple implementations of this function exist. Each
32 // implementation lives in a separate .cpp files that is conditionally included based on the
33 // //gm/vias:via Bazel config flag.
34 GMOutput draw(skiagm::GM* gm, SkSurface* surface, std::string via);
35 
36 #endif  // Draw_DEFINED
37