Flutter Engine
The Flutter Engine
Classes | Macros | Functions
MergeBench.cpp File Reference
#include "bench/Benchmark.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkImageFilters.h"
#include "tools/fonts/FontToolUtils.h"

Go to the source code of this file.

Classes

class  MergeBench
 

Macros

#define FILTER_WIDTH_SMALL   SkIntToScalar(32)
 
#define FILTER_HEIGHT_SMALL   SkIntToScalar(32)
 
#define FILTER_WIDTH_LARGE   SkIntToScalar(256)
 
#define FILTER_HEIGHT_LARGE   SkIntToScalar(256)
 

Functions

static sk_sp< SkImagemake_bitmap ()
 
static sk_sp< SkImagemake_checkerboard ()
 

Macro Definition Documentation

◆ FILTER_HEIGHT_LARGE

#define FILTER_HEIGHT_LARGE   SkIntToScalar(256)

Definition at line 18 of file MergeBench.cpp.

◆ FILTER_HEIGHT_SMALL

#define FILTER_HEIGHT_SMALL   SkIntToScalar(32)

Definition at line 16 of file MergeBench.cpp.

◆ FILTER_WIDTH_LARGE

#define FILTER_WIDTH_LARGE   SkIntToScalar(256)

Definition at line 17 of file MergeBench.cpp.

◆ FILTER_WIDTH_SMALL

#define FILTER_WIDTH_SMALL   SkIntToScalar(32)

Definition at line 15 of file MergeBench.cpp.

Function Documentation

◆ make_bitmap()

static sk_sp< SkImage > make_bitmap ( )
static

Definition at line 20 of file MergeBench.cpp.

20 {
22 surface->getCanvas()->clear(0x00000000);
24 paint.setColor(0xFF884422);
26 font.setSize(SkIntToScalar(96));
27 surface->getCanvas()->drawSimpleText("g", 1, SkTextEncoding::kUTF8, 15, 55, font, paint);
28 return surface->makeImageSnapshot();
29}
@ kUTF8
uses bytes to represent UTF-8 or ASCII
#define SkIntToScalar(x)
Definition: SkScalar.h:57
Definition: SkFont.h:35
const Paint & paint
Definition: color_source.cc:38
VkSurfaceKHR surface
Definition: main.cc:49
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SkFont DefaultFont()
font
Font Metadata and Metrics.
static SkImageInfo MakeN32Premul(int width, int height)

◆ make_checkerboard()

static sk_sp< SkImage > make_checkerboard ( )
static

Definition at line 31 of file MergeBench.cpp.

31 {
33 SkCanvas* canvas = surface->getCanvas();
34 canvas->clear(0x00000000);
35 SkPaint darkPaint;
36 darkPaint.setColor(0xFF804020);
37 SkPaint lightPaint;
38 lightPaint.setColor(0xFF244484);
39 for (int y = 0; y < 80; y += 16) {
40 for (int x = 0; x < 80; x += 16) {
41 canvas->save();
43 canvas->drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint);
44 canvas->drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint);
45 canvas->drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint);
46 canvas->drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint);
47 canvas->restore();
48 }
49 }
50
51 return surface->makeImageSnapshot();
52}
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
int save()
Definition: SkCanvas.cpp:447
void setColor(SkColor color)
Definition: SkPaint.cpp:119
double y
double x
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659