blob: 7be317b8c1ffc16ec8f7c29c02ccb00cab1d2dd8 [file] [log] [blame]
halcanarydecb21e2015-12-10 07:52:45 -08001/*
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
halcanaryf0da1382016-04-18 11:50:07 -070010#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
halcanarydecb21e2015-12-10 07:52:45 -080022
23extern SkBitmap source;
halcanary7b8b2372016-04-18 08:17:56 -070024extern sk_sp<SkImage> image;
Joe Gregorio1e735c02017-04-19 14:05:14 -040025extern double duration; // The total duration of the animation in seconds.
26extern double frame; // A value in [0, 1] of where we are in the animation.
halcanarydecb21e2015-12-10 07:52:45 -080027
28struct DrawOptions {
Joe Gregorio1fd18232017-02-13 11:39:43 -050029 DrawOptions(int w, int h, bool r, bool g, bool p, bool k, bool srgb, bool f16, bool textOnly, const char* s)
halcanarydecb21e2015-12-10 07:52:45 -080030 : size(SkISize::Make(w, h))
31 , raster(r)
32 , gpu(g)
33 , pdf(p)
34 , skp(k)
Matt Saretta2f71262016-11-29 17:14:58 -050035 , srgb(srgb)
36 , f16(f16)
Joe Gregorio1fd18232017-02-13 11:39:43 -050037 , textOnly(textOnly)
Matt Saretta2f71262016-11-29 17:14:58 -050038 , source(s)
39 {
40 // F16 mode is only valid for color correct backends.
41 SkASSERT(srgb || !f16);
42 }
halcanarydecb21e2015-12-10 07:52:45 -080043 SkISize size;
44 bool raster;
45 bool gpu;
46 bool pdf;
47 bool skp;
Matt Saretta2f71262016-11-29 17:14:58 -050048 bool srgb;
49 bool f16;
Joe Gregorio1fd18232017-02-13 11:39:43 -050050 bool textOnly;
halcanarydecb21e2015-12-10 07:52:45 -080051 const char* source;
52};
53
54extern DrawOptions GetDrawOptions();
Joe Gregorio1fd18232017-02-13 11:39:43 -050055extern void SkDebugf(const char * format, ...);
halcanarydecb21e2015-12-10 07:52:45 -080056extern void draw(SkCanvas*);
57
58#endif // fiddle_main_DEFINED