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

Public Member Functions

 BC1TransparencyGM ()
 
- 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
 
DrawResult onGpuSetup (SkCanvas *canvas, SkString *errorMsg, GraphiteTestContext *) override
 
void onGpuTeardown () 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 160 of file bc1_transparency.cpp.

Constructor & Destructor Documentation

◆ BC1TransparencyGM()

skiagm::BC1TransparencyGM::BC1TransparencyGM ( )
inline

Definition at line 162 of file bc1_transparency.cpp.

162 {
164 }
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::BC1TransparencyGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 169 of file bc1_transparency.cpp.

169 {
170 return SkISize::Make(kImgWidth + 2 * kPad, 2 * kImgHeight + 3 * kPad);
171 }
constexpr int kPad
constexpr int kImgWidth
constexpr int kImgHeight
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 167 of file bc1_transparency.cpp.

167{ return SkString("bc1_transparency"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 199 of file bc1_transparency.cpp.

199 {
200 draw_image(canvas, fRGBImage, kPad, kPad);
201 draw_image(canvas, fRGBAImage, kPad, 2 * kPad + kImgHeight);
202 }
static void draw_image(SkCanvas *canvas, sk_sp< SkImage > image, int x, int y)

◆ onGpuSetup()

DrawResult skiagm::BC1TransparencyGM::onGpuSetup ( SkCanvas canvas,
SkString errorMsg,
GraphiteTestContext  
)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 173 of file bc1_transparency.cpp.

173 {
174 auto dContext = GrAsDirectContext(canvas->recordingContext());
175 if (dContext && dContext->abandoned()) {
176 // This isn't a GpuGM so a null 'context' is okay but an abandoned context
177 // if forbidden.
178 return DrawResult::kSkip;
179 }
180
182
183 fRGBImage = data_to_img(dContext, bc1Data, SkTextureCompressionType::kBC1_RGB8_UNORM);
184 fRGBAImage = data_to_img(dContext, std::move(bc1Data),
186 if (!fRGBImage || !fRGBAImage) {
187 *errorMsg = "Failed to create BC1 images.";
188 return DrawResult::kFail;
189 }
190
191 return DrawResult::kOk;
192 }
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
static sk_sp< SkImage > data_to_img(GrDirectContext *direct, sk_sp< SkData > data, SkTextureCompressionType compression)
static sk_sp< SkData > make_compressed_data()
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637

◆ onGpuTeardown()

void skiagm::BC1TransparencyGM::onGpuTeardown ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 194 of file bc1_transparency.cpp.

194 {
195 fRGBImage = nullptr;
196 fRGBAImage = nullptr;
197 }

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