Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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/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 108 of file SkDevice.cpp.

108 {
109 return x == (float) sk_float_round2int(x);
110}
#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 406 of file SkDevice.cpp.

406 {
407 SkMatrix inverse_lm;
408 if (!shader || !lm.invert(&inverse_lm)) {
409 return nullptr;
410 }
411
412#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) // b/256873449
413 // Legacy impl for old concat order. This does not work for arbitrary shader DAGs (when there is
414 // no single leaf local matrix).
415
416 // LMs pre-compose. In order to push a post local matrix, we peel off any existing local matrix
417 // and set a new local matrix of inverse_lm * prev_local_matrix.
418 SkMatrix prev_local_matrix;
419 const auto nested_shader = as_SB(shader)->makeAsALocalMatrixShader(&prev_local_matrix);
420 if (nested_shader) {
421 // unfurl the shader
422 shader = nested_shader.get();
423 }
424
425 return shader->makeWithLocalMatrix(inverse_lm * prev_local_matrix);
426#endif
427
428 return shader->makeWithLocalMatrix(inverse_lm);
429}
SkShaderBase * as_SB(SkShader *shader)
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 192 of file SkDevice.cpp.

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