Flutter Engine
The Flutter Engine
Classes | Enumerations | Functions | Variables
AlternatingColorPatternBench.cpp File Reference
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkString.h"
#include "include/effects/SkGradientShader.h"

Go to the source code of this file.

Classes

struct  ColorPatternData
 
class  AlternatingColorPatternBench
 

Enumerations

enum  ColorPattern { kWhite_ColorPattern }
 
enum  DrawType {
  UNUSED , CLIP_PATH , CLIP_REGION , CLIP_RECT ,
  CLIP_RRECT , CONCAT , DRAW_BITMAP_RETIRED_2016_REMOVED_2018 , DRAW_BITMAP_MATRIX_RETIRED_2016_REMOVED_2018 ,
  DRAW_BITMAP_NINE_RETIRED_2016_REMOVED_2018 , DRAW_BITMAP_RECT_RETIRED_2016_REMOVED_2018 , DRAW_CLEAR , DRAW_DATA ,
  DRAW_OVAL , DRAW_PAINT , DRAW_PATH , DRAW_PICTURE ,
  DRAW_POINTS , DRAW_POS_TEXT_REMOVED_1_2019 , DRAW_POS_TEXT_TOP_BOTTOM_REMOVED_1_2019 , DRAW_POS_TEXT_H_REMOVED_1_2019 ,
  DRAW_POS_TEXT_H_TOP_BOTTOM_REMOVED_1_2019 , DRAW_RECT , DRAW_RRECT , DRAW_SPRITE_RETIRED_2015_REMOVED_2018 ,
  DRAW_TEXT_REMOVED_1_2019 , DRAW_TEXT_ON_PATH_RETIRED_08_2018_REMOVED_10_2018 , DRAW_TEXT_TOP_BOTTOM_REMOVED_1_2019 , DRAW_VERTICES_RETIRED_03_2017_REMOVED_01_2018 ,
  RESTORE , ROTATE , SAVE , SAVE_LAYER_SAVEFLAGS_DEPRECATED_2015_REMOVED_12_2020 ,
  SCALE , SET_MATRIX , SKEW , TRANSLATE ,
  NOOP , BEGIN_COMMENT_GROUP_obsolete , COMMENT_obsolete , END_COMMENT_GROUP_obsolete ,
  DRAW_DRRECT , PUSH_CULL , POP_CULL , DRAW_PATCH ,
  DRAW_PICTURE_MATRIX_PAINT , DRAW_TEXT_BLOB , DRAW_IMAGE , DRAW_IMAGE_RECT_STRICT_obsolete ,
  DRAW_ATLAS , DRAW_IMAGE_NINE , DRAW_IMAGE_RECT , SAVE_LAYER_SAVELAYERFLAGS_DEPRECATED_JAN_2016_REMOVED_01_2018 ,
  SAVE_LAYER_SAVELAYERREC , DRAW_ANNOTATION , DRAW_DRAWABLE , DRAW_DRAWABLE_MATRIX ,
  DRAW_TEXT_RSXFORM_DEPRECATED_DEC_2018 , TRANSLATE_Z , DRAW_SHADOW_REC , DRAW_IMAGE_LATTICE ,
  DRAW_ARC , DRAW_REGION , DRAW_VERTICES_OBJECT , FLUSH ,
  DRAW_EDGEAA_IMAGE_SET , SAVE_BEHIND , DRAW_EDGEAA_QUAD , DRAW_BEHIND_PAINT ,
  CONCAT44 , CLIP_SHADER_IN_PAINT , MARK_CTM , SET_M44 ,
  DRAW_IMAGE2 , DRAW_IMAGE_RECT2 , DRAW_IMAGE_LATTICE2 , DRAW_EDGEAA_IMAGE_SET2 ,
  RESET_CLIP , DRAW_SLUG , LAST_DRAWTYPE_ENUM = DRAW_SLUG
}
 

Functions

static void makebm (SkBitmap *bm, int w, int h)
 
 DEF_BENCH (return new AlternatingColorPatternBench(kWhite_ColorPattern, kWhite_ColorPattern, kPath_DrawType);) DEF_BENCH(return new AlternatingColorPatternBench(kBlue_ColorPattern
 
 DEF_BENCH (return new AlternatingColorPatternBench(kWhite_ColorPattern, kBlue_ColorPattern, kPath_DrawType);) DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern
 
 DEF_BENCH (return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern, kAlphaBitmap_ColorPattern, kPath_DrawType);) DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern
 
 DEF_BENCH (return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, kOpaqueBitmap_ColorPattern, kRect_DrawType);) DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern
 

Variables

static const struct ColorPatternData gColorPatterns []
 
 kBlue_ColorPattern
 
 kPath_DrawType
 
 kOpaqueBitmap_ColorPattern
 
 kAlphaBitmap_ColorPattern
 
 kRect_DrawType
 

Enumeration Type Documentation

◆ ColorPattern

◆ DrawType

enum DrawType
Enumerator
UNUSED 
CLIP_PATH 
CLIP_REGION 
CLIP_RECT 
CLIP_RRECT 
CONCAT 
DRAW_BITMAP_RETIRED_2016_REMOVED_2018 
DRAW_BITMAP_MATRIX_RETIRED_2016_REMOVED_2018 
DRAW_BITMAP_NINE_RETIRED_2016_REMOVED_2018 
DRAW_BITMAP_RECT_RETIRED_2016_REMOVED_2018 
DRAW_CLEAR 
DRAW_DATA 
DRAW_OVAL 
DRAW_PAINT 
DRAW_PATH 
DRAW_PICTURE 
DRAW_POINTS 
DRAW_POS_TEXT_REMOVED_1_2019 
DRAW_POS_TEXT_TOP_BOTTOM_REMOVED_1_2019 
DRAW_POS_TEXT_H_REMOVED_1_2019 
DRAW_POS_TEXT_H_TOP_BOTTOM_REMOVED_1_2019 
DRAW_RECT 
DRAW_RRECT 
DRAW_SPRITE_RETIRED_2015_REMOVED_2018 
DRAW_TEXT_REMOVED_1_2019 
DRAW_TEXT_ON_PATH_RETIRED_08_2018_REMOVED_10_2018 
DRAW_TEXT_TOP_BOTTOM_REMOVED_1_2019 
DRAW_VERTICES_RETIRED_03_2017_REMOVED_01_2018 
RESTORE 
ROTATE 
SAVE 
SAVE_LAYER_SAVEFLAGS_DEPRECATED_2015_REMOVED_12_2020 
SCALE 
SET_MATRIX 
SKEW 
TRANSLATE 
NOOP 
BEGIN_COMMENT_GROUP_obsolete 
COMMENT_obsolete 
END_COMMENT_GROUP_obsolete 
DRAW_DRRECT 
PUSH_CULL 
POP_CULL 
DRAW_PATCH 
DRAW_PICTURE_MATRIX_PAINT 
DRAW_TEXT_BLOB 
DRAW_IMAGE 
DRAW_IMAGE_RECT_STRICT_obsolete 
DRAW_ATLAS 
DRAW_IMAGE_NINE 
DRAW_IMAGE_RECT 
SAVE_LAYER_SAVELAYERFLAGS_DEPRECATED_JAN_2016_REMOVED_01_2018 
SAVE_LAYER_SAVELAYERREC 
DRAW_ANNOTATION 
DRAW_DRAWABLE 
DRAW_DRAWABLE_MATRIX 
DRAW_TEXT_RSXFORM_DEPRECATED_DEC_2018 
TRANSLATE_Z 
DRAW_SHADOW_REC 
DRAW_IMAGE_LATTICE 
DRAW_ARC 
DRAW_REGION 
DRAW_VERTICES_OBJECT 
FLUSH 
DRAW_EDGEAA_IMAGE_SET 
SAVE_BEHIND 
DRAW_EDGEAA_QUAD 
DRAW_BEHIND_PAINT 
CONCAT44 
CLIP_SHADER_IN_PAINT 
MARK_CTM 
SET_M44 
DRAW_IMAGE2 
DRAW_IMAGE_RECT2 
DRAW_IMAGE_LATTICE2 
DRAW_EDGEAA_IMAGE_SET2 
RESET_CLIP 
DRAW_SLUG 
LAST_DRAWTYPE_ENUM 

Definition at line 35 of file AlternatingColorPatternBench.cpp.

Function Documentation

◆ DEF_BENCH() [1/4]

◆ DEF_BENCH() [2/4]

◆ DEF_BENCH() [3/4]

◆ DEF_BENCH() [4/4]

◆ makebm()

static void makebm ( SkBitmap bm,
int  w,
int  h 
)
static

Definition at line 40 of file AlternatingColorPatternBench.cpp.

40 {
41 bm->allocN32Pixels(w, h);
43
44 SkCanvas canvas(*bm);
46 static const SkPoint kPts0[] = { { 0, 0 }, { s, s } };
47 static const SkPoint kPts1[] = { { s/2, 0 }, { s/2, s } };
48 static const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
49 static const SkColor kColors0[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
50 static const SkColor kColors1[] = {0xF08000F0, 0x8080F000, 0xF000F080 };
51
52
54
55 paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos, std::size(kColors0),
57 canvas.drawPaint(paint);
58 paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos, std::size(kColors1),
60 canvas.drawPaint(paint);
61}
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
#define SK_Scalar1
Definition: SkScalar.h:18
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
struct MyStruct s
static float min(float r, float g, float b)
Definition: hsl.cpp:48
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

Variable Documentation

◆ gColorPatterns

const struct ColorPatternData gColorPatterns[]
static
Initial value:
= {
{ SK_ColorWHITE, false, "white" },
{ SK_ColorBLUE, false, "blue" },
{ SK_ColorWHITE, true, "obaqueBitMap" },
{ 0x10000000, true, "alphaBitmap" },
}
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122

◆ kAlphaBitmap_ColorPattern

kAlphaBitmap_ColorPattern

Definition at line 183 of file AlternatingColorPatternBench.cpp.

◆ kBlue_ColorPattern

kBlue_ColorPattern

Definition at line 170 of file AlternatingColorPatternBench.cpp.

◆ kOpaqueBitmap_ColorPattern

kOpaqueBitmap_ColorPattern

Definition at line 177 of file AlternatingColorPatternBench.cpp.

◆ kPath_DrawType

kPath_DrawType

Definition at line 171 of file AlternatingColorPatternBench.cpp.

◆ kRect_DrawType

kRect_DrawType

Definition at line 191 of file AlternatingColorPatternBench.cpp.