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

Public Member Functions

 DrawBitmapRect2 (bool useIRect)
 
- 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 46 of file bitmaprect.cpp.

Constructor & Destructor Documentation

◆ DrawBitmapRect2()

DrawBitmapRect2::DrawBitmapRect2 ( bool  useIRect)
inline

Definition at line 49 of file bitmaprect.cpp.

49 : fUseIRect(useIRect) {
50 }

Member Function Documentation

◆ getISize()

SkISize DrawBitmapRect2::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 59 of file bitmaprect.cpp.

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

◆ getName()

SkString DrawBitmapRect2::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 53 of file bitmaprect.cpp.

53 {
54 SkString str;
55 str.printf("bitmaprect_%s", fUseIRect ? "i" : "s");
56 return str;
57 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

◆ onDraw()

void DrawBitmapRect2::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 61 of file bitmaprect.cpp.

61 {
62 canvas->drawColor(0xFFCCCCCC);
63
64 const SkIRect src[] = {
65 { 0, 0, 32, 32 },
66 { 0, 0, 80, 80 },
67 { 32, 32, 96, 96 },
68 { -32, -32, 32, 32, }
69 };
70
74
75 auto image = make_image(canvas);
76
77 SkRect dstR = { 0, 200, 128, 380 };
78
79 canvas->translate(16, 40);
80 for (size_t i = 0; i < std::size(src); i++) {
81 SkRect srcR;
82 srcR.set(src[i]);
83
84 canvas->drawImage(image, 0, 0, sampling, &paint);
85 if (!fUseIRect) {
86 canvas->drawImageRect(image.get(), srcR, dstR, sampling, &paint,
88 } else {
89 canvas->drawImageRect(image.get(), SkRect::Make(src[i]), dstR, sampling, &paint,
91 }
92
93 canvas->drawRect(dstR, paint);
94 canvas->drawRect(srcR, paint);
95
96 canvas->translate(160, 0);
97 }
98 }
static sk_sp< SkImage > make_image(SkCanvas *destCanvas)
Definition: bitmaprect.cpp:31
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
Definition: SkCanvas.h:1542
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
T * get() const
Definition: SkRefCnt.h:303
const Paint & paint
Definition: color_source.cc:38
sk_sp< const SkImage > image
Definition: SkRecords.h:269
SkSamplingOptions sampling
Definition: SkRecords.h:337
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
SkSamplingOptions(SkFilterMode::kLinear))
Definition: SkRect.h:32
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
void set(const SkIRect &src)
Definition: SkRect.h:849

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