Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
examples.h
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3#ifndef examples_DEFINED
4#define examples_DEFINED
5
6#include "tools/Registry.h"
7#include "skia.h"
8
9#include <cinttypes>
10#include <cmath>
11#include <string>
12
32
36extern SkBitmap source;
38extern double duration; // The total duration of the animation in seconds.
39extern double frame; // A value in [0, 1] of where we are in the animation.
40extern sk_sp<SkFontMgr> fontMgr; // Can load some system fonts
41
42#define REGISTER_FIDDLE(NAME, WIDTH, HEIGHT, TEXT, IMG_INDEX, DURATION, SRGB, F16, \
43 OFSCR, OFSCR_WIDTH, OFSCR_HEIGHT, OFSCR_SAMPLECOUNT, \
44 OFSCR_TEXTURABLE, OFSCR_MIPMAP) \
45 namespace example_##NAME { void draw(SkCanvas*); } \
46 sk_tools::Registry<fiddle::Example> reg_##NAME( \
47 fiddle::Example{&example_##NAME::draw, #NAME, DURATION, IMG_INDEX, \
48 WIDTH, HEIGHT, OFSCR_WIDTH, OFSCR_HEIGHT, OFSCR_SAMPLECOUNT, \
49 TEXT, SRGB, F16, OFSCR, OFSCR_TEXTURABLE, OFSCR_MIPMAP}); \
50 namespace example_##NAME
51
52#define REG_FIDDLE_SRGB(NAME, W, H, T, I, DURATION, F16) \
53 REGISTER_FIDDLE(NAME, W, H, T, I, DURATION, true, F16, \
54 false, 64, 64, 0, false, false)
55
56#define REG_FIDDLE_ANIMATED(NAME, W, H, T, I, DURATION) \
57 REGISTER_FIDDLE(NAME, W, H, T, I, DURATION, false, false, \
58 false, 64, 64, 0, false, false)
59
60#define REG_FIDDLE(NAME, W, H, TEXT, I) \
61 REG_FIDDLE_ANIMATED(NAME, W, H, TEXT, I, 0)
62
63#endif // examples_DEFINED
sk_sp< SkFontMgr > fontMgr
Definition examples.cpp:32
GrBackendTexture backEndTextureRenderTarget
Definition examples.cpp:27
sk_sp< SkImage > image
Definition examples.cpp:29
SkBitmap source
Definition examples.cpp:28
GrBackendRenderTarget backEndRenderTarget
Definition examples.cpp:26
GrBackendTexture backEndTexture
Definition examples.cpp:25
double duration
Definition examples.cpp:30
double frame
Definition examples.cpp:31
int fOffscreenWidth
Definition examples.h:21
const char * fName
Definition examples.h:16
int fOffscreenSampleCount
Definition examples.h:23
void(* fFunc)(SkCanvas *)
Definition examples.h:15
int fOffscreenHeight
Definition examples.h:22
bool fOffscreenMipMap
Definition examples.h:29
double fAnimationDuration
Definition examples.h:17
bool fOffscreenTexturable
Definition examples.h:28