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

Public Member Functions

 EncodeGM ()
 
- 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 28 of file encode.cpp.

Constructor & Destructor Documentation

◆ EncodeGM()

skiagm::EncodeGM::EncodeGM ( )
inline

Definition at line 30 of file encode.cpp.

30{}

Member Function Documentation

◆ getISize()

SkISize skiagm::EncodeGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 35 of file encode.cpp.

35{ return SkISize::Make(1024, 600); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString skiagm::EncodeGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 33 of file encode.cpp.

33{ return SkString("encode"); }

◆ onDraw()

void skiagm::EncodeGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 37 of file encode.cpp.

37 {
38 SkBitmap orig;
39 ToolUtils::GetResourceAsBitmap("images/mandrill_512_q075.jpg", &orig);
42 sk_sp<SkData> pngData = stream.detachAsData();
43 stream.reset();
44
46 sk_sp<SkData> jpgData = stream.detachAsData();
47
50 canvas->drawImage(pngImage.get(), 0.0f, 0.0f);
51 canvas->drawImage(jpgImage.get(), 512.0f, 0.0f);
52
55 canvas->drawString("Images should look identical.", 450.0f, 550.0f, font, SkPaint());
56 }
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
Definition: SkFont.h:35
@ kAlias
no transparent pixels on glyph edges
T * get() const
Definition: SkRefCnt.h:303
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SkFont DefaultPortableFont()
bool GetResourceAsBitmap(const char *resource, SkBitmap *dst)
Definition: DecodeUtils.h:21
font
Font Metadata and Metrics.

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