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

Public Member Functions

 BitmapRectRounding ()
 
- 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 onOnceBeforeDraw () 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 245 of file bitmaprect.cpp.

Constructor & Destructor Documentation

◆ BitmapRectRounding()

BitmapRectRounding::BitmapRectRounding ( )
inline

Definition at line 249 of file bitmaprect.cpp.

249{}

Member Function Documentation

◆ getISize()

SkISize BitmapRectRounding::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 258 of file bitmaprect.cpp.

258{ return SkISize::Make(640, 480); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString BitmapRectRounding::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 252 of file bitmaprect.cpp.

252 {
253 SkString str;
254 str.printf("bitmaprect_rounding");
255 return str;
256 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

◆ onDraw()

void BitmapRectRounding::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 270 of file bitmaprect.cpp.

270 {
272 paint.setColor(SK_ColorRED);
273
274 const SkRect r = SkRect::MakeXYWH(1, 1, 110, 114);
275 canvas->scale(0.9f, 0.9f);
276
277 // the drawRect shows the same problem as clipRect(r) followed by drawcolor(red)
278 canvas->drawRect(r, paint);
279 canvas->drawImageRect(fBM.asImage(), r, SkSamplingOptions());
280 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
const Paint & paint
Definition: color_source.cc:38
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ onOnceBeforeDraw()

void BitmapRectRounding::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 260 of file bitmaprect.cpp.

260 {
261 fBM.allocN32Pixels(10, 10);
263 }
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442

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