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 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 22 23 extern SkBitmap source; 24 extern sk_sp<SkImage> image; 25 26 struct DrawOptions { DrawOptionsDrawOptions27 DrawOptions(int w, int h, bool r, bool g, bool p, bool k, bool srgb, bool f16, bool textOnly, const char* s) 28 : size(SkISize::Make(w, h)) 29 , raster(r) 30 , gpu(g) 31 , pdf(p) 32 , skp(k) 33 , srgb(srgb) 34 , f16(f16) 35 , textOnly(textOnly) 36 , source(s) 37 { 38 // F16 mode is only valid for color correct backends. 39 SkASSERT(srgb || !f16); 40 } 41 SkISize size; 42 bool raster; 43 bool gpu; 44 bool pdf; 45 bool skp; 46 bool srgb; 47 bool f16; 48 bool textOnly; 49 const char* source; 50 }; 51 52 extern DrawOptions GetDrawOptions(); 53 extern void SkDebugf(const char * format, ...); 54 extern void draw(SkCanvas*); 55 56 #endif // fiddle_main_DEFINED 57