Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
fiddle_main.h
Go to the documentation of this file.
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
19#else
20 #include "skia.h"
21#endif
22
23#include <memory>
24#include <sstream>
25
26namespace sk_gpu_test {
27class GLTestContext;
28class ManagedBackendTexture;
29} // namespace sk_gpu_test
30
34extern SkBitmap source;
36extern double duration; // The total duration of the animation in seconds.
37extern double frame; // A value in [0, 1] of where we are in the animation.
38extern sk_sp<SkFontMgr> fontMgr; // Can load some system fonts
39
42 int h,
43 bool r,
44 bool g,
45 bool p,
46 bool k,
47 bool srgb,
48 bool f16,
49 bool textOnly,
50 const char* s,
51 skgpu::Mipmapped mipMapping,
52 int offScreenWidth,
53 int offScreenHeight,
54 int deprecated, // TODO(jcgregorio): remove
55 skgpu::Mipmapped offScreenMipMapping)
56 : size(SkISize::Make(w, h))
57 , raster(r)
58 , gpu(g)
59 , pdf(p)
60 , skp(k)
61 , srgb(srgb)
62 , f16(f16)
64 , source(s)
65 , fMipMapping(mipMapping)
66 , fOffScreenWidth(offScreenWidth)
67 , fOffScreenHeight(offScreenHeight)
68 , fOffScreenMipMapping(offScreenMipMapping) {
69 // F16 mode is only valid for color correct backends.
70 SkASSERT(srgb || !f16);
71 }
73 bool raster;
74 bool gpu;
75 bool pdf;
76 bool skp;
77 bool srgb;
78 bool f16;
80 const char* source;
81
82 // This flag is used when a GPU texture resource is created and exposed as a GrBackendTexture.
83 // In this case the resource is created with extra room to accommodate mipmaps.
84 // TODO: The SkImage::makeTextureImage API would need to be widened to allow this to be true
85 // for the non-backend gpu SkImages.
87
88 // Parameters for an GPU offscreen resource exposed as a GrBackendRenderTarget
91 // TODO: should we also expose stencilBits here? How about the config?
92
93 skgpu::Mipmapped fOffScreenMipMapping; // only applicable if the offscreen is also textureable
94};
95
97extern void SkDebugf(const char * format, ...);
98extern void draw(SkCanvas*);
99
100// There are different implementations of create_direct_context() for EGL, Mesa,
101// and a fallback to a null context.
102extern sk_sp<GrDirectContext> create_direct_context(std::ostringstream& driverinfo,
103 std::unique_ptr<sk_gpu_test::GLTestContext>*);
104
105#endif // fiddle_main_DEFINED
#define SkASSERT(cond)
Definition SkAssert.h:116
static std::unique_ptr< SkEncoder > Make(SkWStream *dst, const SkPixmap *src, const SkYUVAPixmaps *srcYUVA, const SkColorSpace *srcYUVAColorSpace, const SkJpegEncoder::Options &options)
struct MyStruct s
sk_sp< SkFontMgr > fontMgr
Definition examples.cpp:32
GrBackendTexture backEndTextureRenderTarget
Definition examples.cpp:27
sk_sp< SkImage > image
Definition examples.cpp:29
DrawOptions GetDrawOptions()
Definition draw.cpp:16
SkBitmap source
Definition examples.cpp:28
void draw(SkCanvas *)
Definition draw.cpp:35
void SkDebugf(const char *format,...)
GrBackendRenderTarget backEndRenderTarget
Definition examples.cpp:26
sk_sp< GrDirectContext > create_direct_context(std::ostringstream &driverinfo, std::unique_ptr< sk_gpu_test::GLTestContext > *)
GrBackendTexture backEndTexture
Definition examples.cpp:25
double duration
Definition examples.cpp:30
double frame
Definition examples.cpp:31
uint32_t uint32_t * format
-comparison
Mipmapped
Definition GpuTypes.h:53
Definition __init__.py:1
SkScalar w
SkScalar h
int fOffScreenWidth
Definition fiddle_main.h:89
skgpu::Mipmapped fOffScreenMipMapping
Definition fiddle_main.h:93
const char * source
Definition fiddle_main.h:80
SkISize size
Definition fiddle_main.h:72
DrawOptions(int w, int h, bool r, bool g, bool p, bool k, bool srgb, bool f16, bool textOnly, const char *s, skgpu::Mipmapped mipMapping, int offScreenWidth, int offScreenHeight, int deprecated, skgpu::Mipmapped offScreenMipMapping)
Definition fiddle_main.h:41
skgpu::Mipmapped fMipMapping
Definition fiddle_main.h:86
int fOffScreenHeight
Definition fiddle_main.h:90