halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | #ifndef fiddle_main_DEFINED |
| 8 | #define fiddle_main_DEFINED |
| 9 | |
halcanary | f0da138 | 2016-04-18 11:50:07 -0700 | [diff] [blame] | 10 | #ifdef FIDDLE_BUILD_TEST |
| 11 | #include "GrContext.h" |
| 12 | #include "SkCanvas.h" |
| 13 | #include "SkDocument.h" |
| 14 | #include "SkPictureRecorder.h" |
| 15 | #include "SkStream.h" |
| 16 | #include "SkSurface.h" |
| 17 | #include "gl/GrGLAssembleInterface.h" |
| 18 | #include "gl/GrGLInterface.h" |
| 19 | #else |
| 20 | #include "skia.h" |
| 21 | #endif |
halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 22 | |
| 23 | extern SkBitmap source; |
halcanary | 7b8b237 | 2016-04-18 08:17:56 -0700 | [diff] [blame] | 24 | extern sk_sp<SkImage> image; |
Joe Gregorio | 1e735c0 | 2017-04-19 14:05:14 -0400 | [diff] [blame] | 25 | extern double duration; // The total duration of the animation in seconds. |
| 26 | extern double frame; // A value in [0, 1] of where we are in the animation. |
halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 27 | |
| 28 | struct DrawOptions { |
Joe Gregorio | 1fd1823 | 2017-02-13 11:39:43 -0500 | [diff] [blame] | 29 | DrawOptions(int w, int h, bool r, bool g, bool p, bool k, bool srgb, bool f16, bool textOnly, const char* s) |
halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 30 | : size(SkISize::Make(w, h)) |
| 31 | , raster(r) |
| 32 | , gpu(g) |
| 33 | , pdf(p) |
| 34 | , skp(k) |
Matt Sarett | a2f7126 | 2016-11-29 17:14:58 -0500 | [diff] [blame] | 35 | , srgb(srgb) |
| 36 | , f16(f16) |
Joe Gregorio | 1fd1823 | 2017-02-13 11:39:43 -0500 | [diff] [blame] | 37 | , textOnly(textOnly) |
Matt Sarett | a2f7126 | 2016-11-29 17:14:58 -0500 | [diff] [blame] | 38 | , source(s) |
| 39 | { |
| 40 | // F16 mode is only valid for color correct backends. |
| 41 | SkASSERT(srgb || !f16); |
| 42 | } |
halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 43 | SkISize size; |
| 44 | bool raster; |
| 45 | bool gpu; |
| 46 | bool pdf; |
| 47 | bool skp; |
Matt Sarett | a2f7126 | 2016-11-29 17:14:58 -0500 | [diff] [blame] | 48 | bool srgb; |
| 49 | bool f16; |
Joe Gregorio | 1fd1823 | 2017-02-13 11:39:43 -0500 | [diff] [blame] | 50 | bool textOnly; |
halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 51 | const char* source; |
| 52 | }; |
| 53 | |
| 54 | extern DrawOptions GetDrawOptions(); |
Joe Gregorio | 1fd1823 | 2017-02-13 11:39:43 -0500 | [diff] [blame] | 55 | extern void SkDebugf(const char * format, ...); |
halcanary | decb21e | 2015-12-10 07:52:45 -0800 | [diff] [blame] | 56 | extern void draw(SkCanvas*); |
| 57 | |
| 58 | #endif // fiddle_main_DEFINED |