Flutter Engine
The Flutter Engine
Macros | Functions
imageresizetiled.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypeface.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkImageFilters.h"
#include "tools/ToolUtils.h"
#include "tools/fonts/FontToolUtils.h"

Go to the source code of this file.

Macros

#define WIDTH   640
 
#define HEIGHT   480
 
#define RESIZE_FACTOR   SkIntToScalar(2)
 

Functions

 DEF_SIMPLE_GM (imageresizetiled, canvas, WIDTH, HEIGHT)
 

Macro Definition Documentation

◆ HEIGHT

#define HEIGHT   480

Definition at line 23 of file imageresizetiled.cpp.

◆ RESIZE_FACTOR

#define RESIZE_FACTOR   SkIntToScalar(2)

Definition at line 25 of file imageresizetiled.cpp.

◆ WIDTH

#define WIDTH   640

Definition at line 22 of file imageresizetiled.cpp.

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( imageresizetiled  ,
canvas  ,
WIDTH  ,
HEIGHT   
)

Definition at line 27 of file imageresizetiled.cpp.

27 {
33 nullptr));
34
36 const SkScalar tile_size = SkIntToScalar(100);
37 for (SkScalar y = 0; y < HEIGHT; y += tile_size) {
38 for (SkScalar x = 0; x < WIDTH; x += tile_size) {
39 canvas->save();
40 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size));
41 canvas->scale(SkScalarInvert(RESIZE_FACTOR),
43 canvas->saveLayer(nullptr, &paint);
44 const char* str[] = {
45 "The quick",
46 "brown fox",
47 "jumped over",
48 "the lazy dog.",
49 };
50 float posY = 0;
51 for (unsigned i = 0; i < std::size(str); i++) {
52 posY += 100.0f;
53 canvas->drawString(str[i], 0.0f, posY, font, SkPaint());
54 }
55 canvas->restore();
56 canvas->restore();
57 }
58 }
59}
#define SkScalarInvert(x)
Definition: SkScalar.h:73
#define SkIntToScalar(x)
Definition: SkScalar.h:57
Definition: SkFont.h:35
static sk_sp< SkImageFilter > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
#define WIDTH
#define RESIZE_FACTOR
#define HEIGHT
double y
double x
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
sk_sp< SkTypeface > DefaultPortableTypeface()
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
font
Font Metadata and Metrics.
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659