Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Functions | Variables
drawminibitmaprect.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "src/base/SkMathPriv.h"
#include "src/base/SkRandom.h"
#include "tools/GpuToolUtils.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Classes

class  DrawMiniBitmapRectGM
 

Functions

static sk_sp< SkImagemakebm (int w, int h)
 

Variables

constexpr int gSize = 1024
 
constexpr int gSurfaceSize = 2048
 

Function Documentation

◆ makebm()

static sk_sp< SkImage > makebm ( int  w,
int  h 
)
static

Definition at line 31 of file drawminibitmaprect.cpp.

31 {
34 SkCanvas* canvas = surface->getCanvas();
35
36 const SkScalar wScalar = SkIntToScalar(w);
37 const SkScalar hScalar = SkIntToScalar(h);
38
39 const SkPoint pt = { wScalar / 2, hScalar / 2 };
40
41 const SkScalar radius = 4 * std::max(wScalar, hScalar);
42
47
48 constexpr SkScalar pos[] = {0,
49 SK_Scalar1 / 6,
50 2 * SK_Scalar1 / 6,
51 3 * SK_Scalar1 / 6,
52 4 * SK_Scalar1 / 6,
53 5 * SK_Scalar1 / 6,
55
58 SkRect rect = SkRect::MakeWH(wScalar, hScalar);
59 SkMatrix mat = SkMatrix::I();
60 for (int i = 0; i < 4; ++i) {
62 pt, radius,
63 colors, pos,
66 0, &mat));
67 canvas->drawRect(rect, paint);
68 rect.inset(wScalar / 8, hScalar / 8);
69 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4);
70 }
71 return surface->makeImageSnapshot();
72}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SkPoint pos
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr SkColor SK_ColorYELLOW
Definition: SkColor.h:139
constexpr SkColor SK_ColorMAGENTA
Definition: SkColor.h:147
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorCYAN
Definition: SkColor.h:143
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
#define SK_Scalar1
Definition: SkScalar.h:18
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
static sk_sp< SkShader > MakeRadial(const SkPoint &center, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:360
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
float SkScalar
Definition: extension.cpp:12
static float max(float r, float g, float b)
Definition: hsl.cpp:49
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
PODArray< SkColor > colors
Definition: SkRecords.h:276
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
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
SkScalar w
SkScalar h
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

Variable Documentation

◆ gSize

constexpr int gSize = 1024
constexpr

Definition at line 74 of file drawminibitmaprect.cpp.

◆ gSurfaceSize

constexpr int gSurfaceSize = 2048
constexpr

Definition at line 75 of file drawminibitmaprect.cpp.