Flutter Engine
The Flutter Engine
Classes | Macros | Enumerations | Functions
RotatedRectBench.cpp File Reference
#include "bench/Benchmark.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPaint.h"
#include "include/effects/SkGradientShader.h"
#include "src/core/SkBlendModePriv.h"
#include <ctype.h>

Go to the source code of this file.

Classes

class  RotRectBench
 

Macros

#define DEF_FOR_COLOR_TYPES(aa, blend)
 
#define DEF_FOR_AA_MODES(blend)
 
#define DEF_FOR_PERSP_MODES(aa)
 

Enumerations

enum  ColorType {
  kConstantOpaque_ColorType , kConstantTransparent_ColorType , kChangingOpaque_ColorType , kChangingTransparent_ColorType ,
  kAlternatingOpaqueAndTransparent_ColorType , kShaderOpaque_ColorType
}
 

Functions

static SkColor start_color (ColorType ct)
 
static SkColor advance_color (SkColor old, ColorType ct, int step)
 
static SkString to_lower (const char *str)
 

Macro Definition Documentation

◆ DEF_FOR_AA_MODES

#define DEF_FOR_AA_MODES (   blend)
Value:
DEF_FOR_COLOR_TYPES(false, blend)
#define DEF_FOR_COLOR_TYPES(aa, blend)
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
Definition: hsl.cpp:142

Definition at line 195 of file RotatedRectBench.cpp.

◆ DEF_FOR_COLOR_TYPES

#define DEF_FOR_COLOR_TYPES (   aa,
  blend 
)
Value:

Definition at line 188 of file RotatedRectBench.cpp.

◆ DEF_FOR_PERSP_MODES

#define DEF_FOR_PERSP_MODES (   aa)
Value:

Definition at line 206 of file RotatedRectBench.cpp.

Enumeration Type Documentation

◆ ColorType

enum ColorType

This benchmark tests rendering rotated rectangles. It can optionally apply AA and/or change the paint color between each rect in different ways using the ColorType enum. The xfermode used can be specified as well.

Enumerator
kConstantOpaque_ColorType 
kConstantTransparent_ColorType 
kChangingOpaque_ColorType 
kChangingTransparent_ColorType 
kAlternatingOpaqueAndTransparent_ColorType 
kShaderOpaque_ColorType 

Definition at line 21 of file RotatedRectBench.cpp.

Function Documentation

◆ advance_color()

static SkColor advance_color ( SkColor  old,
ColorType  ct,
int  step 
)
inlinestatic

Definition at line 45 of file RotatedRectBench.cpp.

45 {
48 }
49 switch (ct) {
53 return old;
55 return 0xFF000000 | (old + 0x00010307);
57 return (0x00FFFFFF & (old + 0x00010307)) | 0x80000000;
59 SK_ABORT("Can't get here");
60 }
61 SK_ABORT("Shouldn't reach here.");
62}
static int step(int x, SkScalar min, SkScalar max)
Definition: BlurTest.cpp:215
#define SK_ABORT(message,...)
Definition: SkAssert.h:70

◆ start_color()

static SkColor start_color ( ColorType  ct)
inlinestatic

Definition at line 30 of file RotatedRectBench.cpp.

30 {
31 switch (ct) {
35 return 0xFFA07040;
38 return 0x80A07040;
40 return SK_ColorWHITE;
41 }
42 SK_ABORT("Shouldn't reach here.");
43}
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122

◆ to_lower()

static SkString to_lower ( const char *  str)
static

Definition at line 64 of file RotatedRectBench.cpp.

64 {
65 SkString lower(str);
66 for (size_t i = 0; i < lower.size(); i++) {
67 lower[i] = tolower(lower[i]);
68 }
69 return lower;
70}