Flutter Engine
The Flutter Engine
Classes | Namespaces | Functions | Variables
fiddle_main.h File Reference
#include "skia.h"
#include <memory>
#include <sstream>

Go to the source code of this file.

Classes

struct  DrawOptions
 

Namespaces

namespace  sk_gpu_test
 

Functions

DrawOptions GetDrawOptions ()
 
void SkDebugf (const char *format,...)
 
void draw (SkCanvas *)
 
sk_sp< GrDirectContextcreate_direct_context (std::ostringstream &driverinfo, std::unique_ptr< sk_gpu_test::GLTestContext > *)
 

Variables

GrBackendTexture backEndTexture
 
GrBackendRenderTarget backEndRenderTarget
 
GrBackendTexture backEndTextureRenderTarget
 
SkBitmap source
 
sk_sp< SkImageimage
 
double duration
 
double frame
 
sk_sp< SkFontMgrfontMgr
 

Function Documentation

◆ create_direct_context()

sk_sp< GrDirectContext > create_direct_context ( std::ostringstream &  driverinfo,
std::unique_ptr< sk_gpu_test::GLTestContext > *  glContext 
)

Definition at line 20 of file egl_context.cpp.

22 {
24 if (!glContext) {
25 return nullptr;
26 }
27 (*glContext)->makeCurrent();
28 sk_sp<GrDirectContext> result = (*glContext)->makeContext(GrContextOptions());
29 if (!result) {
30 glContext->reset();
31 return nullptr;
32 }
33
34 driverinfo << "GL Version: " << glGetString(GL_VERSION) << "\n";
35 driverinfo << "GL Vendor: " << glGetString(GL_VENDOR) << "\n";
36 driverinfo << "GL Renderer: " << glGetString(GL_RENDERER) << "\n";
37 driverinfo << "GL Extensions: " << glGetString(GL_EXTENSIONS) << "\n";
38
39 return result;
40}
@ kGLES_GrGLStandard
Definition: GrGLTypes.h:22
GAsyncResult * result
GLTestContext * CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, GLTestContext *shareContext)

◆ draw()

void draw ( SkCanvas canvas)

Definition at line 35 of file draw.cpp.

35 {
36 canvas->clear(SK_ColorWHITE);
38 matrix.setScale(0.75f, 0.75f);
39 matrix.preRotate(frame * 30.0f * duration); // If an animation, rotate at 30 deg/s.
43 canvas->drawPaint(paint);
44 SkDebugf("This is text output: %d", 2);
45
46 if (auto dContext = GrAsDirectContext(canvas->recordingContext())) {
52 nullptr);
53
54 constexpr int kSampleCnt = 0;
58 kSampleCnt,
60 nullptr,
61 nullptr);
62
63 // Note: this surface should only be renderable (i.e., not textureable)
68 nullptr,
69 nullptr);
70 }
71}
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668
void clear(SkColor color)
Definition: SkCanvas.h:1199
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition: SkImage.cpp:179
const Paint & paint
Definition: color_source.cc:38
GrBackendTexture backEndTextureRenderTarget
Definition: examples.cpp:27
GrBackendRenderTarget backEndRenderTarget
Definition: examples.cpp:26
GrBackendTexture backEndTexture
Definition: examples.cpp:25
double duration
Definition: examples.cpp:30
double frame
Definition: examples.cpp:31
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
sk_sp< const SkImage > image
Definition: SkRecords.h:269
SK_API sk_sp< SkSurface > WrapBackendRenderTarget(GrRecordingContext *context, const GrBackendRenderTarget &backendRenderTarget, GrSurfaceOrigin origin, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, RenderTargetReleaseProc releaseProc=nullptr, ReleaseContext releaseContext=nullptr)
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)

◆ GetDrawOptions()

DrawOptions GetDrawOptions ( )

Definition at line 16 of file draw.cpp.

16 {
17 // path *should* be absolute.
18 static const char path[] = "resources/images/color_wheel.png";
19 return DrawOptions(256,
20 256,
21 true,
22 true,
23 true,
24 true,
25 true,
26 false,
27 false,
28 path,
30 64,
31 64,
32 0,
34}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ SkDebugf()

void SkDebugf ( const char *  format,
  ... 
)

Definition at line 65 of file fiddle_main.cpp.

65 {
66 va_list args;
68 char formatbuffer[1024];
69 int n = vsnprintf(formatbuffer, sizeof(formatbuffer), fmt, args);
70 va_end(args);
71 if (n>=0 && n<=int(sizeof(formatbuffer))) {
72 gTextOutput.write(formatbuffer, n);
73 }
74}
std::ostringstream gTextOutput
Definition: fiddle_main.cpp:56
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
va_start(args, format)
va_end(args)
static SkString fmt(SkColor4f c)
Definition: p3.cpp:43

Variable Documentation

◆ backEndRenderTarget

GrBackendRenderTarget backEndRenderTarget
extern

Definition at line 26 of file examples.cpp.

◆ backEndTexture

GrBackendTexture backEndTexture
extern

Definition at line 25 of file examples.cpp.

◆ backEndTextureRenderTarget

GrBackendTexture backEndTextureRenderTarget
extern

Definition at line 27 of file examples.cpp.

◆ duration

double duration
extern

Definition at line 30 of file examples.cpp.

◆ fontMgr

sk_sp<SkFontMgr> fontMgr
extern

Definition at line 32 of file examples.cpp.

◆ frame

double frame
extern

Definition at line 31 of file examples.cpp.

◆ image

sk_sp<SkImage> image
extern

Definition at line 29 of file examples.cpp.

◆ source

SkBitmap source
extern

Definition at line 28 of file examples.cpp.