Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
skbug1719.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkScalar.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM_BG (skbug1719, canvas, 300, 100, 0xFF303030)
 

Function Documentation

◆ DEF_SIMPLE_GM_BG()

DEF_SIMPLE_GM_BG ( skbug1719  ,
canvas  ,
300  ,
100  ,
0xFF303030   
)

This test exercises bug 1719. An anti-aliased blurred path is rendered through a soft clip. On the GPU a scratch texture was used to hold the original path mask as well as the blurred path result. The same texture is then incorrectly used to generate the soft clip mask for the draw. Thus the same texture is used for both the blur mask and soft mask in a single draw.

The correct image should look like a thin stroked round rect.

Definition at line 26 of file skbug1719.cpp.

26 {
27 canvas->translate(SkIntToScalar(-800), SkIntToScalar(-650));
28
29 // The data is lifted from an SKP that exhibited the bug.
30
31 // This is a round rect.
33 clipPath.moveTo(832.f, 654.f);
34 clipPath.lineTo(1034.f, 654.f);
35 clipPath.cubicTo(1038.4183f, 654.f, 1042.f, 657.58173f, 1042.f, 662.f);
36 clipPath.lineTo(1042.f, 724.f);
37 clipPath.cubicTo(1042.f, 728.41827f, 1038.4183f, 732.f, 1034.f, 732.f);
38 clipPath.lineTo(832.f, 732.f);
39 clipPath.cubicTo(827.58173f, 732.f, 824.f, 728.41827f, 824.f, 724.f);
40 clipPath.lineTo(824.f, 662.f);
41 clipPath.cubicTo(824.f, 657.58173f, 827.58173f, 654.f, 832.f, 654.f);
42 clipPath.close();
43
44 // This is a round rect nested inside a rect.
46 drawPath.moveTo(823.f, 653.f);
47 drawPath.lineTo(1043.f, 653.f);
48 drawPath.lineTo(1043.f, 733.f);
49 drawPath.lineTo(823.f, 733.f);
50 drawPath.lineTo(823.f, 653.f);
52 drawPath.moveTo(832.f, 654.f);
53 drawPath.lineTo(1034.f, 654.f);
54 drawPath.cubicTo(1038.4183f, 654.f, 1042.f, 657.58173f, 1042.f, 662.f);
55 drawPath.lineTo(1042.f, 724.f);
56 drawPath.cubicTo(1042.f, 728.41827f, 1038.4183f, 732.f, 1034.f, 732.f);
57 drawPath.lineTo(832.f, 732.f);
58 drawPath.cubicTo(827.58173f, 732.f, 824.f, 728.41827f, 824.f, 724.f);
59 drawPath.lineTo(824.f, 662.f);
60 drawPath.cubicTo(824.f, 657.58173f, 827.58173f, 654.f, 832.f, 654.f);
63
65 paint.setAntiAlias(true);
66 paint.setColor(0xFF000000);
67 paint.setMaskFilter(
69 paint.setColorFilter(SkColorFilters::Blend(0xBFFFFFFF, SkBlendMode::kSrcIn));
70
71 canvas->clipPath(clipPath, true);
72 canvas->drawPath(drawPath, paint);
73}
@ kSrcIn
r = s * da
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition SkBlurTypes.h:12
#define SkIntToScalar(x)
Definition SkScalar.h:57
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
SkPath & moveTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:678
void setFillType(SkPathFillType ft)
Definition SkPath.h:235
SkPath & lineTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:718
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition SkPath.cpp:789
SkPath & close()
Definition SkPath.cpp:813
const Paint & paint
static void drawPath(SkPath &path, SkCanvas *canvas, SkColor color, const SkRect &clip, SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPathFillType fill, SkScalar strokeWidth)
Definition linepaths.cpp:22
clipPath(r.path, r.opAA.op(), r.opAA.aa())) DRAW(ClipRRect