Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
DrawBitmapRect4 Class Reference
Inheritance diagram for DrawBitmapRect4:
skiagm::GM

Public Member Functions

 DrawBitmapRect4 (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 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 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 194 of file bitmaprect.cpp.

Constructor & Destructor Documentation

◆ DrawBitmapRect4()

DrawBitmapRect4::DrawBitmapRect4 ( bool  useIRect)
inline

Definition at line 199 of file bitmaprect.cpp.

199 : fUseIRect(useIRect) {
200 this->setBGColor(0x88444444);
201 }
void setBGColor(SkColor)
Definition gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize DrawBitmapRect4::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 210 of file bitmaprect.cpp.

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

◆ getName()

SkString DrawBitmapRect4::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 204 of file bitmaprect.cpp.

204 {
205 SkString str;
206 str.printf("bigbitmaprect_%s", fUseIRect ? "i" : "s");
207 return str;
208 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:534

◆ onDraw()

void DrawBitmapRect4::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 212 of file bitmaprect.cpp.

212 {
213 if (!fBigImage) {
214 fBigImage = make_big_bitmap(canvas);
215 }
216
218 paint.setAlpha(128);
219 paint.setBlendMode(SkBlendMode::kXor);
221
222 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f };
223 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f };
224
225 SkRect srcR2 = { 4085.0f, 10.0f, 4087.0f, 12.0f };
226 SkRect dstR2 = { 10, 410, 30, 430 };
227
228 if (!fUseIRect) {
229 canvas->drawImageRect(fBigImage, srcR1, dstR1, sampling, &paint,
231 canvas->drawImageRect(fBigImage, srcR2, dstR2, sampling, &paint,
233 } else {
234 canvas->drawImageRect(fBigImage, SkRect::Make(srcR1.roundOut()), dstR1, sampling,
236 canvas->drawImageRect(fBigImage, SkRect::Make(srcR2.roundOut()), dstR2, sampling,
238 }
239 }
@ kXor
r = s*(1-da) + d*(1-sa)
static sk_sp< SkImage > make_big_bitmap(SkCanvas *canvas)
@ 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)
const Paint & paint
SkSamplingOptions sampling
Definition SkRecords.h:337
static SkRect Make(const SkISize &size)
Definition SkRect.h:669
void roundOut(SkIRect *dst) const
Definition SkRect.h:1241

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