scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 CanvasStateHelpers_DEFINED |
| 9 | #define CanvasStateHelpers_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkTypes.h" |
scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 12 | |
Michael Ludwig | 3021795 | 2020-12-04 12:58:35 -0500 | [diff] [blame] | 13 | // See CanvasStateTest. These functions are either linked in to 'dm' directly (when this flag is |
| 14 | // not defined), or built in a shared library that is dlopened by the test. In that case, they |
| 15 | // should not be visible in 'dm', but the shared library will not have this flag set and compiles |
| 16 | // them as expected. |
| 17 | #if !defined(SK_TEST_CANVAS_STATE_CROSS_LIBRARY) |
| 18 | |
scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 19 | class SkCanvas; |
| 20 | class SkCanvasState; |
| 21 | class SkRegion; |
| 22 | |
Michael Ludwig | 3021795 | 2020-12-04 12:58:35 -0500 | [diff] [blame] | 23 | #if defined(SK_BUILD_FOR_WIN) |
| 24 | #define EXPORT _declspec(dllexport) |
| 25 | #else |
| 26 | #define EXPORT |
| 27 | #endif |
| 28 | |
scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 29 | /* |
| 30 | * Helper function to perform drawing to an SkCanvas. Used by both |
| 31 | * test_complex_layers and complex_layers_draw_from_canvas_state. |
| 32 | */ |
| 33 | void complex_layers_draw(SkCanvas* canvas, float left, float top, |
| 34 | float right, float bottom, int32_t spacer); |
| 35 | |
| 36 | /* |
| 37 | * Create an SkCanvas from state and draw to it. Return true on success. |
| 38 | * |
| 39 | * Used by test_complex_layers test in CanvasStateTest. Marked as extern |
| 40 | * so it can be called from a separate library. |
| 41 | */ |
Michael Ludwig | 3021795 | 2020-12-04 12:58:35 -0500 | [diff] [blame] | 42 | extern "C" bool EXPORT complex_layers_draw_from_canvas_state(SkCanvasState* state, |
scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 43 | float left, float top, float right, float bottom, int32_t spacer); |
| 44 | |
| 45 | /* |
| 46 | * Helper function to perform drawing to an SkCanvas. Used both by test_complex_clips |
| 47 | * and complex_clips_draw_from_canvas_state. |
| 48 | */ |
| 49 | void complex_clips_draw(SkCanvas* canvas, int32_t left, int32_t top, |
| 50 | int32_t right, int32_t bottom, int32_t clipOp, const SkRegion& localRegion); |
| 51 | |
| 52 | /* |
| 53 | * Create an SkCanvas from state and draw to it. Return true on success. |
| 54 | * |
| 55 | * Used by test_complex_clips test in CanvasStateTest. Marked as extern |
| 56 | * so it can be called from a separate library. |
| 57 | */ |
Michael Ludwig | 3021795 | 2020-12-04 12:58:35 -0500 | [diff] [blame] | 58 | extern "C" bool EXPORT complex_clips_draw_from_canvas_state(SkCanvasState* state, |
scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 59 | int32_t left, int32_t top, int32_t right, int32_t bottom, int32_t clipOp, |
| 60 | int32_t regionRects, int32_t* rectCoords); |
| 61 | |
Michael Ludwig | 3021795 | 2020-12-04 12:58:35 -0500 | [diff] [blame] | 62 | #endif // SK_TEST_CANVAS_STATE_CROSS_LIBRARY |
scroggo | 2451937 | 2014-07-22 12:38:55 -0700 | [diff] [blame] | 63 | #endif // CanvasStateHelpers_DEFINED |