Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
ClipErrorGM Class Reference
Inheritance diagram for ClipErrorGM:
skiagm::GM

Public Member Functions

 ClipErrorGM ()
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual SkISize getISize ()=0
 
virtual SkString getName () const =0
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 

Protected Member Functions

SkString getName () const override
 
SkISize getISize () override
 
void onDraw (SkCanvas *canvas) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onOnceBeforeDraw ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 45 of file clip_error.cpp.

Constructor & Destructor Documentation

◆ ClipErrorGM()

ClipErrorGM::ClipErrorGM ( )
inline

Definition at line 47 of file clip_error.cpp.

47{}

Member Function Documentation

◆ getISize()

SkISize ClipErrorGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 52 of file clip_error.cpp.

52{ return SkISize::Make(WIDTH, HEIGHT); }
#define WIDTH
Definition: clip_error.cpp:28
#define HEIGHT
Definition: clip_error.cpp:29
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ClipErrorGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 50 of file clip_error.cpp.

50{ return SkString("cliperror"); }

◆ onDraw()

void ClipErrorGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 54 of file clip_error.cpp.

54 {
56 paint.setAntiAlias(true);
57
59
60 // setup up maskfilter
62
63 SkPaint blurPaint(paint);
64 blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kSigma));
65
66 const char text[] = "hambur";
67 auto blob = SkTextBlob::MakeFromText(text, strlen(text), font);
68
69 SkPaint clearPaint(paint);
70 clearPaint.setColor(SK_ColorWHITE);
71
72 canvas->save();
73 canvas->translate(0, 0);
74 canvas->clipRect(SkRect::MakeLTRB(0, 0, WIDTH, 256));
75 draw_text(canvas, blob, paint, blurPaint, clearPaint);
76 canvas->restore();
77
78 canvas->save();
79 canvas->translate(0, 256);
80 canvas->clipRect(SkRect::MakeLTRB(0, 256, WIDTH, 510));
81 draw_text(canvas, blob, paint, blurPaint, clearPaint);
82 canvas->restore();
83 }
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition: SkBlurTypes.h:12
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static SkScalar SK_SPI ConvertRadiusToSigma(SkScalar radius)
Definition: SkBlurMask.cpp:39
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
Definition: SkFont.h:35
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
Definition: SkTextBlob.cpp:788
static void draw_text(SkCanvas *canvas, sk_sp< SkTextBlob > blob, const SkPaint &paint, const SkPaint &blurPaint, const SkPaint &clearPaint)
Definition: clip_error.cpp:31
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
std::u16string text
sk_sp< SkTypeface > DefaultPortableTypeface()
font
Font Metadata and Metrics.
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

The documentation for this class was generated from the following file: