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

Public Member Functions

 ImagePictGM ()
 
- 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 onOnceBeforeDraw () override
 
void drawSet (SkCanvas *canvas) const
 
void onDraw (SkCanvas *canvas) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
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 69 of file image_pict.cpp.

Constructor & Destructor Documentation

◆ ImagePictGM()

ImagePictGM::ImagePictGM ( )
inline

Definition at line 74 of file image_pict.cpp.

74{}

Member Function Documentation

◆ drawSet()

void ImagePictGM::drawSet ( SkCanvas canvas) const
inlineprotected

Definition at line 102 of file image_pict.cpp.

102 {
103 SkMatrix matrix = SkMatrix::Translate(-100, -100);
104 canvas->drawPicture(fPicture, &matrix, nullptr);
105 canvas->drawImage(fImage0.get(), 150, 0);
106 canvas->drawImage(fImage1.get(), 300, 0);
107 }
void drawPicture(const SkPicture *picture)
Definition SkCanvas.h:1961
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition SkMatrix.h:91
T * get() const
Definition SkRefCnt.h:303
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258

◆ getISize()

SkISize ImagePictGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 79 of file image_pict.cpp.

79{ return SkISize::Make(850, 450); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition SkSize.h:20

◆ getName()

SkString ImagePictGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 77 of file image_pict.cpp.

77{ return SkString("image-picture"); }

◆ onDraw()

void ImagePictGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 109 of file image_pict.cpp.

109 {
110 canvas->translate(20, 20);
111
112 this->drawSet(canvas);
113
114 canvas->save();
115 canvas->translate(0, 130);
116 canvas->scale(0.25f, 0.25f);
117 this->drawSet(canvas);
118 canvas->restore();
119
120 canvas->save();
121 canvas->translate(0, 200);
122 canvas->scale(2, 2);
123 this->drawSet(canvas);
124 canvas->restore();
125 }
void drawSet(SkCanvas *canvas) const
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
int save()
Definition SkCanvas.cpp:451
void scale(SkScalar sx, SkScalar sy)

◆ onOnceBeforeDraw()

void ImagePictGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 81 of file image_pict.cpp.

81 {
82 const SkRect bounds = SkRect::MakeXYWH(100, 100, 100, 100);
83 SkPictureRecorder recorder;
84 draw_something(recorder.beginRecording(bounds), bounds);
85 fPicture = recorder.finishRecordingAsPicture();
86
87 // extract enough just for the oval.
88 const SkISize size = SkISize::Make(100, 100);
89 auto srgbColorSpace = SkColorSpace::MakeSRGB();
90
92 matrix.setTranslate(-100, -100);
94 fPicture, size, &matrix, nullptr, SkImages::BitDepth::kU8, srgbColorSpace);
95 matrix.postTranslate(-50, -50);
96 matrix.postRotate(45);
97 matrix.postTranslate(50, 50);
99 fPicture, size, &matrix, nullptr, SkImages::BitDepth::kU8, srgbColorSpace);
100 }
static sk_sp< SkColorSpace > MakeSRGB()
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
static void draw_something(SkCanvas *canvas, const SkRect &bounds)
SK_API sk_sp< SkImage > DeferredFromPicture(sk_sp< SkPicture > picture, const SkISize &dimensions, const SkMatrix *matrix, const SkPaint *paint, BitDepth bitDepth, sk_sp< SkColorSpace > colorSpace, SkSurfaceProps props)
@ kU8
uses 8-bit unsigned int per color component
Optional< SkRect > bounds
Definition SkRecords.h:189
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
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659

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