Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | List of all members
DM::ViaUpright Class Reference

#include <DMSrcSink.h>

Inheritance diagram for DM::ViaUpright:
DM::Via DM::Sink

Public Member Functions

 ViaUpright (SkMatrix, Sink *)
 
Result draw (const Src &, SkBitmap *, SkWStream *, SkString *) const override
 
- Public Member Functions inherited from DM::Via
 Via (Sink *sink)
 
const char * fileExtension () const override
 
bool serial () const override
 
SinkFlags flags () const override
 
void setColorSpace (sk_sp< SkColorSpace > colorSpace) override
 
- Public Member Functions inherited from DM::Sink
virtual ~Sink ()
 
virtual Result draw (const Src &, SkBitmap *, SkWStream *, SkString *log) const =0
 
virtual void setColorSpace (sk_sp< SkColorSpace >)
 
virtual bool serial () const
 
virtual const char * fileExtension () const =0
 
virtual SinkFlags flags () const =0
 
virtual SkColorInfo colorInfo () const
 

Additional Inherited Members

- Protected Attributes inherited from DM::Via
std::unique_ptr< SinkfSink
 

Detailed Description

Definition at line 655 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ ViaUpright()

DM::ViaUpright::ViaUpright ( SkMatrix  matrix,
Sink sink 
)

Definition at line 2491 of file DMSrcSink.cpp.

2491: Via(sink), fMatrix(matrix) {}
Via(Sink *sink)
Definition: DMSrcSink.h:631
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

Member Function Documentation

◆ draw()

Result DM::ViaUpright::draw ( const Src src,
SkBitmap bitmap,
SkWStream stream,
SkString log 
) const
overridevirtual

Implements DM::Sink.

Definition at line 2493 of file DMSrcSink.cpp.

2493 {
2494 Result result = fSink->draw(src, bitmap, stream, log);
2495 if (!result.isOk()) {
2496 return result;
2497 }
2498
2499 SkMatrix inverse;
2500 if (!fMatrix.rectStaysRect() || !fMatrix.invert(&inverse)) {
2501 return Result::Fatal("Cannot upright --matrix.");
2502 }
2503 SkMatrix upright = SkMatrix::I();
2504 upright.setScaleX(SkScalarSignAsScalar(inverse.getScaleX()));
2505 upright.setScaleY(SkScalarSignAsScalar(inverse.getScaleY()));
2506 upright.setSkewX(SkScalarSignAsScalar(inverse.getSkewX()));
2507 upright.setSkewY(SkScalarSignAsScalar(inverse.getSkewY()));
2508
2509 SkBitmap uprighted;
2510 SkISize size = auto_compute_translate(&upright, bitmap->width(), bitmap->height());
2511 uprighted.allocPixels(bitmap->info().makeDimensions(size));
2512
2513 SkCanvas canvas(uprighted);
2514 canvas.concat(upright);
2515 SkPaint paint;
2516 paint.setBlendMode(SkBlendMode::kSrc);
2517 canvas.drawImage(bitmap->asImage(), 0, 0, SkSamplingOptions(), &paint);
2518
2519 *bitmap = uprighted;
2520 return Result::Ok();
2521}
static SkScalar SkScalarSignAsScalar(SkScalar x)
Definition: SkScalar.h:95
static Result Ok()
Definition: DMSrcSink.h:50
static Result Fatal(const char *fmt,...) SK_PRINTF_LIKE(1
std::unique_ptr< Sink > fSink
Definition: DMSrcSink.h:643
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
SkScalar getSkewY() const
Definition: SkMatrix.h:430
SkMatrix & setSkewX(SkScalar v)
Definition: SkMatrix.h:518
SkScalar getSkewX() const
Definition: SkMatrix.h:438
bool invert(SkMatrix *inverse) const
Definition: SkMatrix.h:1206
bool rectStaysRect() const
Definition: SkMatrix.h:271
SkScalar getScaleX() const
Definition: SkMatrix.h:415
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
SkScalar getScaleY() const
Definition: SkMatrix.h:422
SkMatrix & setScaleY(SkScalar v)
Definition: SkMatrix.h:506
SkMatrix & setSkewY(SkScalar v)
Definition: SkMatrix.h:512
SkMatrix & setScaleX(SkScalar v)
Definition: SkMatrix.h:500
const Paint & paint
Definition: color_source.cc:38
GAsyncResult * result
static SkISize auto_compute_translate(SkMatrix *matrix, int srcW, int srcH)
Definition: DMSrcSink.cpp:2469
Definition: bitmap.py:1
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: SkSize.h:16

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