Flutter Engine
The Flutter Engine
Enumerations | Functions
SkEncodedOrigin.h File Reference
#include "include/core/SkMatrix.h"

Go to the source code of this file.

Enumerations

enum  SkEncodedOrigin {
  kTopLeft_SkEncodedOrigin = 1 , kTopRight_SkEncodedOrigin = 2 , kBottomRight_SkEncodedOrigin = 3 , kBottomLeft_SkEncodedOrigin = 4 ,
  kLeftTop_SkEncodedOrigin = 5 , kRightTop_SkEncodedOrigin = 6 , kRightBottom_SkEncodedOrigin = 7 , kLeftBottom_SkEncodedOrigin = 8 ,
  kDefault_SkEncodedOrigin = kTopLeft_SkEncodedOrigin , kLast_SkEncodedOrigin = kLeftBottom_SkEncodedOrigin
}
 

Functions

static SkMatrix SkEncodedOriginToMatrix (SkEncodedOrigin origin, int w, int h)
 
static bool SkEncodedOriginSwapsWidthHeight (SkEncodedOrigin origin)
 

Enumeration Type Documentation

◆ SkEncodedOrigin

Enumerator
kTopLeft_SkEncodedOrigin 
kTopRight_SkEncodedOrigin 
kBottomRight_SkEncodedOrigin 
kBottomLeft_SkEncodedOrigin 
kLeftTop_SkEncodedOrigin 
kRightTop_SkEncodedOrigin 
kRightBottom_SkEncodedOrigin 
kLeftBottom_SkEncodedOrigin 
kDefault_SkEncodedOrigin 
kLast_SkEncodedOrigin 

Definition at line 14 of file SkEncodedOrigin.h.

14 {
15 kTopLeft_SkEncodedOrigin = 1, // Default
16 kTopRight_SkEncodedOrigin = 2, // Reflected across y-axis
17 kBottomRight_SkEncodedOrigin = 3, // Rotated 180
18 kBottomLeft_SkEncodedOrigin = 4, // Reflected across x-axis
19 kLeftTop_SkEncodedOrigin = 5, // Reflected across x-axis, Rotated 90 CCW
20 kRightTop_SkEncodedOrigin = 6, // Rotated 90 CW
21 kRightBottom_SkEncodedOrigin = 7, // Reflected across x-axis, Rotated 90 CW
22 kLeftBottom_SkEncodedOrigin = 8, // Rotated 90 CCW
25};
@ kBottomLeft_SkEncodedOrigin
@ kLast_SkEncodedOrigin
@ kLeftTop_SkEncodedOrigin
@ kTopRight_SkEncodedOrigin
@ kBottomRight_SkEncodedOrigin
@ kTopLeft_SkEncodedOrigin
@ kLeftBottom_SkEncodedOrigin
@ kRightBottom_SkEncodedOrigin
@ kDefault_SkEncodedOrigin
@ kRightTop_SkEncodedOrigin

Function Documentation

◆ SkEncodedOriginSwapsWidthHeight()

static bool SkEncodedOriginSwapsWidthHeight ( SkEncodedOrigin  origin)
inlinestatic

Return true if the encoded origin includes a 90 degree rotation, in which case the width and height of the source data are swapped relative to a correctly oriented destination.

Definition at line 50 of file SkEncodedOrigin.h.

50 {
51 return origin >= kLeftTop_SkEncodedOrigin;
52}

◆ SkEncodedOriginToMatrix()

static SkMatrix SkEncodedOriginToMatrix ( SkEncodedOrigin  origin,
int  w,
int  h 
)
inlinestatic

Given an encoded origin and the width and height of the source data, returns a matrix that transforms the source rectangle with upper left corner at [0, 0] and origin to a correctly oriented destination rectangle of [0, 0, w, h].

Definition at line 32 of file SkEncodedOrigin.h.

32 {
33 switch (origin) {
35 case kTopRight_SkEncodedOrigin: return SkMatrix::MakeAll(-1, 0, w, 0, 1, 0, 0, 0, 1);
36 case kBottomRight_SkEncodedOrigin: return SkMatrix::MakeAll(-1, 0, w, 0, -1, h, 0, 0, 1);
37 case kBottomLeft_SkEncodedOrigin: return SkMatrix::MakeAll( 1, 0, 0, 0, -1, h, 0, 0, 1);
38 case kLeftTop_SkEncodedOrigin: return SkMatrix::MakeAll( 0, 1, 0, 1, 0, 0, 0, 0, 1);
39 case kRightTop_SkEncodedOrigin: return SkMatrix::MakeAll( 0, -1, w, 1, 0, 0, 0, 0, 1);
40 case kRightBottom_SkEncodedOrigin: return SkMatrix::MakeAll( 0, -1, w, -1, 0, h, 0, 0, 1);
41 case kLeftBottom_SkEncodedOrigin: return SkMatrix::MakeAll( 0, 1, 0, -1, 0, h, 0, 0, 1);
42 }
43 SK_ABORT("Unexpected origin");
44}
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Definition: SkMatrix.h:179
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
SkScalar w
SkScalar h