Flutter Engine
The Flutter Engine
Functions
SkDevice.cpp File Reference
#include "src/core/SkDevice.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkColorType.h"
#include "include/core/SkDrawable.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathTypes.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkRRect.h"
#include "include/core/SkRSXform.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkSpan.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/core/SkVertices.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/chromium/Slug.h"
#include "src/core/SkEnumerate.h"
#include "src/core/SkImageFilterTypes.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkLatticeIter.h"
#include "src/core/SkMatrixPriv.h"
#include "src/core/SkMemset.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkScalerContext.h"
#include "src/core/SkSpecialImage.h"
#include "src/text/GlyphRun.h"
#include "src/utils/SkPatchUtils.h"
#include <cstdint>

Go to the source code of this file.

Functions

static bool is_int (float x)
 
static SkPointquad_to_tris (SkPoint tris[6], const SkPoint quad[4])
 
static sk_sp< SkShadermake_post_inverse_lm (const SkShader *shader, const SkMatrix &lm)
 

Function Documentation

◆ is_int()

static bool is_int ( float  x)
inlinestatic

Definition at line 109 of file SkDevice.cpp.

109 {
110 return x == (float) sk_float_round2int(x);
111}
#define sk_float_round2int(x)
double x

◆ make_post_inverse_lm()

static sk_sp< SkShader > make_post_inverse_lm ( const SkShader shader,
const SkMatrix lm 
)
static

Definition at line 401 of file SkDevice.cpp.

401 {
402 SkMatrix inverse_lm;
403 if (!shader || !lm.invert(&inverse_lm)) {
404 return nullptr;
405 }
406
407#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) // b/256873449
408 // Legacy impl for old concat order. This does not work for arbitrary shader DAGs (when there is
409 // no single leaf local matrix).
410
411 // LMs pre-compose. In order to push a post local matrix, we peel off any existing local matrix
412 // and set a new local matrix of inverse_lm * prev_local_matrix.
413 SkMatrix prev_local_matrix;
414 const auto nested_shader = as_SB(shader)->makeAsALocalMatrixShader(&prev_local_matrix);
415 if (nested_shader) {
416 // unfurl the shader
417 shader = nested_shader.get();
418 }
419
420 return shader->makeWithLocalMatrix(inverse_lm * prev_local_matrix);
421#endif
422
423 return shader->makeWithLocalMatrix(inverse_lm);
424}
SkShaderBase * as_SB(SkShader *shader)
Definition: SkShaderBase.h:412
bool invert(SkMatrix *inverse) const
Definition: SkMatrix.h:1206
virtual sk_sp< SkShader > makeAsALocalMatrixShader(SkMatrix *localMatrix) const
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
Definition: SkShader.cpp:26

◆ quad_to_tris()

static SkPoint * quad_to_tris ( SkPoint  tris[6],
const SkPoint  quad[4] 
)
static

Definition at line 191 of file SkDevice.cpp.

191 {
192 tris[0] = quad[0];
193 tris[1] = quad[1];
194 tris[2] = quad[2];
195
196 tris[3] = quad[0];
197 tris[4] = quad[2];
198 tris[5] = quad[3];
199
200 return tris + 6;
201}