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

Public Member Functions

 TallStretchedBitmapsGM ()
 
- 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 66 of file tallstretchedbitmaps.cpp.

Constructor & Destructor Documentation

◆ TallStretchedBitmapsGM()

TallStretchedBitmapsGM::TallStretchedBitmapsGM ( )
inline

Definition at line 68 of file tallstretchedbitmaps.cpp.

68{}

Member Function Documentation

◆ getISize()

SkISize TallStretchedBitmapsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 73 of file tallstretchedbitmaps.cpp.

73{ return SkISize::Make(730, 690); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString TallStretchedBitmapsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 71 of file tallstretchedbitmaps.cpp.

71{ return SkString("tall_stretched_bitmaps"); }

◆ onDraw()

void TallStretchedBitmapsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 83 of file tallstretchedbitmaps.cpp.

83 {
84 canvas->scale(1.3f, 1.3f);
85 for (size_t i = 0; i < std::size(fTallBmps); ++i) {
86 SkASSERT(fTallBmps[i].fItemCnt > 10);
87 SkBitmap bmp = fTallBmps[i].fBmp;
88 // Draw the last 10 elements of the bitmap.
89 int startItem = fTallBmps[i].fItemCnt - 10;
90 int itemHeight = bmp.height() / fTallBmps[i].fItemCnt;
91 SkIRect subRect = SkIRect::MakeLTRB(0, startItem * itemHeight,
92 bmp.width(), bmp.height());
93 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(bmp.width()), 10.f * itemHeight);
95 SkRect::Make(subRect), dstRect,
98 canvas->translate(SkIntToScalar(bmp.width() + 10), 0);
99 }
100 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkIntToScalar(x)
Definition: SkScalar.h:57
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
int width() const
Definition: SkBitmap.h:149
int height() const
Definition: SkBitmap.h:158
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
@ 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 scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
sk_sp< SkImage > MakeTextureImage(SkCanvas *canvas, sk_sp< SkImage > orig)
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
Definition: SkRect.h:32
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
Definition: SkRect.h:91
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ onOnceBeforeDraw()

void TallStretchedBitmapsGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 75 of file tallstretchedbitmaps.cpp.

75 {
76 for (size_t i = 0; i < std::size(fTallBmps); ++i) {
77 int h = SkToInt((4 + i) * 1024);
78
79 fTallBmps[i].fItemCnt = make_bm(&fTallBmps[i].fBmp, h);
80 }
81 }
constexpr int SkToInt(S x)
Definition: SkTo.h:29
SkScalar h
int make_bm(SkBitmap *bm, int height)

Member Data Documentation

◆ fBmp

SkBitmap TallStretchedBitmapsGM::fBmp

Definition at line 104 of file tallstretchedbitmaps.cpp.

◆ fItemCnt

int TallStretchedBitmapsGM::fItemCnt

Definition at line 105 of file tallstretchedbitmaps.cpp.


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