Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
hugepath.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTiledImageUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (path_huge_crbug_800804, canvas, 50, 600)
 
static void draw_huge_path (SkCanvas *canvas, int w, int h, bool manual)
 
 DEF_SIMPLE_GM (path_huge_aa, canvas, 200, 200)
 
 DEF_SIMPLE_GM (path_huge_aa_manual, canvas, 200, 200)
 

Function Documentation

◆ DEF_SIMPLE_GM() [1/3]

DEF_SIMPLE_GM ( path_huge_aa  ,
canvas  ,
200  ,
200   
)

Definition at line 78 of file hugepath.cpp.

78 {
79 draw_huge_path(canvas, 100, 60, /* manual= */ false);
80 canvas->translate(0, 80);
81 draw_huge_path(canvas, 100 * 1024, 60, /* manual= */ false);
82}
static void draw_huge_path(SkCanvas *canvas, int w, int h, bool manual)
Definition hugepath.cpp:44

◆ DEF_SIMPLE_GM() [2/3]

DEF_SIMPLE_GM ( path_huge_aa_manual  ,
canvas  ,
200  ,
200   
)

Definition at line 84 of file hugepath.cpp.

84 {
85 draw_huge_path(canvas, 100, 60, /* manual= */ true);
86 canvas->translate(0, 80);
87 draw_huge_path(canvas, 100 * 1024, 60, /* manual= */ true);
88}

◆ DEF_SIMPLE_GM() [3/3]

DEF_SIMPLE_GM ( path_huge_crbug_800804  ,
canvas  ,
50  ,
600   
)

Definition at line 17 of file hugepath.cpp.

17 {
19 paint.setAntiAlias(true);
21
22 // exercise various special-cases (e.g. hairlines or not)
23 const float widths[] = { 0.9f, 1.0f, 1.1f };
24
26 for (float w : widths) {
27 paint.setStrokeWidth(w);
28
29 path.reset();
30 path.moveTo(-1000,12345678901234567890.f);
31 path.lineTo(10.5f,200);
32 canvas->drawPath(path, paint);
33
34 path.reset();
35 path.moveTo(30.5f,400);
36 path.lineTo(1000,-9.8765432109876543210e+19f);
37 canvas->drawPath(path, paint);
38
39 canvas->translate(3, 0);
40 }
41}
const SkScalar widths[]
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
const Paint & paint
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
SkScalar w

◆ draw_huge_path()

static void draw_huge_path ( SkCanvas canvas,
int  w,
int  h,
bool  manual 
)
static

Definition at line 44 of file hugepath.cpp.

44 {
45 SkAutoCanvasRestore acr(canvas, true);
46
48 auto can = surf->getCanvas();
49
52 path.addRoundRect(SkRect::MakeXYWH(4, 4, w - 8, h - 8), 12, 12);
53
54 canvas->save();
55 canvas->clipRect(SkRect::MakeXYWH(4, 4, 64, 64));
56 can->drawPath(path, paint);
57 if (manual) {
58 SkTiledImageUtils::DrawImage(canvas, surf->makeImageSnapshot(), 64 - w, 0);
59 } else {
60 canvas->drawImage(surf->makeImageSnapshot(), 64 - w, 0);
61 }
62 canvas->restore();
63
64 canvas->translate(80, 0);
65 canvas->save();
66 canvas->clipRect(SkRect::MakeXYWH(4, 4, 64, 64));
67 can->clear(0);
68 paint.setAntiAlias(true);
69 can->drawPath(path, paint);
70 if (manual) {
71 SkTiledImageUtils::DrawImage(canvas, surf->makeImageSnapshot(), 64 - w, 0);
72 } else {
73 canvas->drawImage(surf->makeImageSnapshot(), 64 - w, 0);
74 }
75 canvas->restore();
76};
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
int save()
Definition SkCanvas.cpp:451
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
void DrawImage(SkCanvas *canvas, const SkImage *image, SkScalar x, SkScalar y, const SkSamplingOptions &sampling={}, const SkPaint *paint=nullptr, SkCanvas::SrcRectConstraint constraint=SkCanvas::kFast_SrcRectConstraint)
SkScalar h
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659