Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
skiagm Namespace Reference

Namespaces

namespace  ColrV1TestDefinitions
 
namespace  verifiers
 

Classes

class  AARectEffect
 
class  AndroidBlendModesGM
 
class  AnisoMipsGM
 
class  AnisotropicGM
 
class  ArcOfZorroGM
 
class  BatchedConvexPathsGM
 
class  BC1TransparencyGM
 
class  BezierConicEffects
 
class  BezierConicTestOp
 
class  BezierQuadEffects
 
class  BezierQuadTestOp
 
class  BezierTestOp
 
class  BigBlursGM
 
class  BigRRectAAEffectGM
 
class  BigTileImageFilterGM
 
class  BitmapImageGM
 
class  BitmapPremulGM
 
class  BitmapShaderGM
 
class  BlurredClippedCircleGM
 
class  ColorCubeGM
 
class  ColorEmojiGM
 
class  ColorProcessor
 
class  ColrV1GM
 
class  ComplexClip2GM
 
class  ComplexClip3GM
 
class  ComplexClip4GM
 
class  ComplexClipBlurTiledGM
 
class  ComplexClipGM
 
class  ConicalGradientsGM
 
class  ContourStartGM
 
class  ConvexLineOnlyPathsGM
 
class  ConvexPolyClip
 
class  ConvexPolyEffect
 
class  CropImageFilterGM
 
class  CroppedRectsGM
 
class  DegenerateSegmentsGM
 
class  DiscardGM
 
class  DisplacementMapGM
 
class  DistantClipGM
 
class  DrawImageSetAlphaOnlyGM
 
class  DrawImageSetGM
 
class  DrawImageSetRectToRectGM
 
class  DrawQuadSetGM
 
class  DstReadShuffle
 
class  EmptyPathGM
 
class  EmptyShaderGM
 
class  EmptyStrokeGM
 
class  EncodeColorTypesGM
 
class  EncodeGM
 
class  EncodeJpegAlphaOptsGM
 
class  EncodePlatformGM
 
class  EncodeSRGBGM
 
class  ExoticFormatsGM
 
class  FillTypeGM
 
class  FillTypePerspGM
 
class  FontationsFtCompareGM
 
class  FontationsTypefaceGM
 
class  FontPaletteGM
 
class  FontScalerDistortableGM
 
class  FontScalerGM
 
class  GM
 
struct  GradData
 
class  GraphiteReplayGM
 
class  GraphiteStartGM
 
class  HairlinesGM
 
class  HairModesGM
 
class  ImageBlurClampModeGM
 
class  ImageBlurRepeatModeGM
 
class  ImageBlurTiledGM
 
class  ImageFilterFastBoundGM
 
class  ImageFiltersClippedGM
 
class  ImageFiltersScaledGM
 
class  ImageFiltersStrokedGM
 
class  ImageFiltersTransformedGM
 
class  ImageFromYUV
 
class  ImageLightingGM
 
class  ImageSourceGM
 
class  InnerShapesGM
 
struct  LabeledMatrix
 
class  LazyTilingGM
 
class  LcdBlendGM
 
class  LcdOverlapGM
 
class  LocalMatrixOrder
 
class  MandolineSlicer
 
class  ManyCirclesGM
 
class  ManyPathAtlasesGM
 
class  ManyRRectsGM
 
class  MatrixConvolutionGM
 
class  MeshColorSpaceGM
 
class  MeshGM
 
class  MeshUniformsGM
 
class  MeshUpdateGM
 
class  MeshWithShadersGM
 
class  MeshZeroInitGM
 
class  MixedTextBlobsGM
 
class  ModeColorFilterGM
 
class  MorphologyGM
 
class  NestedGM
 
class  NonClosedPathsGM
 
class  OffscreenShapeRenderer
 
class  OvalGM
 
class  PathEffectGM
 
class  PathOpsInverseGM
 
class  PathRenderer
 
class  PerspImages
 
class  PerspShadersGM
 
class  PictureMesh
 
class  PointsGM
 
class  PolygonOffsetGM
 
class  PolygonsGM
 
class  PreserveFillRuleGM
 
class  QuadClosePathGM
 
class  QuadPathGM
 
class  RectRenderer
 
class  ResizeGM
 
class  RoundRectGM
 
class  RRectGM
 
class  SamplerStressGM
 
class  ScaledEmojiGM
 
class  ScaledEmojiPerspectiveGM
 
class  ScaledEmojiPosGM
 
class  ScaledEmojiRenderingGM
 
class  ScaledRectsGM
 
class  ShaderPathGM
 
class  ShaderText3GM
 
class  ShapeRenderer
 
class  ShapesGM
 
class  SharedCornersGM
 
class  SimpleClipGM
 
class  SimpleGM
 
class  SimpleShapesGM
 
class  SliverPathsGM
 
class  StLouisArchGM
 
class  StrokedLinesGM
 
class  StrokeRectsGM
 
class  TexelSubset
 
class  TextBlobBlockReordering
 
class  TextBlobColorTrans
 
class  TextBlobGeometryChange
 
class  TextBlobMixedSizes
 
class  TextBlobRandomFont
 
class  TextBlobTransforms
 
class  TextBlobUseAfterGpuFree
 
class  ThinAASlide
 
class  ThinRectsGM
 
class  ThinStrokedRectsGM
 
class  TiledScaledBitmapGM
 
class  TileImageFilterGM
 
class  WackyYUVFormatsGM
 
class  WindowRectanglesGM
 
class  XfermodeImageFilterGM
 
class  Xfermodes2GM
 
class  Xfermodes3GM
 
class  YUVMakeColorSpaceGM
 
class  YUVtoRGBSubsetEffect
 

Typedefs

typedef void(* drawMth) (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
using GMFactory = std::function< std::unique_ptr< skiagm::GM >()>
 
using GMRegistry = sk_tools::Registry< GMFactory >
 
using GMRegistererFn = std::function< std::string()>
 
using GMRegistererFnRegistry = sk_tools::Registry< GMRegistererFn >
 
typedef sk_sp< SkShader >(* GradMaker) (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
typedef void(* PE_Proc) (SkPaint *)
 

Enumerations

enum class  Variant { kOpaque , kGray , kNormal }
 
enum class  DrawResult { kOk , kFail , kSkip }
 
enum  GradCaseType { kOutside_GradCaseType , kInside_GradCaseType , kEdge_GradCaseType }
 
enum  KernelFixture { kBasic_KernelFixture , kLarge_KernelFixture }
 

Functions

static sk_sp< SkImagedraw_bm ()
 
static sk_sp< SkImagedraw_mask ()
 
 DEF_SIMPLE_GM (hugebitmapshader, canvas, 100, 100)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (clear_swizzle, rContext, canvas, errorMsg, 6 *kSize, 2 *kSize)
 
 DEF_GM (return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
 
static sk_sp< SkImagecreate_image (SkCanvas *destCanvas)
 
 DEF_SIMPLE_GM (destcolor, canvas, 640, 640)
 
static SkPath make_path_move ()
 
static SkPath make_path_move_close ()
 
static SkPath make_path_move_line ()
 
static SkPath make_path_move_mix ()
 
static void read_into_pixmap (SkPixmap *dst, SkImageInfo dstInfo, void *dstPixels, sk_sp< SkImage > src)
 
static sk_sp< SkImageencode_pixmap_and_make_image (const SkPixmap &src, SkJpegEncoder::AlphaOption alphaOption)
 
static sk_sp< SkImagemake_image (SkColorType colorType, SkAlphaType alphaType)
 
static void make (SkBitmap *bitmap, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace)
 
static sk_sp< SkDataencode_data (const SkBitmap &bitmap, SkEncodedImageFormat format)
 
static void draw_rect (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void draw_oval (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void draw_rrect (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void draw_drrect (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void draw_path (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void draw_points (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void draw_bitmap (SkCanvas *canvas, const SkRect &r, const SkPaint &p)
 
static void add_paint (TArray< SkPaint > *paints, sk_sp< SkImageFilter > filter)
 
static void create_paints (TArray< SkPaint > *paints, sk_sp< SkImageFilter > source)
 
 DEF_GM (return new FontationsTypefaceGM("distortable_light", "fonts/Distortable.ttf", {{"wght"_t, 0.5f}})) DEF_GM(return new FontationsTypefaceGM("distortable_bold"
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans", "Noto Sans", "en_Latn|es_Latn|pt_Latn|id_Latn|ru_Cyrl|fr_Latn|tr_Latn|vi_Latn|de_" "Latn|it_Latn|pl_Latn|nl_Latn|uk_Cyrl|gl_Latn|ro_Latn|cs_Latn|hu_Latn|" "el_Grek|se_Latn|da_Latn|bg_Latn|sk_Latn|fi_Latn|bs_Latn|ca_Latn|no_" "Latn|sr_Latn|sr_Cyrl|lt_Latn|hr_Latn|sl_Latn|uz_Latn|uz_Cyrl|lv_Latn|" "et_Latn|az_Latn|az_Cyrl|la_Latn|tg_Latn|tg_Cyrl|sw_Latn|mn_Cyrl|kk_" "Latn|kk_Cyrl|sq_Latn|af_Latn|ha_Latn|ky_Cyrl"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Deva", "Noto Sans Devanagari", "hi_Deva|mr_Deva"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_ar_Arab", "Noto Sans Arabic", "ar_Arab|uz_Arab|kk_Arab|ky_Arab"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Beng", "Noto Sans Bengali", "bn_Beng"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Jpan", "Noto Sans JP", "ja_Jpan"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Thai", "Noto Sans Thai", "th_Thai"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Hans", "Noto Sans SC", "zh_Hans"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Hant", "Noto Sans TC", "zh_Hant"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Kore", "Noto Sans KR", "ko_Kore"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Taml", "Noto Sans Tamil", "ta_Taml"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Newa", "Noto Sans Newa", "new_Newa"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Knda", "Noto Sans Kannada", "kn_Knda"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Tglg", "Noto Sans Tagalog", "fil_Tglg"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Telu", "Noto Sans Telugu", "te_Telu"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Gujr", "Noto Sans Gujarati", "gu_Gujr"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Geor", "Noto Sans Georgian", "ka_Geor"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Mlym", "Noto Sans Malayalam", "ml_Mlym"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Khmr", "Noto Sans Khmer", "km_Khmr"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Sinh", "Noto Sans Sinhala", "si_Sinh"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Mymr", "Noto Sans Myanmar", "my_Mymr"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Java", "Noto Sans Javanese", "jv_Java"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Mong", "Noto Sans Mongolian", "mn_Mong"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Armn", "Noto Sans Armenian", "hy_Armn"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Elba", "Noto Sans Elbasan", "sq_Elba"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Vith", "Noto Sans Vithkuqi", "sq_Vith"))
 
 DEF_GM (return new FontationsFtCompareGM("NotoSans_Guru", "Noto Sans Gurmukhi", "pa_Guru"))
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (fp_sample_chaining, rContext, canvas, errorMsg, 232, 306)
 
void Register (skiagm::GM *gm)
 
static GM::DrawResult run (GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg, bool subsetSrc, bool ref)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (gpu_blur_utils, rContext, canvas, errorMsg, 765, 955)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (gpu_blur_utils_ref, rContext, canvas, errorMsg, 765, 955)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (gpu_blur_utils_subset_rect, rContext, canvas, errorMsg, 485, 730)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (gpu_blur_utils_subset_ref, rContext, canvas, errorMsg, 485, 730)
 
static DrawResult do_very_large_blur_gm (GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg, GrSurfaceProxyView src, SkIRect srcB)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (very_large_sigma_gpu_blur, rContext, canvas, errorMsg, 350, 1030)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (very_large_sigma_gpu_blur_subset, rContext, canvas, errorMsg, 350, 1030)
 
 DEF_SIMPLE_GPU_GM_CAN_FAIL (very_large_sigma_gpu_blur_subset_transparent_border, rContext, canvas, errorMsg, 355, 1055)
 
static sk_sp< SkShaderMake2ConicalOutside (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalOutsideStrip (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalOutsideFlip (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalInside (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalInsideFlip (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalInsideCenter (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalInsideCenterReversed (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRad (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRadFlip (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRadCenter (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRadOutside (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRadFlipOutside (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalEdgeX (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalEdgeY (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRadEdgeX (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalZeroRadEdgeY (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalTouchX (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalTouchY (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static sk_sp< SkShaderMake2ConicalInsideSmallRad (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
 
static void draw_squarehair_tests (SkCanvas *canvas, SkScalar width, SkPaint::Cap cap, bool aa)
 
 DEF_SIMPLE_GM (squarehair, canvas, 240, 360)
 
static void draw_subdivided_quad (SkCanvas *canvas, int x0, int y0, int x1, int y1, SkColor color)
 
 DEF_SIMPLE_GM (hairline_subdiv, canvas, 512, 256)
 
static sk_sp< SkImagemake_gradient_circle (int width, int height)
 
 DEF_GM (return new ImageSourceGM("none", SkSamplingOptions());) DEF_GM(return new ImageSourceGM("low"
 
 SkSamplingOptions (SkFilterMode::kLinear))
 
 DEF_GM (return new ImageSourceGM("med", SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear));) DEF_GM(return new ImageSourceGM("high"
 
 SkSamplingOptions ({1/3.0f, 1/3.0f}))
 
static sk_sp< SkShadermake_shader (const SkRect &bounds)
 
static SkColor gen_color (SkRandom *rand)
 
static sk_sp< SkMesh::VertexBuffermake_vertex_buffer (GrDirectContext *ctx, const void *data, size_t size)
 
static sk_sp< SkMesh::IndexBuffermake_index_buffer (GrDirectContext *ctx, const void *data, size_t size)
 
 DEF_SIMPLE_GM_CAN_FAIL (custommesh_cs_uniforms, canvas, errorMsg, 200, 900)
 
static void draw_blob (SkCanvas *canvas, const SkTextBlob *blob, const SkPaint &skPaint, const SkRect &clipRect)
 
static sk_sp< SkShadermake_color_shader (SkColor color)
 
static sk_sp< SkShadermake_solid_shader ()
 
static sk_sp< SkShadermake_transparent_shader ()
 
static sk_sp< SkShadermake_trans_black_shader ()
 
static sk_sp< SkShadermake_bg_shader (int checkSize)
 
 DEF_SIMPLE_GM (nested_hairline_square, canvas, 64, 64)
 
 DEF_GM (return new FontPaletteGM("default", SkFontArguments::Palette()))
 
 DEF_GM (return new FontPaletteGM("light", kLightPaletteOverride))
 
 DEF_GM (return new FontPaletteGM("dark", kDarkPaletteOverride))
 
 DEF_GM (return new FontPaletteGM("one", kOnePaletteOverride))
 
 DEF_GM (return new FontPaletteGM("all", kAllPaletteOverride))
 
static void compose_pe (SkPaint *paint)
 
static void hair_pe (SkPaint *paint)
 
static void hair2_pe (SkPaint *paint)
 
static void stroke_pe (SkPaint *paint)
 
static void dash_pe (SkPaint *paint)
 
static SkPath scale (const SkPath &path, SkScalar scale)
 
static void one_d_pe (SkPaint *paint)
 
static void fill_pe (SkPaint *paint)
 
static void discrete_pe (SkPaint *paint)
 
static sk_sp< SkPathEffectMakeTileEffect ()
 
static void tile_pe (SkPaint *paint)
 
 DEF_SIMPLE_GM (conjoined_polygons, canvas, 400, 400)
 
static SkColor gen_color (SkRandom *rand)
 
 DEF_SIMPLE_GM (stroke_rect_rrects, canvas, 1350, 700)
 
static void makebm (SkBitmap *bm, int w, int h)
 
static void makebm (SkBitmap *bm, int w, int h)
 
static void paint_rgn (SkCanvas *canvas, const SkAAClip &clip, const SkPaint &paint)
 
 DEF_SIMPLE_GM (stroke_rect_shader, canvas, 690, 300)
 
static void draw_path (SkCanvas *canvas, const SkPoint &p0, const SkPoint &p1, SkPaint::Cap cap)
 
 DEF_SIMPLE_GM (strokedline_caps, canvas, 1400, 740)
 
 DEF_GM (return new WackyYUVFormatsGM(false, false, false, WackyYUVFormatsGM::Type::kFromTextures);) DEF_GM(return new WackyYUVFormatsGM(false
 
 DEF_GM (return new WackyYUVFormatsGM(true, false, false, WackyYUVFormatsGM::Type::kFromTextures);) DEF_GM(return new WackyYUVFormatsGM(false
 
 DEF_GM (return new WackyYUVFormatsGM(false, false, false, WackyYUVFormatsGM::Type::kFromGenerator);) DEF_GM(return new WackyYUVFormatsGM(false
 
 DEF_GM (return new XfermodeImageFilterGM;)
 

Variables

constexpr int kSize = 700
 
constexpr SkColor gPathColor = SK_ColorBLACK
 
constexpr SkColor gClipAColor = SK_ColorBLUE
 
constexpr SkColor gClipBColor = SK_ColorRED
 
constexpr SkRect kSrcImageClip {75, 75, 275, 275}
 
static constexpr int kPtsCount = 3
 
static constexpr SkPoint kPts [kPtsCount]
 
static const int imageWidth = 128
 
static const int imageHeight = 128
 
static const int imageWidth = 128
 
static const int imageHeight = 128
 
constexpr drawMth gDrawMthds []
 
fonts Distortable ttf
 
static bool constexpr kShowSlowRefImages = false
 
constexpr SkColor gColors []
 
constexpr SkScalar gPos0 [] = { 0, SK_Scalar1 }
 
constexpr SkScalar gPos1 [] = { SK_Scalar1/4, SK_Scalar1*3/4 }
 
constexpr SkScalar gPos2 []
 
constexpr SkScalar gPosClamp [] = {0.0f, 0.0f, 1.0f, 1.0f}
 
constexpr SkColor gColorClamp []
 
constexpr GradData gGradData []
 
constexpr GradMaker gGradMakersOutside []
 
constexpr GradMaker gGradMakersInside []
 
constexpr GradMaker gGradMakersEdgeCases []
 
struct { 
 
   const GradMaker *   skiagm::fMaker 
 
   const int   skiagm::fCount 
 
   const char *   skiagm::fName 
 
gGradCases [] 
 
constexpr int kColWidth = 180
 
constexpr int kNumCols = 4
 
constexpr int kWidth = kColWidth * kNumCols
 
constexpr int kHeight = 750
 
constexpr int gXY []
 
constexpr PE_Proc gPE [] = { hair_pe, hair2_pe, stroke_pe, dash_pe, one_d_pe }
 
constexpr PE_Proc gPE2 [] = { fill_pe, discrete_pe, tile_pe }
 
constexpr int kPointSize = 300
 
static constexpr int kPadSize = 20
 
static constexpr int kBoxSize = 100
 
static constexpr SkPoint kJitters [] = {{0, 0}, {.5f, .5f}, {2/3.f, 1/3.f}}
 
static constexpr float kStrokeWidth = 20.f
 
constexpr SkScalar SW = SkIntToScalar(W)
 
constexpr SkScalar SH = SkIntToScalar(H)
 
 true
 
 false
 

Typedef Documentation

◆ drawMth

typedef void(* skiagm::drawMth) (SkCanvas *canvas, const SkRect &r, const SkPaint &p)

Definition at line 38 of file filterfastbounds.cpp.

◆ GMFactory

using skiagm::GMFactory = typedef std::function<std::unique_ptr<skiagm::GM>()>

Definition at line 239 of file gm.h.

◆ GMRegistererFn

using skiagm::GMRegistererFn = typedef std::function<std::string()>

Definition at line 254 of file gm.h.

◆ GMRegistererFnRegistry

Definition at line 255 of file gm.h.

◆ GMRegistry

Definition at line 240 of file gm.h.

◆ GradMaker

typedef sk_sp< SkShader >(* skiagm::GradMaker) (const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)

Definition at line 282 of file gradients_2pt_conical.cpp.

◆ PE_Proc

typedef void(* skiagm::PE_Proc) (SkPaint *)

Definition at line 89 of file patheffects.cpp.

Enumeration Type Documentation

◆ DrawResult

enum class skiagm::DrawResult
strong
Enumerator
kOk 
kFail 
kSkip 

Definition at line 104 of file gm.h.

104 {
105 kOk, // Test drew successfully.
106 kFail, // Test failed to draw.
107 kSkip // Test is not applicable in this context and should be skipped.
108 };

◆ GradCaseType

Enumerator
kOutside_GradCaseType 
kInside_GradCaseType 
kEdge_GradCaseType 

Definition at line 315 of file gradients_2pt_conical.cpp.

315 { // these must match the order in gGradCases
319};

◆ KernelFixture

Enumerator
kBasic_KernelFixture 
kLarge_KernelFixture 

Definition at line 33 of file matrixconvolution.cpp.

◆ Variant

enum class skiagm::Variant
strong
Enumerator
kOpaque 
kGray 
kNormal 

Definition at line 67 of file encode_color_types.cpp.

67 {
68 // One pair, using an opaque image.
69 kOpaque,
70 // One pair, using a grayscale image.
71 kGray,
72 // An opaque pair followed by two more for premul and unpremul.
73 kNormal,
74};
@ kNormal
Default priority level.
Definition embedder.h:260

Function Documentation

◆ add_paint()

static void skiagm::add_paint ( TArray< SkPaint > *  paints,
sk_sp< SkImageFilter filter 
)
static

Definition at line 98 of file filterfastbounds.cpp.

98 {
99 SkPaint& p = paints->push_back();
100 p.setImageFilter(std::move(filter));
101 SkASSERT(p.canComputeFastBounds());
102}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ compose_pe()

static void skiagm::compose_pe ( SkPaint paint)
static

Definition at line 32 of file patheffects.cpp.

32 {
33 SkPathEffect* pe = paint->getPathEffect();
35 sk_sp<SkPathEffect> compose;
36 if (pe) {
37 compose = SkPathEffect::MakeCompose(sk_ref_sp(pe), corner);
38 } else {
39 compose = corner;
40 }
41 paint->setPathEffect(compose);
42}
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
static sk_sp< SkPathEffect > Make(SkScalar radius)
static sk_sp< SkPathEffect > MakeCompose(sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)
const Paint & paint

◆ create_image()

static sk_sp< SkImage > skiagm::create_image ( SkCanvas destCanvas)
static

Definition at line 28 of file croppedrects.cpp.

28 {
30 SkCanvas* srcCanvas = srcSurface->getCanvas();
31
32 srcCanvas->clear(SK_ColorRED);
33
35 paint.setColor(0xff00ff00);
36 srcCanvas->drawRect(kSrcImageClip, paint);
37
38 constexpr SkScalar kStrokeWidth = 10;
39 SkPaint stroke;
42 stroke.setColor(0xff008800);
43 srcCanvas->drawRect(kSrcImageClip.makeInset(kStrokeWidth / 2, kStrokeWidth / 2), stroke);
44
45 return ToolUtils::MakeTextureImage(destCanvas, srcSurface->makeImageSnapshot());
46}
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
void drawRect(const SkRect &rect, const SkPaint &paint)
void clear(SkColor color)
Definition SkCanvas.h:1199
void setStyle(Style style)
Definition SkPaint.cpp:105
void setColor(SkColor color)
Definition SkPaint.cpp:119
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
void setStrokeWidth(SkScalar width)
Definition SkPaint.cpp:159
float SkScalar
Definition extension.cpp:12
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
sk_sp< SkImage > MakeTextureImage(SkCanvas *canvas, sk_sp< SkImage > orig)
constexpr SkRect kSrcImageClip
constexpr SkScalar kStrokeWidth
static SkImageInfo MakeN32Premul(int width, int height)
SkRect makeInset(float dx, float dy) const
Definition SkRect.h:987

◆ create_paints()

static void skiagm::create_paints ( TArray< SkPaint > *  paints,
sk_sp< SkImageFilter source 
)
static

Definition at line 105 of file filterfastbounds.cpp.

105 {
106 {
108 scale.setScale(2.0f, 2.0f);
109
110 sk_sp<SkImageFilter> scaleMIF(
112 source));
113
114 add_paint(paints, std::move(scaleMIF));
115 }
116
117 {
118 SkMatrix rot;
119 rot.setRotate(-33.3f);
120
123
124 add_paint(paints, std::move(rotMIF));
125 }
126
127 {
128 SkRect src = SkRect::MakeXYWH(20, 20, 10, 10);
129 SkRect dst = SkRect::MakeXYWH(30, 30, 30, 30);
130 sk_sp<SkImageFilter> tileIF(SkImageFilters::Tile(src, dst, nullptr));
131
132 add_paint(paints, std::move(tileIF));
133 }
134
135 {
137 SkImageFilters::DropShadow(10.0f, 10.0f, 3.0f, 3.0f, SK_ColorRED, source);
138
139 add_paint(paints, std::move(dsif));
140 }
141
142 {
144 SkImageFilters::DropShadowOnly(27.0f, 27.0f, 3.0f, 3.0f, SK_ColorRED, source);
145
146 add_paint(paints, std::move(dsif));
147 }
148
149 add_paint(paints, SkImageFilters::Blur(3, 3, source));
150 add_paint(paints, SkImageFilters::Offset(15, 15, source));
151}
static sk_sp< SkImageFilter > DropShadow(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > DropShadowOnly(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > Offset(SkScalar dx, SkScalar dy, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Tile(const SkRect &src, const SkRect &dst, sk_sp< SkImageFilter > input)
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition SkMatrix.cpp:296
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition SkMatrix.cpp:452
SkBitmap source
Definition examples.cpp:28
dst
Definition cp.py:12
static void add_paint(TArray< SkPaint > *paints, sk_sp< SkImageFilter > filter)
const Scalar scale
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659

◆ dash_pe()

static void skiagm::dash_pe ( SkPaint paint)
static

Definition at line 58 of file patheffects.cpp.

58 {
59 SkScalar inter[] = { 20, 10, 10, 10 };
60 paint->setStrokeWidth(12);
61 paint->setPathEffect(SkDashPathEffect::Make(inter, std::size(inter), 0));
63}
static void compose_pe(SkPaint *paint)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)

◆ DEF_GM() [1/39]

skiagm::DEF_GM ( return   FC(clipbox), 0.0f, 0.0f, {})

◆ DEF_GM() [2/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans", "Noto Sans", "en_Latn|es_Latn|pt_Latn|id_Latn|ru_Cyrl|fr_Latn|tr_Latn|vi_Latn|de_" "Latn|it_Latn|pl_Latn|nl_Latn|uk_Cyrl|gl_Latn|ro_Latn|cs_Latn|hu_Latn|" "el_Grek|se_Latn|da_Latn|bg_Latn|sk_Latn|fi_Latn|bs_Latn|ca_Latn|no_" "Latn|sr_Latn|sr_Cyrl|lt_Latn|hr_Latn|sl_Latn|uz_Latn|uz_Cyrl|lv_Latn|" "et_Latn|az_Latn|az_Cyrl|la_Latn|tg_Latn|tg_Cyrl|sw_Latn|mn_Cyrl|kk_" "Latn|kk_Cyrl|sq_Latn|af_Latn|ha_Latn|ky_Cyrl")

◆ DEF_GM() [3/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_ar_Arab", "Noto Sans Arabic", "ar_Arab|uz_Arab|kk_Arab|ky_Arab")

◆ DEF_GM() [4/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Armn", "Noto Sans Armenian", "hy_Armn")

◆ DEF_GM() [5/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Beng", "Noto Sans Bengali", "bn_Beng")

◆ DEF_GM() [6/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Deva", "Noto Sans Devanagari", "hi_Deva|mr_Deva")

◆ DEF_GM() [7/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Elba", "Noto Sans Elbasan", "sq_Elba")

◆ DEF_GM() [8/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Geor", "Noto Sans Georgian", "ka_Geor")

◆ DEF_GM() [9/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Gujr", "Noto Sans Gujarati", "gu_Gujr")

◆ DEF_GM() [10/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Guru", "Noto Sans Gurmukhi", "pa_Guru")

◆ DEF_GM() [11/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Hans", "Noto Sans SC", "zh_Hans")

◆ DEF_GM() [12/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Hant", "Noto Sans TC", "zh_Hant")

◆ DEF_GM() [13/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Java", "Noto Sans Javanese", "jv_Java")

◆ DEF_GM() [14/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Jpan", "Noto Sans JP", "ja_Jpan")

◆ DEF_GM() [15/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Khmr", "Noto Sans Khmer", "km_Khmr")

◆ DEF_GM() [16/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Knda", "Noto Sans Kannada", "kn_Knda")

◆ DEF_GM() [17/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Kore", "Noto Sans KR", "ko_Kore")

◆ DEF_GM() [18/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Mlym", "Noto Sans Malayalam", "ml_Mlym")

◆ DEF_GM() [19/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Mong", "Noto Sans Mongolian", "mn_Mong")

◆ DEF_GM() [20/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Mymr", "Noto Sans Myanmar", "my_Mymr")

◆ DEF_GM() [21/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Newa", "Noto Sans Newa", "new_Newa")

◆ DEF_GM() [22/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Sinh", "Noto Sans Sinhala", "si_Sinh")

◆ DEF_GM() [23/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Taml", "Noto Sans Tamil", "ta_Taml")

◆ DEF_GM() [24/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Telu", "Noto Sans Telugu", "te_Telu")

◆ DEF_GM() [25/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Tglg", "Noto Sans Tagalog", "fil_Tglg")

◆ DEF_GM() [26/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Thai", "Noto Sans Thai", "th_Thai")

◆ DEF_GM() [27/39]

skiagm::DEF_GM ( return new   FontationsFtCompareGM"NotoSans_Vith", "Noto Sans Vithkuqi", "sq_Vith")

◆ DEF_GM() [28/39]

skiagm::DEF_GM ( return new   FontationsTypefaceGM "distortable_light", "fonts/Distortable.ttf", {{"wght"_t, 0.5f}})
new

◆ DEF_GM() [29/39]

skiagm::DEF_GM ( return new   FontPaletteGM"all", kAllPaletteOverride)

◆ DEF_GM() [30/39]

skiagm::DEF_GM ( return new   FontPaletteGM"dark", kDarkPaletteOverride)

◆ DEF_GM() [31/39]

skiagm::DEF_GM ( return new   FontPaletteGM"default", SkFontArguments::Palette())

◆ DEF_GM() [32/39]

skiagm::DEF_GM ( return new   FontPaletteGM"light", kLightPaletteOverride)

◆ DEF_GM() [33/39]

skiagm::DEF_GM ( return new   FontPaletteGM"one", kOnePaletteOverride)

◆ DEF_GM() [34/39]

skiagm::DEF_GM ( return new ImageSourceGM("med", SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear));   )
new

◆ DEF_GM() [35/39]

skiagm::DEF_GM ( return new ImageSourceGM("none", SkSamplingOptions());   )
new

◆ DEF_GM() [36/39]

skiagm::DEF_GM ( return new WackyYUVFormatsGM(false, false, false, WackyYUVFormatsGM::Type::kFromGenerator);   )
new

◆ DEF_GM() [37/39]

skiagm::DEF_GM ( return new WackyYUVFormatsGM(false, false, false, WackyYUVFormatsGM::Type::kFromTextures);   )
new

◆ DEF_GM() [38/39]

skiagm::DEF_GM ( return new WackyYUVFormatsGM(true, false, false, WackyYUVFormatsGM::Type::kFromTextures);   )
new

◆ DEF_GM() [39/39]

skiagm::DEF_GM ( return new XfermodeImageFilterGM )

◆ DEF_SIMPLE_GM() [1/9]

skiagm::DEF_SIMPLE_GM ( conjoined_polygons  ,
canvas  ,
400  ,
400   
)

Definition at line 177 of file polygons.cpp.

177 {
179 b.moveTo(0.f, 120.f);
180 b.lineTo(0.f, 0.f);
181 b.lineTo(50.f, 330.f);
182 b.lineTo(90.f, 0.f);
183 b.lineTo(340.f, 0.f);
184 b.lineTo(90.f, 330.f);
185 b.lineTo(50.f, 330.f);
186 b.close();
187
189 paint.setAntiAlias(true);
190 canvas->drawPath(b.detach(), paint);
191}
SkPathBuilder & close()
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & moveTo(SkPoint pt)
static bool b

◆ DEF_SIMPLE_GM() [2/9]

skiagm::DEF_SIMPLE_GM ( destcolor  ,
canvas  ,
640  ,
640   
)

Definition at line 17 of file destcolor.cpp.

17 {
18 // Draw the mandrill.
19 canvas->drawImage(ToolUtils::GetResourceAsImage("images/mandrill_512.png"), 0, 0);
20
21 // Now let's add our test effect on top. It reads back the original image and inverts it.
23 half4 main(half4 src, half4 dst) {
24 return (half4(1) - dst).rgb1;
25 }
26 )"));
27 SkASSERT(effect);
28 SkPaint invertPaint;
29 invertPaint.setAntiAlias(true);
30 invertPaint.setBlender(effect->makeBlender(nullptr));
31 canvas->drawOval(SkRect::MakeLTRB(128, 128, 640, 640), invertPaint);
32}
void setAntiAlias(bool aa)
Definition SkPaint.h:170
void setBlender(sk_sp< SkBlender > blender)
Definition SkPaint.cpp:155
static Result MakeForBlender(SkString sksl, const Options &)
const uint8_t uint32_t uint32_t GError ** error
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition DecodeUtils.h:25
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646

◆ DEF_SIMPLE_GM() [3/9]

skiagm::DEF_SIMPLE_GM ( hairline_subdiv  ,
canvas  ,
512  ,
256   
)

Definition at line 249 of file hairlines.cpp.

249 {
250 // no subdivisions
251 canvas->translate(45, -25);
252 draw_subdivided_quad(canvas, 334, 334, 467, 267, SK_ColorBLACK);
253
254 // one subdivision
255 canvas->translate(-185, -150);
256 draw_subdivided_quad(canvas, 472, 472, 660, 378, SK_ColorRED);
257
258 // two subdivisions
259 canvas->translate(-275, -200);
260 draw_subdivided_quad(canvas, 668, 668, 934, 535, SK_ColorGREEN);
261
262 // three subdivisions
263 canvas->translate(-385, -260);
264 draw_subdivided_quad(canvas, 944, 944, 1320, 756, SK_ColorBLUE);
265}
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
static void draw_subdivided_quad(SkCanvas *canvas, int x0, int y0, int x1, int y1, SkColor color)

◆ DEF_SIMPLE_GM() [4/9]

skiagm::DEF_SIMPLE_GM ( hugebitmapshader  ,
canvas  ,
100  ,
100   
)

Definition at line 114 of file bitmapshader.cpp.

114 {
117
118 // The huge height will exceed GL_MAX_TEXTURE_SIZE. We test that the GL backend will at least
119 // draw something with a default paint instead of drawing nothing.
120 //
121 // (See https://skia-review.googlesource.com/c/skia/+/73200)
122 int bitmapW = 1;
123 int bitmapH = 60000;
124 if (auto ctx = canvas->recordingContext()) {
125 bitmapH = ctx->priv().caps()->maxTextureSize() + 1;
126 }
127 bitmap.setInfo(SkImageInfo::MakeA8(bitmapW, bitmapH), bitmapW);
128 uint8_t* pixels = new uint8_t[bitmapH];
129 for(int i = 0; i < bitmapH; ++i) {
130 pixels[i] = i & 0xff;
131 }
132 bitmap.setPixels(pixels);
133
136 paint.setColor(SK_ColorRED);
137 paint.setAntiAlias(true);
138 canvas->drawCircle(50, 50, 50, paint);
139 delete [] pixels;
140}
static SkImageInfo MakeA8(int width, int height)

◆ DEF_SIMPLE_GM() [5/9]

skiagm::DEF_SIMPLE_GM ( nested_hairline_square  ,
canvas  ,
64  ,
64   
)

Definition at line 147 of file nested.cpp.

147 {
148 // See crbug.com/1234194 - This should draw 1 row of 3 stroked squares, with a second 0.5px
149 // shifted row of squares below it.
150 auto drawEllipses = [&]() {
151 canvas->save();
152 // Originally the SVG string "M5,14H0V9h5V14Z M1,13h3v-3H1V13Z" but that just specifies a
153 // 5px wide square outside a 3px wide square.
155 square.addRect(SkRect::MakeLTRB(0.f, 9.f, 5.f, 14.f));
157
158 // From the bug, SVG viewbox was (0, 0, 24, 24), so the above coordinates are relative to
159 // that, but the svg was then the child of a div that was 16x16, so it's scaled down. This
160 // converts the 1px wide nested rects into subpixel nested rects.
161 canvas->scale(16.f / 24.f, 16.f / 24.f);
162
164 paint.setColor(SkColorSetARGB(255, 70, 70, 70));
165 paint.setAntiAlias(true);
166
167 // The original SVG drew 3 separate paths, but these were just translations of the original
168 // path baked into a path string.
169 canvas->drawPath(square, paint);
170 canvas->translate(10.f, 0.f);
171 canvas->drawPath(square, paint);
172 canvas->translate(10.f, 0.f);
173 canvas->drawPath(square, paint);
174
175 canvas->restore();
176 };
177
178 drawEllipses();
179 canvas->translate(0.5f, 16.f);
180 drawEllipses();
181}
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition SkColor.h:49
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
Definition SkPath.cpp:854
static int square(int x)
Definition etc1.cpp:302

◆ DEF_SIMPLE_GM() [6/9]

skiagm::DEF_SIMPLE_GM ( squarehair  ,
canvas  ,
240  ,
360   
)

Definition at line 218 of file hairlines.cpp.

218 {
219 const bool aliases[] = { false, true };
220 const SkScalar widths[] = { 0, 0.999f, 1, 1.001f };
222 for (auto alias : aliases) {
223 canvas->save();
224 for (auto width : widths) {
225 for (auto cap : caps) {
226 draw_squarehair_tests(canvas, width, cap, alias);
227 }
228 }
229 canvas->restore();
230 canvas->translate(120, 0);
231 }
232}
const SkScalar widths[]
@ kRound_Cap
adds circle
Definition SkPaint.h:335
@ kButt_Cap
no stroke extension
Definition SkPaint.h:334
@ kSquare_Cap
adds square
Definition SkPaint.h:336
static void draw_squarehair_tests(SkCanvas *canvas, SkScalar width, SkPaint::Cap cap, bool aa)
int32_t width

◆ DEF_SIMPLE_GM() [7/9]

skiagm::DEF_SIMPLE_GM ( stroke_rect_rrects  ,
canvas  ,
1350  ,
700   
)

Definition at line 299 of file rrects.cpp.

299 {
300 canvas->scale(0.5f, 0.5f);
301 canvas->translate(50.f, 50.f);
302
303 auto draw = [&](int cx, int cy, bool rrect, float width, SkPaint::Join join) {
304 SkPaint p;
305 p.setAntiAlias(true);
306 p.setStrokeWidth(width);
307 p.setStyle(width >= 0.f ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
308 p.setStrokeJoin(join);
309
310 canvas->save();
311 canvas->translate(cx * 110.f, cy * 110.f);
312 float dx = cx % 2 ? 0.5f : 0.f;
313 float dy = cy % 2 ? 0.5f : 0.f;
314 SkRect rect = SkRect::MakeWH(50.f, 40.f);
315 rect.offset(dx, dy);
316
317 if (width < 0.0) {
318 rect.outset(25.f, 25.f); // make it the same size as the largest stroke
319 }
320
321 // Filled rounded rects can have arbitrary corners
322 float cornerScale = std::min(rect.width(), rect.height());
323 SkVector outerRadii[4] = { { 0.25f * cornerScale, 0.75f * cornerScale },
324 { 0.f, 0.f},
325 { 0.50f * cornerScale, 0.50f * cornerScale },
326 { 0.75f * cornerScale, 0.25f * cornerScale } };
327 // Stroked rounded rects will only have circular corners so that they remain compatible with
328 // Graphite's AnalyticRoundRectRenderStep's requirements.
329 SkVector strokeRadii[4] = { { 0.25f * cornerScale, 0.25f * cornerScale },
330 { 0.f, 0.f }, // this corner matches join type
331 { 0.50f * cornerScale, 0.50f * cornerScale },
332 { 0.75f * cornerScale, 0.75f * cornerScale } };
333
334 if (rrect) {
335 SkRRect r;
336 if (width >= 0.0) {
337 r.setRectRadii(rect, strokeRadii);
338 } else {
339 r.setRectRadii(rect, outerRadii);
340 }
341 canvas->drawRRect(r, p);
342 } else {
343 canvas->drawRect(rect, p);
344 }
345 canvas->restore();
346 };
347
348 // The stroke widths are chosen to test when the inner stroke edges have completely crossed
349 // over (50); when the inner corner circles intersect each other (30); a typical "nice"
350 // stroke (10); a skinny stroke (1); and a hairline (0).
351 int i = 0;
352 for (float width : {-1.f, 50.f, 30.f, 10.f, 1.f, 0.f}) {
353 int j = 0;
357 if (width < 0 && join != SkPaint::kMiter_Join) {
358 continue; // Don't repeat fills, since join type is ignored
359 }
360 draw(2*i, 2*j, false, width, join);
361 draw(2*i+1, 2*j, false, width, join);
362 draw(2*i, 2*j+1, false, width, join);
363 draw(2*i+1, 2*j+1, false, width, join);
364 j++;
365 }
366 i++;
367 }
368
369 canvas->translate(0.f, 50.f);
370
371 i = 0;
372 for (float width : {-1.f, 50.f, 30.f, 10.f, 1.f, 0.f}) {
373 int j = 3;
377 if (width < 0 && join != SkPaint::kMiter_Join) {
378 continue;
379 }
380 draw(2*i, 2*j, true, width, join);
381 draw(2*i+1, 2*j, true, width, join);
382 draw(2*i, 2*j+1, true, width, join);
383 draw(2*i+1, 2*j+1, true, width, join);
384 j++;
385 }
386 i++;
387 }
388
389 // Rotated "footballs"
390 auto drawComplex = [&](int cx, int cy, float width, float stretch) {
391 SkPaint p;
392 p.setAntiAlias(true);
393 p.setStrokeWidth(width);
394 p.setStyle(SkPaint::kStroke_Style);
395 p.setStrokeJoin(SkPaint::kBevel_Join);
396
397 canvas->save();
398 canvas->translate(cx * 110.f, cy * 110.f);
399
400 SkRect rect = SkRect::MakeWH(cx % 2 ? 50.f : (40.f + stretch),
401 cx % 2 ? (40.f + stretch) : 50.f);
402 const SkVector kBigCorner{30.f, 30.f};
403 const SkVector kRectCorner{0.f, 0.f};
404
405 SkVector strokeRadii[4] = { cy % 2 ? kRectCorner : kBigCorner,
406 cy % 2 ? kBigCorner : kRectCorner,
407 cy % 2 ? kRectCorner : kBigCorner,
408 cy % 2 ? kBigCorner : kRectCorner };
409
410 SkRRect r;
411 r.setRectRadii(rect, strokeRadii);
412 canvas->drawRRect(r, p);
413
414 canvas->restore();
415 };
416
417 canvas->translate(0.f, -50.f);
418 i = 6;
419 for (float width : {50.f, 30.f, 20.f, 10.f, 1.f, 0.f}) {
420 int j = 0;
421 for (float stretch: {0.f, 5.f, 10.f}) {
422 drawComplex(2*i, 2*j, width, stretch);
423 drawComplex(2*i+1, 2*j, width, stretch);
424 drawComplex(2*i, 2*j+1, width, stretch);
425 drawComplex(2*i+1, 2*j+1, width, stretch);
426 j++;
427 }
428 i++;
429 }
430
431 // Rotated "D"s
432 auto drawComplex2 = [&](int cx, int cy, float width, float stretch) {
433 SkPaint p;
434 p.setAntiAlias(true);
435 p.setStrokeWidth(width);
436 p.setStyle(SkPaint::kStroke_Style);
437 p.setStrokeJoin(SkPaint::kMiter_Join);
438
439 canvas->save();
440 canvas->translate(cx * 110.f, cy * 110.f);
441
442 SkRect rect = SkRect::MakeWH(cx % 2 ? 50.f : (40.f + stretch),
443 cx % 2 ? (40.f + stretch) : 50.f);
444 const SkVector kBigCorner{30.f, 30.f};
445 const SkVector kRectCorner{0.f, 0.f};
446
447 SkVector strokeRadii[4] = { cx % 2 ? kRectCorner : kBigCorner,
448 (cx % 2) ^ (cy % 2) ? kBigCorner : kRectCorner,
449 cx % 2 ? kBigCorner : kRectCorner,
450 (cx % 2) ^ (cy % 2) ? kRectCorner : kBigCorner };
451
452 SkRRect r;
453 r.setRectRadii(rect, strokeRadii);
454 canvas->drawRRect(r, p);
455
456 canvas->restore();
457 };
458
459 canvas->translate(0.f, 50.f);
460 i = 6;
461 for (float width : {50.f, 30.f, 20.f, 10.f, 1.f, 0.f}) {
462 int j = 3;
463 for (float stretch: {0.f, 5.f, 10.f}) {
464 drawComplex2(2*i, 2*j, width, stretch);
465 drawComplex2(2*i+1, 2*j, width, stretch);
466 drawComplex2(2*i, 2*j+1, width, stretch);
467 drawComplex2(2*i+1, 2*j+1, width, stretch);
468 j++;
469 }
470 i++;
471 }
472}
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
@ kRound_Join
adds circle
Definition SkPaint.h:360
@ kMiter_Join
extends to miter limit
Definition SkPaint.h:359
@ kBevel_Join
connects outside edges
Definition SkPaint.h:361
void setRectRadii(const SkRect &rect, const SkVector radii[4])
Definition SkRRect.cpp:189
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609

◆ DEF_SIMPLE_GM() [8/9]

skiagm::DEF_SIMPLE_GM ( stroke_rect_shader  ,
canvas  ,
690  ,
300   
)

Definition at line 28 of file stroke_rect_shader.cpp.

28 {
29 constexpr SkRect kRect {0, 0, 100, 100};
30 constexpr SkPoint kPts[] {{kRect.fLeft, kRect.fTop}, {kRect.fRight, kRect.fBottom}};
32 sk_sp<SkShader> shader = SkGradientShader::MakeLinear(kPts, kColors, nullptr, 2,
34
35 // Do a large initial translate so that local coords disagree with device coords significantly
36 // for the first rect drawn.
37 canvas->translate(kRect.centerX(), kRect.centerY());
38 constexpr SkScalar kPad = 20;
39 for (auto aa : {false, true}) {
41 paint.setShader(shader);
43 paint.setAntiAlias(aa);
44
45 canvas->save();
46
47 constexpr SkScalar kStrokeWidth = 10;
48 paint.setStrokeWidth(kStrokeWidth);
49
50 paint.setStrokeJoin(SkPaint::kBevel_Join);
51 canvas->drawRect(kRect, paint);
52 canvas->translate(kRect.width() + kPad, 0);
53
54 paint.setStrokeJoin(SkPaint::kMiter_Join);
55 canvas->drawRect(kRect, paint);
56 canvas->translate(kRect.width() + kPad, 0);
57
58 // This miter limit should effectively produce a bevel join.
59 paint.setStrokeMiter(0.01f);
60 canvas->drawRect(kRect, paint);
61 canvas->translate(kRect.width() + kPad, 0);
62
63 paint.setStrokeJoin(SkPaint::kRound_Join);
64 canvas->drawRect(kRect, paint);
65 canvas->translate(kRect.width() + kPad, 0);
66
67 paint.setStrokeWidth(0);
68 canvas->drawRect(kRect, paint);
69
70 canvas->restore();
71 canvas->translate(0, kRect.height() + kPad);
72 }
73}
uint32_t SkColor
Definition SkColor.h:37
constexpr int kPad
constexpr SkRect kRect
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
const DlColor kColors[]
SkScalar fBottom
larger y-axis bounds
Definition extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition extension.cpp:16
constexpr float centerX() const
Definition SkRect.h:776
constexpr float height() const
Definition SkRect.h:769
constexpr float centerY() const
Definition SkRect.h:785
constexpr float width() const
Definition SkRect.h:762
SkScalar fTop
smaller y-axis bounds
Definition extension.cpp:15

◆ DEF_SIMPLE_GM() [9/9]

skiagm::DEF_SIMPLE_GM ( strokedline_caps  ,
canvas  ,
1400  ,
740   
)

Definition at line 300 of file strokedlines.cpp.

300 {
301 canvas->translate(kStrokeWidth*3/2, kStrokeWidth*3/2);
302
303 constexpr SkPaint::Cap kCaps[] = {
305 };
306
307 constexpr float kLengths[] = {
309 };
310
311 for (size_t i = 0; i < std::size(kCaps); ++i) {
312 SkAutoCanvasRestore acr(canvas, true);
313
314 auto drawLine = [&](float x0, float y0, float x1, float y1) {
315 draw_path(canvas, {x0, y0}, {x1, y1}, kCaps[i]);
316 canvas->translate(std::max(x0, x1) + 2 * kStrokeWidth, 0);
317 };
318
319 for (size_t j = 0; j < std::size(kLengths); ++j) {
320 float l = kLengths[j];
321
322 drawLine(0.f, 0.f, l, l);
323 drawLine(l, l, 0.f, 0.f);
324 drawLine(l/2, 0, l/2, l);
325 drawLine(0, l/2, l, l/2);
326 }
327
329
330 acr.restore();
331 canvas->translate(0, kLengths[0] + 2 * kStrokeWidth);
332 }
333}
static void draw_path(SkCanvas *canvas, const SkRect &r, sk_sp< SkImageFilter > imf)
static const SkPaint::Cap kCaps[]

◆ DEF_SIMPLE_GM_CAN_FAIL()

skiagm::DEF_SIMPLE_GM_CAN_FAIL ( custommesh_cs_uniforms  ,
canvas  ,
errorMsg  ,
200  ,
900   
)

Definition at line 1505 of file mesh.cpp.

1505 {
1506 if (!canvas->recordingContext() && !canvas->recorder()) {
1507 *errorMsg = GM::kErrorMsg_DrawSkippedGpuOnly;
1508 return DrawResult::kSkip;
1509 }
1510
1511 // Shared data
1512 static constexpr SkRect kRect = SkRect::MakeLTRB(20, 20, 80, 80);
1513 static constexpr SkPoint kQuad[]{
1514 {kRect.left(), kRect.top()},
1515 {kRect.right(), kRect.top()},
1516 {kRect.left(), kRect.bottom()},
1517 {kRect.right(), kRect.bottom()},
1518 };
1521
1522 // Surface helper
1523 auto makeSurface = [=](sk_sp<SkColorSpace> cs) {
1524 SkImageInfo ii = SkImageInfo::MakeN32Premul(200, 100, cs);
1525 sk_sp<SkSurface> surface = canvas->makeSurface(ii);
1526 return surface ? surface : SkSurfaces::Raster(ii);
1527 };
1528
1529 // Mesh helper
1530 enum class Managed : bool { kNo, kYes };
1531 auto makeMesh = [&](Managed managed, sk_sp<SkColorSpace> workingCS) {
1532 static const SkMeshSpecification::Attribute kAttributes[]{
1534 };
1535
1536 static constexpr char kVS[] = R"(
1537 Varyings main(in const Attributes attributes) {
1538 Varyings varyings;
1539 varyings.position = attributes.pos;
1540 return varyings;
1541 }
1542 )";
1543 static constexpr char kManagedFS[] = R"(
1544 layout(color) uniform half4 color;
1545 float2 main(const Varyings varyings, out half4 c) {
1546 c = color;
1547 return varyings.position;
1548 }
1549 )";
1550 static constexpr char kRawFS[] = R"(
1551 uniform half4 color;
1552 float2 main(const Varyings varyings, out half4 c) {
1553 c = color;
1554 return varyings.position;
1555 }
1556 )";
1557
1558 auto [spec, error] = SkMeshSpecification::Make(
1559 kAttributes,
1560 sizeof(SkPoint),
1561 /*varyings=*/{},
1562 SkString(kVS),
1563 SkString(managed == Managed::kYes ? kManagedFS : kRawFS),
1564 std::move(workingCS),
1566 SkASSERT(spec);
1567
1568 SkMesh::Result result = SkMesh::Make(std::move(spec),
1570 vb,
1571 /*vertexCount=*/4,
1572 /*vertexOffset=*/0,
1573 /*uniforms=*/unis,
1574 /*children=*/{},
1575 kRect);
1576 SkASSERT(result.mesh.isValid());
1577 return result.mesh;
1578 };
1579
1580 sk_sp<SkColorSpace> null = nullptr,
1581 srgb = SkColorSpace::MakeSRGB(),
1585
1586 struct Config {
1587 sk_sp<SkColorSpace> fMeshCS;
1588 sk_sp<SkColorSpace> fSurfaceCS;
1589 Managed fManaged;
1590 SkColor fExpectedColor = SK_ColorRED;
1591 };
1592 static const Config kConfigs[] = {
1593 // Uniforms should remain in sRGB mode, then get converted to destination after mesh FS
1594 // Before b/316594914 was fixed, these would get double-converted:
1595 {srgb, null, Managed::kYes},
1596 {srgb, srgb, Managed::kYes},
1597 {srgb, spin, Managed::kYes},
1598 {srgb, wide, Managed::kYes},
1599
1600 // Uniforms should be converted to working space (spun), then converted to destination
1601 {spin, srgb, Managed::kYes},
1602 {spin, spin, Managed::kYes},
1603 {spin, wide, Managed::kYes},
1604
1605 // Non-managed uniforms serve as a control group. The red uniforms are not converted to
1606 // the working space. The mesh FS returns "red" {1, 0, 0, 1}, but that's actually green,
1607 // because the working space of the mesh is `spin`. That output is converted to dest,
1608 // rendering as green. Therefore, we manually change the control color's box to green.
1609 {spin, srgb, Managed::kNo, SK_ColorGREEN},
1610 {spin, wide, Managed::kNo, SK_ColorGREEN},
1611 };
1612
1613 for (const Config& config : kConfigs) {
1614 SkMesh mesh = makeMesh(config.fManaged, config.fMeshCS);
1615
1616 sk_sp<SkSurface> offscreen = makeSurface(config.fSurfaceCS);
1617 SkCanvas* offscreenCanvas = offscreen->getCanvas();
1618
1619 SkPaint paint;
1620 offscreenCanvas->drawMesh(mesh, SkBlender::Mode(SkBlendMode::kDst), paint);
1621 offscreenCanvas->translate(100, 0);
1622 paint.setColor(config.fExpectedColor);
1623 offscreenCanvas->drawRect(kRect, paint);
1624
1625 offscreen->draw(canvas, 0, 0);
1626 canvas->translate(0, 100);
1627 }
1628
1629 return DrawResult::kOk;
1630}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
static sk_sp< SkBlender > Mode(SkBlendMode mode)
void translate(SkScalar dx, SkScalar dy)
void drawMesh(const SkMesh &mesh, sk_sp< SkBlender > blender, const SkPaint &paint)
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkColorSpace > makeColorSpin() const
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
Definition SkData.cpp:111
static Result Make(SkSpan< const Attribute > attributes, size_t vertexStride, SkSpan< const Varying > varyings, const SkString &vs, const SkString &fs)
Definition SkMesh.cpp:389
static Result Make(sk_sp< SkMeshSpecification >, Mode, sk_sp< VertexBuffer >, size_t vertexCount, size_t vertexOffset, sk_sp< const SkData > uniforms, SkSpan< ChildPtr > children, const SkRect &bounds)
Definition SkMesh.cpp:694
VkSurfaceKHR surface
Definition main.cc:49
GAsyncResult * result
constexpr SkColor4f kRed
Definition SkColor.h:440
SK_API sk_sp< SkMesh::VertexBuffer > MakeVertexBuffer(const void *, size_t size)
Definition SkMesh.cpp:905
static constexpr skcms_Matrix3x3 kRec2020
static constexpr skcms_TransferFunction k2Dot2
SkMesh mesh
Definition SkRecords.h:345
sk_sp< SkSurface > makeSurface(SkCanvas *canvas, const SkImageInfo &info, const SkSurfaceProps *props)
Definition ref_ptr.h:256
constexpr float left() const
Definition SkRect.h:734
constexpr float top() const
Definition SkRect.h:741
constexpr float right() const
Definition SkRect.h:748
constexpr float bottom() const
Definition SkRect.h:755
static sk_sp< SkColorFilter > spin(sk_sp< SkColorFilter > cf)

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [1/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( clear_swizzle  ,
rContext  ,
canvas  ,
errorMsg  ,
6 *  kSize,
2 *  kSize 
)

Definition at line 25 of file clear_swizzle.cpp.

25 {
26 if (rContext->abandoned()) {
27 *errorMsg = GM::kErrorMsg_DrawSkippedGpuOnly;
28 return DrawResult::kSkip;
29 }
30
32 if (!sfc) {
33 *errorMsg = GM::kErrorMsg_DrawSkippedGpuOnly;
34 return DrawResult::kSkip;
35 }
36
37 auto make_offscreen = [&](const SkISize dimensions) {
38 skgpu::Swizzle readSwizzle = skgpu::Swizzle::Concat(sfc->readSwizzle(),
39 skgpu::Swizzle{"bgra"});
40 skgpu::Swizzle writeSwizzle = skgpu::Swizzle::Concat(sfc->readSwizzle(),
41 skgpu::Swizzle{"bgra"});
42 return rContext->priv().makeSFC(kPremul_SkAlphaType,
43 sfc->colorInfo().refColorSpace(),
44 dimensions,
46 sfc->asSurfaceProxy()->backendFormat(),
47 /* sample count*/ 1,
48 skgpu::Mipmapped::kNo,
49 sfc->asSurfaceProxy()->isProtected(),
50 readSwizzle,
51 writeSwizzle,
54 /*label=*/{});
55 };
56
57 struct {
60 } clears[] {
61 {{ 0, 0, kSize, kSize}, {1, 0, 0, 1}},
62 {{kSize, 0, 2*kSize, kSize}, {0, 1, 0, 1}},
63 {{ 0, kSize, kSize, 2*kSize}, {0, 0, 1, 1}},
64 {{kSize, kSize, 2*kSize, 2*kSize}, {1, 0, 1, 1}},
65 };
66
67 // onscreen for reference
68 for (const auto& c : clears) {
69 sfc->clear(c.rect, c.color);
70 }
71
72 // partial clear offscreen
73 auto offscreen = make_offscreen({2*kSize, 2*kSize});
74 for (const auto& c : clears) {
75 offscreen->clear(c.rect, c.color);
76 }
77 sfc->blitTexture(offscreen->readSurfaceView(),
78 SkIRect::MakeSize({2*kSize, 2*kSize}),
79 SkIPoint{2*kSize, 0});
80
81 // full offscreen clears
82 for (const auto& c : clears) {
83 offscreen = make_offscreen(c.rect.size());
84 offscreen->clear(SkIRect::MakeSize(c.rect.size()), c.color);
85 sfc->blitTexture(offscreen->readSurfaceView(),
86 SkIRect::MakeSize(offscreen->dimensions()),
87 c.rect.topLeft() + SkIPoint{4*kSize, 0});
88 }
89
90 return DrawResult::kOk;
91}
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
SkColor4f color
static constexpr Swizzle Concat(const Swizzle &a, const Swizzle &b)
Definition Swizzle.h:156
static constexpr int kSize
SurfaceFillContext * TopDeviceSurfaceFillContext(const SkCanvas *canvas)
Definition GrCanvas.cpp:27
static constexpr SkIRect MakeSize(const SkISize &size)
Definition SkRect.h:66
constexpr SkIPoint topLeft() const
Definition SkRect.h:151

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [2/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( fp_sample_chaining  ,
rContext  ,
canvas  ,
errorMsg  ,
232  ,
306   
)

Definition at line 177 of file fp_sample_chaining.cpp.

177 {
179 if (!sdc) {
180 *errorMsg = GM::kErrorMsg_DrawSkippedGpuOnly;
181 return DrawResult::kSkip;
182 }
183
184 SkBitmap bmp = make_test_bitmap();
185
186 int x = 10, y = 10;
187
188 auto nextCol = [&] { x += (64 + 10); };
189 auto nextRow = [&] { x = 10; y += (64 + 10); };
190
191 auto draw = [&](std::initializer_list<EffectType> effects) {
192 // Enable TestPatternEffect to get a fully procedural inner effect. It's not quite as nice
193 // visually (no text labels in each box), but it avoids the extra GrMatrixEffect.
194 // Switching it on actually triggers *more* shader compilation failures.
195#if 0
196 auto fp = std::unique_ptr<GrFragmentProcessor>(new TestPatternEffect());
197#else
198 auto view = std::get<0>(GrMakeCachedBitmapProxyView(
199 rContext, bmp, /*label=*/"FpSampleChaining", skgpu::Mipmapped::kNo));
200 auto fp = GrTextureEffect::Make(std::move(view), bmp.alphaType());
201#endif
202 for (EffectType effectType : effects) {
203 fp = wrap(std::move(fp), effectType, x, y);
204 }
206 paint.setColorFragmentProcessor(std::move(fp));
207 sdc->drawRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::Translate(x, y),
208 SkRect::MakeIWH(64, 64));
209 nextCol();
210 };
211
212 // Reminder, in every case, the chain is more complicated than it seems, because the
213 // GrTextureEffect is wrapped in a GrMatrixEffect, which is subject to the same bugs that
214 // we're testing (particularly the bug about owner/base in UniformMatrixEffect).
215
216 // First row: no transform, then each one independently applied
217 draw({}); // Identity (4 rows and columns)
218 draw({ kUniform }); // Scale Y axis by 2x (2 visible rows)
219 draw({ kExplicit }); // Translate up by 8px
220 nextRow();
221
222 // Second row: transform duplicated
223 draw({ kUniform, kUniform }); // Scale Y axis by 4x (1 visible row)
224 draw({ kExplicit, kExplicit }); // Translate up by 16px
225 nextRow();
226
227 // Third row: Remember, these are applied inside out:
228 draw({ kUniform, kExplicit }); // Scale Y by 2x and translate up by 8px
229 draw({ kExplicit, kUniform }); // Scale Y by 2x and translate up by 16px
230 nextRow();
231
232 // Fourth row: device space.
233 draw({ kDevice, kUniform }); // Same as identity (uniform applied *before*
234 // device so ignored).
235 draw({ kExplicit, kUniform, kDevice }); // Scale Y by 2x and translate up by 16px
236 draw({ kDevice, kExplicit, kUniform, kDevice }); // Identity, again.
237
238 return DrawResult::kOk;
239}
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeCachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, std::string_view label, skgpu::Mipmapped mipmapped)
Definition SkGr.cpp:188
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
SkAlphaType alphaType() const
Definition SkBitmap.h:162
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition SkMatrix.h:91
double y
double x
const uint32_t fp
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
Definition GrCanvas.cpp:20
static SkRect MakeIWH(int w, int h)
Definition SkRect.h:623

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [3/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( gpu_blur_utils  ,
rContext  ,
canvas  ,
errorMsg  ,
765  ,
955   
)

Definition at line 356 of file gpu_blur_utils.cpp.

356 {
357 return run(rContext, canvas, errorMsg, false, false);
358}
Definition run.py:1

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [4/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( gpu_blur_utils_ref  ,
rContext  ,
canvas  ,
errorMsg  ,
765  ,
955   
)

Definition at line 360 of file gpu_blur_utils.cpp.

360 {
361 return run(rContext, canvas, errorMsg, false, true);
362}

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [5/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( gpu_blur_utils_subset_rect  ,
rContext  ,
canvas  ,
errorMsg  ,
485  ,
730   
)

Definition at line 364 of file gpu_blur_utils.cpp.

364 {
365 return run(rContext, canvas, errorMsg, true, false);
366}

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [6/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( gpu_blur_utils_subset_ref  ,
rContext  ,
canvas  ,
errorMsg  ,
485  ,
730   
)

Definition at line 368 of file gpu_blur_utils.cpp.

368 {
369 return run(rContext, canvas, errorMsg, true, true);
370}

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [7/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( very_large_sigma_gpu_blur  ,
rContext  ,
canvas  ,
errorMsg  ,
350  ,
1030   
)

Definition at line 438 of file gpu_blur_utils.cpp.

438 {
439 auto src = make_src_image(rContext, {15, 15});
440 auto srcB = SkIRect::MakeSize(src.dimensions());
441 return do_very_large_blur_gm(rContext, canvas, errorMsg, std::move(src), srcB);
442}
static sk_sp< SkImage > make_src_image()

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [8/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( very_large_sigma_gpu_blur_subset  ,
rContext  ,
canvas  ,
errorMsg  ,
350  ,
1030   
)

Definition at line 444 of file gpu_blur_utils.cpp.

448 {
449 auto srcB = SkIRect::MakeXYWH(2, 2, 15, 15);
450 SkISize imageSize = SkISize{srcB.width() + 4, srcB.height() + 4};
451 auto src = make_src_image(rContext, imageSize, &srcB);
452 return do_very_large_blur_gm(rContext, canvas, errorMsg, std::move(src), srcB);
453}
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
Definition SkRect.h:104
constexpr int32_t width() const
Definition SkSize.h:36

◆ DEF_SIMPLE_GPU_GM_CAN_FAIL() [9/9]

skiagm::DEF_SIMPLE_GPU_GM_CAN_FAIL ( very_large_sigma_gpu_blur_subset_transparent_border  ,
rContext  ,
canvas  ,
errorMsg  ,
355  ,
1055   
)

Definition at line 455 of file gpu_blur_utils.cpp.

459 {
460 auto srcB = SkIRect::MakeXYWH(3, 3, 15, 15);
461 SkISize imageSize = SkISize{srcB.width() + 4, srcB.height() + 4};
462 auto src = make_src_image(rContext, imageSize, &srcB);
463 return do_very_large_blur_gm(rContext, canvas, errorMsg, std::move(src), srcB.makeOutset(1, 1));
464}

◆ discrete_pe()

static void skiagm::discrete_pe ( SkPaint paint)
static

Definition at line 97 of file patheffects.cpp.

97 {
98 paint->setPathEffect(SkDiscretePathEffect::Make(10, 4));
99}
static sk_sp< SkPathEffect > Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist=0)

◆ do_very_large_blur_gm()

static DrawResult skiagm::do_very_large_blur_gm ( GrRecordingContext rContext,
SkCanvas canvas,
SkString errorMsg,
GrSurfaceProxyView  src,
SkIRect  srcB 
)
static

Definition at line 377 of file gpu_blur_utils.cpp.

381 {
383 if (!sdc) {
384 *errorMsg = GM::kErrorMsg_DrawSkippedGpuOnly;
385 return DrawResult::kSkip;
386 }
387
388 // Clear to a color other than gray to contrast with test image.
389 sdc->clear(SkColor4f{0.3f, 0.4f, 0.2f, 1});
390
391 int x = 10;
392 int y = 10;
393 for (auto blurDirs : {0b01, 0b10, 0b11}) {
394 for (int t = 0; t < kSkTileModeCount; ++t) {
395 auto tm = static_cast<SkTileMode>(t);
396 auto dstB = srcB.makeOutset(30, 30);
397 for (float sigma : {0.f, 5.f, 25.f, 80.f}) {
398 std::vector<decltype(blur)*> blurs;
399 blurs.push_back(blur);
400 if (kShowSlowRefImages) {
401 blurs.push_back(slow_blur);
402 }
403 for (auto b : blurs) {
404 float sigX = sigma*((blurDirs & 0b01) >> 0);
405 float sigY = sigma*((blurDirs & 0b10) >> 1);
406 GrSurfaceProxyView result = b(rContext, src, dstB, srcB, sigX, sigY, tm);
407 auto dstRect = SkIRect::MakeSize(dstB.size()).makeOffset(x, y);
408 // Draw a rect to show where the result should be so it's obvious if it's
409 // missing.
411 paint.setColor4f(b == blur ? SkPMColor4f{0, 0, 1, 1} : SkPMColor4f{1, 0, 0, 1});
412 sdc->drawRect(nullptr,
413 std::move(paint),
414 GrAA::kNo,
415 SkMatrix::I(),
416 SkRect::Make(dstRect).makeOutset(0.5, 0.5),
418 if (result) {
419 std::unique_ptr<GrFragmentProcessor> fp =
421 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kSrcOver>(std::move(fp),
422 /*dst=*/nullptr);
423 sdc->fillRectToRectWithFP(SkIRect::MakeSize(dstB.size()),
424 dstRect,
425 std::move(fp));
426 }
427 x += dstB.width() + 10;
428 }
429 }
430 x = 10;
431 y += dstB.height() + 10;
432 }
433 }
434
435 return DrawResult::kOk;
436}
SkTileMode
Definition SkTileMode.h:13
static constexpr int kSkTileModeCount
Definition SkTileMode.h:39
static const GrStyle & SimpleHairline()
Definition GrStyle.h:39
static const SkMatrix & I()
SkIRect makeOutset(int32_t dx, int32_t dy) const
Definition SkRect.h:350
constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const
Definition SkRect.h:300
static SkRect Make(const SkISize &size)
Definition SkRect.h:669

◆ draw_bitmap()

static void skiagm::draw_bitmap ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 84 of file filterfastbounds.cpp.

84 {
85 SkBitmap bm;
86
87 bm.allocN32Pixels(64, 64);
88 SkCanvas temp(bm);
89 temp.clear(SK_ColorMAGENTA);
90
91 canvas->drawImageRect(bm.asImage(), r, SkSamplingOptions(), &p);
92}
constexpr SkColor SK_ColorMAGENTA
Definition SkColor.h:147
sk_sp< SkImage > asImage() const
Definition SkBitmap.cpp:645
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition SkBitmap.cpp:232
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)

◆ draw_blob()

static void skiagm::draw_blob ( SkCanvas canvas,
const SkTextBlob blob,
const SkPaint skPaint,
const SkRect clipRect 
)
static

Definition at line 29 of file mixedtextblobs.cpp.

30 {
31 SkPaint clipHairline;
32 clipHairline.setColor(SK_ColorWHITE);
33 clipHairline.setStyle(SkPaint::kStroke_Style);
34
35 SkPaint paint(skPaint);
36 canvas->save();
37 canvas->drawRect(clipRect, clipHairline);
38 paint.setAlphaf(0.125f);
39 canvas->drawTextBlob(blob, 0, 0, paint);
40 canvas->clipRect(clipRect);
41 paint.setAlphaf(1.0f);
42 canvas->drawTextBlob(blob, 0, 0, paint);
43 canvas->restore();
44}
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void restore()
Definition SkCanvas.cpp:465
int save()
Definition SkCanvas.cpp:451
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)

◆ draw_bm()

static sk_sp< SkImage > skiagm::draw_bm ( )
static

Definition at line 27 of file bitmapshader.cpp.

27 {
28 SkPaint bluePaint;
29 bluePaint.setColor(SK_ColorBLUE);
30
31 SkBitmap bm;
32 bm.allocN32Pixels(20, 20);
34 SkCanvas(bm).drawCircle(10, 10, 5, bluePaint);
35 return bm.asImage();
36}
void eraseColor(SkColor4f) const
Definition SkBitmap.cpp:442
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)

◆ draw_drrect()

static void skiagm::draw_drrect ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 57 of file filterfastbounds.cpp.

57 {
58 SkScalar xRad = r.width() / 4.0f;
59 SkScalar yRad = r.height() / 4.0f;
60
61 SkRRect outer;
62 outer.setRectXY(r, xRad, yRad);
63 SkRRect inner = outer;
64 inner.inset(xRad, yRad);
65 canvas->drawDRRect(outer, inner, p);
66}
void drawDRRect(const SkRRect &outer, const SkRRect &inner, const SkPaint &paint)
void inset(SkScalar dx, SkScalar dy, SkRRect *dst) const
Definition SkRRect.cpp:562
void setRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition SkRRect.cpp:52

◆ draw_mask()

static sk_sp< SkImage > skiagm::draw_mask ( )
static

Definition at line 38 of file bitmapshader.cpp.

38 {
39 SkPaint circlePaint;
40 circlePaint.setColor(SK_ColorBLACK);
41
42 SkBitmap bm;
45 SkCanvas(bm).drawCircle(10, 10, 10, circlePaint);
46 return bm.asImage();
47}
constexpr SkColor SK_ColorTRANSPARENT
Definition SkColor.h:99
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition SkBitmap.cpp:258

◆ draw_oval()

static void skiagm::draw_oval ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 44 of file filterfastbounds.cpp.

44 {
45 canvas->drawOval(r, p);
46}
void drawOval(const SkRect &oval, const SkPaint &paint)

◆ draw_path() [1/2]

static void skiagm::draw_path ( SkCanvas canvas,
const SkPoint p0,
const SkPoint p1,
SkPaint::Cap  cap 
)
static

Definition at line 263 of file strokedlines.cpp.

263 {
264 // Add a gradient *not* aligned with the line's points to show local coords are tracked properly
266 constexpr SkPoint kPts[] {{kRect.fLeft, kRect.fTop}, {kRect.fRight, kRect.fBottom}};
268 constexpr SkScalar kStops[] {0.f, 0.75f, 1.f};
269 sk_sp<SkShader> shader = SkGradientShader::MakeLinear(kPts, kColors, kStops, 3,
271
273 paint.setAntiAlias(true);
275
276 paint.setShader(std::move(shader));
277 paint.setStrokeWidth(kStrokeWidth);
278 paint.setStrokeCap(cap);
279 canvas->drawLine(p0, p1, paint);
280
281 // Show outline and control points
282 SkPath fillPath;
283 SkPath path = SkPath::Line(p0, p1);
284 skpathutils::FillPathWithPaint(path, paint, &fillPath);
285
287 paint.setStrokeWidth(0);
288 paint.setShader(nullptr);
289 paint.setColor(SK_ColorRED);
290 canvas->drawPath(fillPath, paint);
291
292 paint.setStrokeWidth(3);
293 paint.setStrokeCap(SkPaint::kSquare_Cap);
294 int n = fillPath.countPoints();
296 fillPath.getPoints(points.get(), n);
298}
static const int points[]
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
Definition SkCanvas.h:1241
int countPoints() const
Definition SkPath.cpp:525
int getPoints(SkPoint points[], int max) const
Definition SkPath.cpp:529
static SkPath Line(const SkPoint a, const SkPoint b)
Definition SkPath.h:106
constexpr float kStops[]
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)

◆ draw_path() [2/2]

static void skiagm::draw_path ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 68 of file filterfastbounds.cpp.

68 {
70 {r.fLeft, r.fTop},
71 {r.fLeft, r.fBottom},
72 {r.fRight, r.fBottom},
73 }, true), p);
74}
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition SkPath.cpp:3546

◆ draw_points()

static void skiagm::draw_points ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 76 of file filterfastbounds.cpp.

76 {
77 SkPoint pts0[2] = { { r.fLeft, r.fTop }, { r.fRight, r.fBottom } };
78 SkPoint pts1[2] = { { r.fLeft, r.fBottom }, { r.fRight, r.fTop } };
79
80 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts0, p);
81 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts1, p);
82}
@ kLines_PointMode
draw each pair of points as a line segment
Definition SkCanvas.h:1242

◆ draw_rect()

static void skiagm::draw_rect ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 40 of file filterfastbounds.cpp.

40 {
41 canvas->drawRect(r, p);
42}

◆ draw_rrect()

static void skiagm::draw_rrect ( SkCanvas canvas,
const SkRect r,
const SkPaint p 
)
static

Definition at line 48 of file filterfastbounds.cpp.

48 {
49 SkScalar xRad = r.width() / 4.0f;
50 SkScalar yRad = r.height() / 4.0f;
51
52 SkRRect rr;
53 rr.setRectXY(r, xRad, yRad);
54 canvas->drawRRect(rr, p);
55}
void drawRRect(const SkRRect &rrect, const SkPaint &paint)

◆ draw_squarehair_tests()

static void skiagm::draw_squarehair_tests ( SkCanvas canvas,
SkScalar  width,
SkPaint::Cap  cap,
bool  aa 
)
static

Definition at line 196 of file hairlines.cpp.

196 {
198 paint.setStrokeCap(cap);
199 paint.setStrokeWidth(width);
200 paint.setAntiAlias(aa);
202 canvas->drawLine(10, 10, 20, 10, paint);
203 canvas->drawLine(30, 10, 30, 20, paint);
204 canvas->drawLine(40, 10, 50, 20, paint);
205 SkPathBuilder path;
206 path.moveTo(60, 10);
207 path.quadTo(60, 20, 70, 20);
208 path.conicTo(70, 10, 80, 10, 0.707f);
209 canvas->drawPath(path.detach(), paint);
210
211 path.moveTo(90, 10);
212 path.cubicTo(90, 20, 100, 20, 100, 10);
213 path.lineTo(110, 10);
214 canvas->drawPath(path.detach(), paint);
215 canvas->translate(0, 30);
216}

◆ draw_subdivided_quad()

static void skiagm::draw_subdivided_quad ( SkCanvas canvas,
int  x0,
int  y0,
int  x1,
int  y1,
SkColor  color 
)
static

Definition at line 235 of file hairlines.cpp.

235 {
237 paint.setStrokeWidth(1);
238 paint.setAntiAlias(true);
240 paint.setColor(color);
241
242 canvas->drawPath(SkPathBuilder().moveTo(0,0)
243 .quadTo(SkIntToScalar(x0), SkIntToScalar(y0),
245 .detach(),
246 paint);
247}
#define SkIntToScalar(x)
Definition SkScalar.h:57

◆ encode_data()

static sk_sp< SkData > skiagm::encode_data ( const SkBitmap bitmap,
SkEncodedImageFormat  format 
)
static

Definition at line 65 of file encode_srgb.cpp.

65 {
66 SkPixmap src;
67 if (!bitmap.peekPixels(&src)) {
68 return nullptr;
69 }
71
72 switch (format) {
75 break;
78 break;
81 break;
82 default:
83 SK_ABORT("Unsupported format %d", (int)format);
84 break;
85 }
86 return buf.detachAsData();
87}
#define SkAssertResult(cond)
Definition SkAssert.h:123
#define SK_ABORT(message,...)
Definition SkAssert.h:70
sk_sp< SkData > detachAsData()
Definition SkStream.cpp:707
uint32_t uint32_t * format
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)

◆ encode_pixmap_and_make_image()

static sk_sp< SkImage > skiagm::encode_pixmap_and_make_image ( const SkPixmap src,
SkJpegEncoder::AlphaOption  alphaOption 
)
inlinestatic

Definition at line 35 of file encode_alpha_jpeg.cpp.

36 {
39 options.fAlphaOption = alphaOption;
41 return SkImages::DeferredFromEncodedData(dst.detachAsData());
42}
const char * options
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)

◆ fill_pe()

static void skiagm::fill_pe ( SkPaint paint)
static

Definition at line 92 of file patheffects.cpp.

92 {
93 paint->setStyle(SkPaint::kFill_Style);
94 paint->setPathEffect(nullptr);
95}
@ kFill_Style
set to fill geometry
Definition SkPaint.h:193

◆ gen_color() [1/2]

static SkColor skiagm::gen_color ( SkRandom rand)
static

Definition at line 22 of file manypaths.cpp.

22 {
23 SkScalar hsv[3];
24 hsv[0] = rand->nextRangeF(0.0f, 360.0f);
25 hsv[1] = rand->nextRangeF(0.5f, 1.0f);
26 hsv[2] = rand->nextRangeF(0.5f, 1.0f);
27
29}
SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3])
Definition SkColor.cpp:78
float nextRangeF(float min, float max)
Definition SkRandom.h:64
SkColor color_to_565(SkColor color)

◆ gen_color() [2/2]

static SkColor skiagm::gen_color ( SkRandom rand)
static

Definition at line 31 of file roundrects.cpp.

31 {
32 SkScalar hsv[3];
33 hsv[0] = rand->nextRangeF(0.0f, 360.0f);
34 hsv[1] = rand->nextRangeF(0.75f, 1.0f);
35 hsv[2] = rand->nextRangeF(0.75f, 1.0f);
36
38}

◆ hair2_pe()

static void skiagm::hair2_pe ( SkPaint paint)
static

Definition at line 48 of file patheffects.cpp.

48 {
49 paint->setStrokeWidth(0);
51}

◆ hair_pe()

static void skiagm::hair_pe ( SkPaint paint)
static

Definition at line 44 of file patheffects.cpp.

44 {
45 paint->setStrokeWidth(0);
46}

◆ make()

static void skiagm::make ( SkBitmap bitmap,
SkColorType  colorType,
SkAlphaType  alphaType,
sk_sp< SkColorSpace colorSpace 
)
static

Definition at line 35 of file encode_srgb.cpp.

36 {
37 const char* resource;
38 switch (colorType) {
40 resource = "images/grayscale.jpg";
41 alphaType = kOpaque_SkAlphaType;
42 break;
44 resource = "images/color_wheel.jpg";
45 alphaType = kOpaque_SkAlphaType;
46 break;
47 default:
48 resource = (kOpaque_SkAlphaType == alphaType) ? "images/color_wheel.jpg"
49 : "images/color_wheel.png";
50 break;
51 }
52
53 sk_sp<SkData> data = GetResourceAsData(resource);
54 if (!data) {
55 return;
56 }
57 std::unique_ptr<SkCodec> codec = SkCodec::MakeFromData(data);
58 SkImageInfo dstInfo = codec->getInfo().makeColorType(colorType)
59 .makeAlphaType(alphaType)
60 .makeColorSpace(colorSpace);
61 bitmap->allocPixels(dstInfo);
62 codec->getPixels(dstInfo, bitmap->getPixels(), bitmap->rowBytes());
63}
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition Resources.cpp:42
@ kOpaque_SkAlphaType
pixel is opaque
Definition SkAlphaType.h:28
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition SkColorType.h:22
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
Definition SkCodec.cpp:241
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
SkImageInfo makeColorType(SkColorType newColorType) const

◆ Make2ConicalEdgeX()

static sk_sp< SkShader > skiagm::Make2ConicalEdgeX ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 196 of file gradients_2pt_conical.cpp.

197 {
198 SkPoint center0, center1;
199 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
200 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
201 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
202 SkScalarAve(pts[0].fY, pts[1].fY));
203 center0.set(center1.fX + radius1, center1.fY);
204 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
205 data.fPos, data.fCount, tm, 0, &localMatrix);
206}
#define SkScalarAve(a, b)
Definition SkScalar.h:74
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
float fX
x-axis value
void set(float x, float y)
float fY
y-axis value

◆ Make2ConicalEdgeY()

static sk_sp< SkShader > skiagm::Make2ConicalEdgeY ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 208 of file gradients_2pt_conical.cpp.

209 {
210 SkPoint center0, center1;
211 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
212 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
213 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
214 SkScalarAve(pts[0].fY, pts[1].fY));
215 center0.set(center1.fX, center1.fY + radius1);
216 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
217 data.fPos, data.fCount, tm, 0, &localMatrix);
218}

◆ Make2ConicalInside()

static sk_sp< SkShader > skiagm::Make2ConicalInside ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 85 of file gradients_2pt_conical.cpp.

86 {
87 SkPoint center0, center1;
88 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
89 SkScalarAve(pts[0].fY, pts[1].fY));
90 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
91 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
92 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 7,
93 center0, (pts[1].fX - pts[0].fX) / 2,
94 data.fColors, data.fPos, data.fCount, tm,
95 0, &localMatrix);
96}
static SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t)
Definition SkScalar.h:131

◆ Make2ConicalInsideCenter()

static sk_sp< SkShader > skiagm::Make2ConicalInsideCenter ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 111 of file gradients_2pt_conical.cpp.

112 {
113 SkPoint center0;
114 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
115 SkScalarAve(pts[0].fY, pts[1].fY));
116 return SkGradientShader::MakeTwoPointConical(center0, (pts[1].fX - pts[0].fX) / 7,
117 center0, (pts[1].fX - pts[0].fX) / 2,
118 data.fColors, data.fPos, data.fCount, tm,
119 0, &localMatrix);
120}

◆ Make2ConicalInsideCenterReversed()

static sk_sp< SkShader > skiagm::Make2ConicalInsideCenterReversed ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 122 of file gradients_2pt_conical.cpp.

123 {
124 SkPoint center0;
125 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
126 SkScalarAve(pts[0].fY, pts[1].fY));
127 return SkGradientShader::MakeTwoPointConical(center0, (pts[1].fX - pts[0].fX) / 2,
128 center0, (pts[1].fX - pts[0].fX) / 7,
129 data.fColors, data.fPos, data.fCount, tm,
130 0, &localMatrix);
131}

◆ Make2ConicalInsideFlip()

static sk_sp< SkShader > skiagm::Make2ConicalInsideFlip ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 98 of file gradients_2pt_conical.cpp.

99 {
100 SkPoint center0, center1;
101 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
102 SkScalarAve(pts[0].fY, pts[1].fY));
103 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
104 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
105 return SkGradientShader::MakeTwoPointConical(center0, (pts[1].fX - pts[0].fX) / 2,
106 center1, (pts[1].fX - pts[0].fX) / 7,
107 data.fColors, data.fPos, data.fCount, tm,
108 0, &localMatrix);
109}

◆ Make2ConicalInsideSmallRad()

static sk_sp< SkShader > skiagm::Make2ConicalInsideSmallRad ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 269 of file gradients_2pt_conical.cpp.

270 {
271 SkPoint center0, center1;
272 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
273 SkScalarAve(pts[0].fY, pts[1].fY));
274 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
275 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
276 return SkGradientShader::MakeTwoPointConical(center0, 0.0000000000000000001f,
277 center0, (pts[1].fX - pts[0].fX) / 2,
278 data.fColors, data.fPos, data.fCount, tm,
279 0, &localMatrix);
280}

◆ Make2ConicalOutside()

static sk_sp< SkShader > skiagm::Make2ConicalOutside ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 53 of file gradients_2pt_conical.cpp.

54 {
55 SkPoint center0, center1;
56 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 10;
57 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
58 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
59 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
60 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
61 data.fPos, data.fCount, tm, 0, &localMatrix);
62}

◆ Make2ConicalOutsideFlip()

static sk_sp< SkShader > skiagm::Make2ConicalOutsideFlip ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 74 of file gradients_2pt_conical.cpp.

75 {
76 SkPoint center0, center1;
77 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 10;
78 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
79 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
80 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
81 return SkGradientShader::MakeTwoPointConical(center1, radius1, center0, radius0, data.fColors,
82 data.fPos, data.fCount, tm, 0, &localMatrix);
83}

◆ Make2ConicalOutsideStrip()

static sk_sp< SkShader > skiagm::Make2ConicalOutsideStrip ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 64 of file gradients_2pt_conical.cpp.

65 {
66 SkPoint center0, center1;
67 SkScalar radius = (pts[1].fX - pts[0].fX) / 3;
68 center0.set(pts[0].fX, pts[0].fY);
69 center1.set(pts[1].fX, pts[1].fY);
70 return SkGradientShader::MakeTwoPointConical(center0, radius, center1, radius, data.fColors,
71 data.fPos, data.fCount, tm, 0, &localMatrix);
72}

◆ Make2ConicalTouchX()

static sk_sp< SkShader > skiagm::Make2ConicalTouchX ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 245 of file gradients_2pt_conical.cpp.

246 {
247 SkPoint center0, center1;
248 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
249 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
250 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
251 SkScalarAve(pts[0].fY, pts[1].fY));
252 center0.set(center1.fX - radius1 + radius0, center1.fY);
253 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
254 data.fPos, data.fCount, tm, 0, &localMatrix);
255}

◆ Make2ConicalTouchY()

static sk_sp< SkShader > skiagm::Make2ConicalTouchY ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 257 of file gradients_2pt_conical.cpp.

258 {
259 SkPoint center0, center1;
260 SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
261 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
262 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
263 SkScalarAve(pts[0].fY, pts[1].fY));
264 center0.set(center1.fX, center1.fY + radius1 - radius0);
265 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
266 data.fPos, data.fCount, tm, 0, &localMatrix);
267}

◆ Make2ConicalZeroRad()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRad ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 133 of file gradients_2pt_conical.cpp.

134 {
135 SkPoint center0, center1;
136 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
137 SkScalarAve(pts[0].fY, pts[1].fY));
138 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
139 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
140 return SkGradientShader::MakeTwoPointConical(center1, 0.f,
141 center0, (pts[1].fX - pts[0].fX) / 2,
142 data.fColors, data.fPos, data.fCount, tm,
143 0, &localMatrix);
144}

◆ Make2ConicalZeroRadCenter()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRadCenter ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 159 of file gradients_2pt_conical.cpp.

160 {
161 SkPoint center0, center1;
162 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
163 SkScalarAve(pts[0].fY, pts[1].fY));
164 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
165 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
166 return SkGradientShader::MakeTwoPointConical(center0, 0.f, center0, (pts[1].fX - pts[0].fX) / 2,
167 data.fColors, data.fPos, data.fCount, tm,
168 0, &localMatrix);
169}

◆ Make2ConicalZeroRadEdgeX()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRadEdgeX ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 220 of file gradients_2pt_conical.cpp.

222 {
223 SkPoint center0, center1;
224 SkScalar radius0 = 0.f;
225 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
226 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
227 SkScalarAve(pts[0].fY, pts[1].fY));
228 center0.set(center1.fX + radius1, center1.fY);
229 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
230 data.fPos, data.fCount, tm, 0, &localMatrix);
231}

◆ Make2ConicalZeroRadEdgeY()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRadEdgeY ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 233 of file gradients_2pt_conical.cpp.

234 {
235 SkPoint center0, center1;
236 SkScalar radius0 = 0.f;
237 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
238 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
239 SkScalarAve(pts[0].fY, pts[1].fY));
240 center0.set(center1.fX, center1.fY + radius1);
241 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1, data.fColors,
242 data.fPos, data.fCount, tm, 0, &localMatrix);
243}

◆ Make2ConicalZeroRadFlip()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRadFlip ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 146 of file gradients_2pt_conical.cpp.

147 {
148 SkPoint center0, center1;
149 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
150 SkScalarAve(pts[0].fY, pts[1].fY));
151 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
152 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
153 return SkGradientShader::MakeTwoPointConical(center1, (pts[1].fX - pts[0].fX) / 2,
154 center0, 0.f,
155 data.fColors, data.fPos, data.fCount, tm,
156 0, &localMatrix);
157}

◆ Make2ConicalZeroRadFlipOutside()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRadFlipOutside ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 184 of file gradients_2pt_conical.cpp.

186 {
187 SkPoint center0, center1;
188 SkScalar radius0 = 0.f;
189 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
190 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
191 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
192 return SkGradientShader::MakeTwoPointConical(center1, radius1, center0, radius0, data.fColors,
193 data.fPos, data.fCount, tm, 0, &localMatrix);
194}

◆ Make2ConicalZeroRadOutside()

static sk_sp< SkShader > skiagm::Make2ConicalZeroRadOutside ( const SkPoint  pts[2],
const GradData data,
SkTileMode  tm,
const SkMatrix localMatrix 
)
static

Definition at line 171 of file gradients_2pt_conical.cpp.

173 {
174 SkPoint center0, center1;
175 SkScalar radius0 = 0.f;
176 SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
177 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
178 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
179 return SkGradientShader::MakeTwoPointConical(center0, radius0, center1, radius1,
180 data.fColors, data.fPos,
181 data.fCount, tm, 0, &localMatrix);
182}

◆ make_bg_shader()

static sk_sp< SkShader > skiagm::make_bg_shader ( int  checkSize)
static

Definition at line 53 of file modecolorfilters.cpp.

53 {
54 SkBitmap bmp;
55 bmp.allocN32Pixels(2 * checkSize, 2 * checkSize);
56 SkCanvas canvas(bmp);
57 canvas.clear(ToolUtils::color_to_565(0xFF800000));
59 paint.setColor(ToolUtils::color_to_565(0xFF000080));
60 SkRect rect0 = SkRect::MakeXYWH(0, 0,
61 SkIntToScalar(checkSize), SkIntToScalar(checkSize));
62 SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(checkSize), SkIntToScalar(checkSize),
63 SkIntToScalar(checkSize), SkIntToScalar(checkSize));
64 canvas.drawRect(rect1, paint);
65 canvas.drawRect(rect0, paint);
67}
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
Definition SkBitmap.cpp:669

◆ make_color_shader()

static sk_sp< SkShader > skiagm::make_color_shader ( SkColor  color)
static

Definition at line 33 of file modecolorfilters.cpp.

33 {
34 constexpr SkPoint kPts[] = {{0, 0}, {1, 1}};
36
37 return SkGradientShader::MakeLinear(kPts, colors, nullptr, 2, SkTileMode::kClamp);
38}
PODArray< SkColor > colors
Definition SkRecords.h:276

◆ make_gradient_circle()

static sk_sp< SkImage > skiagm::make_gradient_circle ( int  width,
int  height 
)
static

Definition at line 43 of file imagefilterstransformed.cpp.

43 {
46 SkScalar radius = std::min(x, y) * 0.8f;
47
49 SkCanvas* canvas = surface->getCanvas();
50
51 canvas->clear(0x00000000);
52 SkColor colors[2];
53 colors[0] = SK_ColorWHITE;
54 colors[1] = SK_ColorBLACK;
56 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
58 canvas->drawCircle(x, y, radius, paint);
59
60 return surface->makeImageSnapshot();
61}
static sk_sp< SkShader > MakeRadial(const SkPoint &center, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
int32_t height
static constexpr SkPoint Make(float x, float y)

◆ make_image()

static sk_sp< SkImage > skiagm::make_image ( SkColorType  colorType,
SkAlphaType  alphaType 
)
static

Definition at line 27 of file encode_color_types.cpp.

27 {
28 const char* resource;
29 switch (colorType) {
31 if (alphaType != kOpaque_SkAlphaType) {
32 return nullptr;
33 }
34 resource = "images/grayscale.jpg";
35 break;
40 if (alphaType != kOpaque_SkAlphaType) {
41 return nullptr;
42 }
43 resource = "images/color_wheel.jpg";
44 break;
45 default:
46 resource = (kOpaque_SkAlphaType == alphaType) ? "images/color_wheel.jpg"
47 : "images/rainbow-gradient.png";
48 break;
49 }
50
51 auto image = ToolUtils::GetResourceAsImage(resource);
52 if (!image) {
53 return nullptr;
54 }
55
57 image->width(), image->height(), colorType, alphaType, image->refColorSpace()));
58 surface->getCanvas()->drawImage(image, 0, 0);
59 return surface->makeImageSnapshot();
60}
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
Definition SkColorType.h:30
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:29
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:25
int width() const
Definition SkImage.h:285
int height() const
Definition SkImage.h:291
sk_sp< SkColorSpace > refColorSpace() const
Definition SkImage.cpp:158
sk_sp< SkImage > image
Definition examples.cpp:29
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ make_index_buffer()

static sk_sp< SkMesh::IndexBuffer > skiagm::make_index_buffer ( GrDirectContext ctx,
const void *  data,
size_t  size 
)
static

Definition at line 502 of file mesh.cpp.

504 {
505 if (ctx) {
506 return SkMeshes::MakeIndexBuffer(ctx, data, size);
507 }
508 return SkMeshes::MakeIndexBuffer(data, size);
509}
SK_API sk_sp< SkMesh::IndexBuffer > MakeIndexBuffer(const void *data, size_t size)
Definition SkMesh.cpp:889

◆ make_path_move()

static SkPath skiagm::make_path_move ( )
static

Definition at line 129 of file emptypath.cpp.

129 {
130 SkPathBuilder builder;
131 for (SkPoint p : kPts) {
132 builder.moveTo(p);
133 }
134 return builder.detach();
135}
static constexpr SkPoint kPts[kPtsCount]

◆ make_path_move_close()

static SkPath skiagm::make_path_move_close ( )
static

Definition at line 137 of file emptypath.cpp.

137 {
138 SkPathBuilder builder;
139 for (SkPoint p : kPts) {
140 builder.moveTo(p).close();
141 }
142 return builder.detach();
143}

◆ make_path_move_line()

static SkPath skiagm::make_path_move_line ( )
static

Definition at line 145 of file emptypath.cpp.

145 {
146 SkPathBuilder builder;
147 for (SkPoint p : kPts) {
148 builder.moveTo(p).lineTo(p);
149 }
150 return builder.detach();
151}

◆ make_path_move_mix()

static SkPath skiagm::make_path_move_mix ( )
static

Definition at line 153 of file emptypath.cpp.

153 {
154 return SkPathBuilder().moveTo(kPts[0])
155 .moveTo(kPts[1]).close()
156 .moveTo(kPts[2]).lineTo(kPts[2])
157 .detach();
158}

◆ make_shader()

static sk_sp< SkShader > skiagm::make_shader ( const SkRect bounds)
static

Definition at line 37 of file lcdblendmodes.cpp.

37 {
38 const SkPoint pts[] = {
39 { bounds.left(), bounds.top() },
40 { bounds.right(), bounds.bottom() },
41 };
42 const SkColor colors[] = {
44 };
45 return SkGradientShader::MakeLinear(pts, colors, nullptr, std::size(colors),
47}

◆ make_solid_shader()

static sk_sp< SkShader > skiagm::make_solid_shader ( )
static

Definition at line 40 of file modecolorfilters.cpp.

40 {
41 return make_color_shader(SkColorSetARGB(0xFF, 0x42, 0x82, 0x21));
42}
static sk_sp< SkShader > make_color_shader(SkColor color)

◆ make_trans_black_shader()

static sk_sp< SkShader > skiagm::make_trans_black_shader ( )
static

Definition at line 48 of file modecolorfilters.cpp.

48 {
49 return make_color_shader(0x0);
50}

◆ make_transparent_shader()

static sk_sp< SkShader > skiagm::make_transparent_shader ( )
static

Definition at line 44 of file modecolorfilters.cpp.

44 {
45 return make_color_shader(SkColorSetARGB(0x80, 0x10, 0x70, 0x20));
46}

◆ make_vertex_buffer()

static sk_sp< SkMesh::VertexBuffer > skiagm::make_vertex_buffer ( GrDirectContext ctx,
const void *  data,
size_t  size 
)
static

Definition at line 493 of file mesh.cpp.

495 {
496 if (ctx) {
497 return SkMeshes::MakeVertexBuffer(ctx, data, size);
498 }
499 return SkMeshes::MakeVertexBuffer(data, size);
500}

◆ makebm() [1/2]

static void skiagm::makebm ( SkBitmap bm,
int  w,
int  h 
)
static

Definition at line 31 of file shaderpath.cpp.

31 {
32 bm->allocN32Pixels(w, h);
34
35 SkCanvas canvas(*bm);
36 SkScalar s = SkIntToScalar(std::min(w, h));
37 const SkPoint kPts0[] = { { 0, 0 }, { s, s } };
38 const SkPoint kPts1[] = { { s/2, 0 }, { s/2, s } };
39 const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
40 const SkColor kColors0[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
41 const SkColor kColors1[] = {0xF08000F0, 0x8080F000, 0xF000F080 };
42
43
45
46 paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos,
47 std::size(kColors0), SkTileMode::kClamp));
48 canvas.drawPaint(paint);
49 paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos,
50 std::size(kColors1), SkTileMode::kClamp));
51 canvas.drawPaint(paint);
52}
#define SK_Scalar1
Definition SkScalar.h:18
struct MyStruct s
SkScalar w
SkScalar h

◆ makebm() [2/2]

static void skiagm::makebm ( SkBitmap bm,
int  w,
int  h 
)
static

Definition at line 32 of file shadertext3.cpp.

32 {
33 bm->allocN32Pixels(w, h);
35
36 SkCanvas canvas(*bm);
37 SkScalar s = SkIntToScalar(std::min(w, h));
38 const SkPoint kPts0[] = { { 0, 0 }, { s, s } };
39 const SkPoint kPts1[] = { { s/2, 0 }, { s/2, s } };
40 const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
41 const SkColor kColors0[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
42 const SkColor kColors1[] = {0xF08000F0, 0x8080F000, 0xF000F080 };
43
44
46
47 paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos,
48 std::size(kColors0), SkTileMode::kClamp));
49 canvas.drawPaint(paint);
50 paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos,
51 std::size(kColors1), SkTileMode::kClamp));
52 canvas.drawPaint(paint);
53}

◆ MakeTileEffect()

static sk_sp< SkPathEffect > skiagm::MakeTileEffect ( )
static

Definition at line 101 of file patheffects.cpp.

101 {
102 SkMatrix m;
103 m.setScale(SkIntToScalar(12), SkIntToScalar(12));
104
106}
static sk_sp< SkPathEffect > Make(const SkMatrix &matrix, const SkPath &path)
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
Definition SkPath.cpp:3530

◆ one_d_pe()

static void skiagm::one_d_pe ( SkPaint paint)
static

Definition at line 75 of file patheffects.cpp.

75 {
78 for (unsigned i = 2; i < std::size(gXY); i += 2) {
80 }
81 b.close().offset(SkIntToScalar(-6), 0);
82 SkPath path = scale(b.detach(), 1.5f);
83
84 paint->setPathEffect(SkPath1DPathEffect::Make(path, SkIntToScalar(21), 0,
87}
static const int gXY[]
static sk_sp< SkPathEffect > Make(const SkPath &path, SkScalar advance, SkScalar phase, Style)
SkPathBuilder & offset(SkScalar dx, SkScalar dy)

◆ paint_rgn()

static void skiagm::paint_rgn ( SkCanvas canvas,
const SkAAClip clip,
const SkPaint paint 
)
static

Definition at line 30 of file simpleaaclip.cpp.

31 {
32 SkMaskBuilder mask;
33 SkBitmap bm;
34
35 clip.copyToMask(&mask);
36
37 SkAutoMaskFreeImage amfi(mask.image());
38
39 bm.installMaskPixels(mask);
40
41 // need to copy for deferred drawing test to work
42 SkBitmap bm2;
43
44 ToolUtils::copy_to(&bm2, bm.colorType(), bm);
45
46 canvas->drawImage(bm2.asImage(),
48 SK_Scalar1 * mask.fBounds.fTop,
50 &paint);
51}
std::unique_ptr< uint8_t, SkFunctionObject< SkMaskBuilder::FreeImage > > SkAutoMaskFreeImage
Definition SkMask.h:316
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
bool installMaskPixels(SkMaskBuilder &mask)
Definition SkBitmap.cpp:349
SkColorType colorType() const
Definition SkBitmap.h:160
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
bool copy_to(SkBitmap *dst, SkColorType dstColorType, const SkBitmap &src)
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
uint8_t *& image()
Definition SkMask.h:236
const SkIRect fBounds
Definition SkMask.h:42

◆ read_into_pixmap()

static void skiagm::read_into_pixmap ( SkPixmap dst,
SkImageInfo  dstInfo,
void *  dstPixels,
sk_sp< SkImage src 
)
inlinestatic

Definition at line 29 of file encode_alpha_jpeg.cpp.

30 {
31 dst->reset(dstInfo, dstPixels, dstInfo.minRowBytes());
32 src->readPixels(nullptr, *dst, 0, 0, SkImage::CachingHint::kDisallow_CachingHint);
33}
@ kDisallow_CachingHint
disallows internally caching decoded and copied pixels
Definition SkImage.h:465
size_t minRowBytes() const

◆ Register()

void skiagm::Register ( skiagm::GM gm)

Definition at line 256 of file gm.cpp.

256 {
257 // The skiagm::GMRegistry class is a subclass of sk_tools::Registry. Instances of
258 // sk_tools::Registry form a linked list (there is one such list for each subclass), where each
259 // instance holds a value and a pointer to the next sk_tools::Registry instance. The head of
260 // this linked list is stored in a global variable. The sk_tools::Registry constructor
261 // automatically pushes a new instance to the head of said linked list. Therefore, in order to
262 // register a value in the GM registry, it suffices to just instantiate skiagm::GMRegistry with
263 // the value we wish to register.
264 new skiagm::GMRegistry([=]() { return std::unique_ptr<skiagm::GM>(gm); });
265}
sk_tools::Registry< GMFactory > GMRegistry
Definition gm.h:240

◆ run()

static GM::DrawResult skiagm::run ( GrRecordingContext rContext,
SkCanvas canvas,
SkString errorMsg,
bool  subsetSrc,
bool  ref 
)
static

Definition at line 190 of file gpu_blur_utils.cpp.

191 {
192 GrSurfaceProxyView src = make_src_image(rContext, {60, 60});
193 if (!src) {
194 *errorMsg = "Failed to create source image";
195 return DrawResult::kSkip;
196 }
197
199 if (!sdc) {
200 *errorMsg = GM::kErrorMsg_DrawSkippedGpuOnly;
201 return DrawResult::kSkip;
202 }
203
204 SkIRect srcRect = SkIRect::MakeSize(src.dimensions());
205 if (subsetSrc) {
206 srcRect = SkIRect::MakeXYWH(2.f*srcRect.width() /8.f,
207 1.f*srcRect.height()/8.f,
208 5.f*srcRect.width() /8.f,
209 6.f*srcRect.height()/8.f);
210 }
211 int srcW = srcRect.width();
212 int srcH = srcRect.height();
213 // Each set of rects is drawn in one test area so they probably should not abut or overlap
214 // to visualize the blurs separately.
215 const std::vector<SkIRect> dstRectSets[] = {
216 // encloses source bounds.
217 {
218 srcRect.makeOutset(srcW/5, srcH/5)
219 },
220
221 // partial overlap from above/below.
222 {
223 SkIRect::MakeXYWH(srcRect.x(), srcRect.y() + 3*srcH/4, srcW, srcH),
224 SkIRect::MakeXYWH(srcRect.x(), srcRect.y() - 3*srcH/4, srcW, srcH)
225 },
226
227 // adjacent to each side of src bounds.
228 {
229 srcRect.makeOffset( 0, srcH),
230 srcRect.makeOffset( srcW, 0),
231 srcRect.makeOffset( 0, -srcH),
232 srcRect.makeOffset(-srcW, 0),
233 },
234
235 // fully outside src bounds in one direction.
236 {
237 SkIRect::MakeXYWH(-6.f*srcW/8.f, -7.f*srcH/8.f, 4.f*srcW/8.f, 20.f*srcH/8.f)
238 .makeOffset(srcRect.topLeft()),
239 SkIRect::MakeXYWH(-1.f*srcW/8.f, -7.f*srcH/8.f, 16.f*srcW/8.f, 2.f*srcH/8.f)
240 .makeOffset(srcRect.topLeft()),
241 SkIRect::MakeXYWH(10.f*srcW/8.f, -3.f*srcH/8.f, 4.f*srcW/8.f, 16.f*srcH/8.f)
242 .makeOffset(srcRect.topLeft()),
243 SkIRect::MakeXYWH(-7.f*srcW/8.f, 14.f*srcH/8.f, 18.f*srcW/8.f, 1.f*srcH/8.f)
244 .makeOffset(srcRect.topLeft()),
245 },
246
247 // outside of src bounds in both directions.
248 {
249 SkIRect::MakeXYWH(-5.f*srcW/8.f, -5.f*srcH/8.f, 2.f*srcW/8.f, 2.f*srcH/8.f)
250 .makeOffset(srcRect.topLeft()),
251 SkIRect::MakeXYWH(-5.f*srcW/8.f, 12.f*srcH/8.f, 2.f*srcW/8.f, 2.f*srcH/8.f)
252 .makeOffset(srcRect.topLeft()),
253 SkIRect::MakeXYWH(12.f*srcW/8.f, -5.f*srcH/8.f, 2.f*srcW/8.f, 2.f*srcH/8.f)
254 .makeOffset(srcRect.topLeft()),
255 SkIRect::MakeXYWH(12.f*srcW/8.f, 12.f*srcH/8.f, 2.f*srcW/8.f, 2.f*srcH/8.f)
256 .makeOffset(srcRect.topLeft()),
257 },
258 };
259
260 const auto& caps = *rContext->priv().caps();
261
262 static constexpr SkScalar kPad = 10;
263 SkVector trans = {kPad, kPad};
264
265 sdc->clear(SK_PMColor4fWHITE);
266
267 SkIRect testArea = srcRect;
268 testArea.outset(testArea.width(), testArea.height());
269 for (const auto& dstRectSet : dstRectSets) {
270 for (int t = 0; t < kSkTileModeCount; ++t) {
271 auto mode = static_cast<SkTileMode>(t);
272 GrSamplerState sampler(SkTileModeToWrapMode(mode), GrSamplerState::Filter::kNearest);
273 SkMatrix m = SkMatrix::Translate(trans.x() - testArea.x(), trans.y() - testArea.y());
274 // Draw the src subset in the tile mode faded as a reference before drawing the blur
275 // on top.
276 {
277 static constexpr float kAlpha = 0.2f;
279 sampler, SkRect::Make(srcRect), caps);
283 paint.setColorFragmentProcessor(std::move(fp));
284 sdc->drawRect(nullptr, std::move(paint), GrAA::kNo, m, SkRect::Make(testArea));
285 }
286 // Do a blur for each dstRect in the set over our testArea-sized background.
287 for (const auto& dstRect : dstRectSet) {
288 const SkScalar sigmaX = src.width() / 10.f;
289 const SkScalar sigmaY = src.height() / 10.f;
290 auto blurFn = ref ? slow_blur : blur;
291 // Blur using the rect and draw on top.
292 if (auto blurView = blurFn(rContext,
293 src,
294 dstRect,
295 srcRect,
296 sigmaX,
297 sigmaY,
298 mode)) {
299 auto fp = GrTextureEffect::Make(blurView,
301 SkMatrix::I(),
302 sampler,
303 caps);
304 // Compose against white (default paint color)
305 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kSrcOver>(std::move(fp),
306 /*dst=*/nullptr);
308 // Compose against white (default paint color) and then replace the dst
309 // (SkBlendMode::kSrc).
310 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kSrcOver>(std::move(fp),
311 /*dst=*/nullptr);
312 paint.setColorFragmentProcessor(std::move(fp));
313 paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
314 sdc->fillRectToRect(nullptr,
315 std::move(paint),
316 GrAA::kNo,
317 m,
318 SkRect::Make(dstRect),
319 SkRect::Make(blurView.dimensions()));
320 }
321 // Show the outline of the dst rect. Mostly for kDecal but also allows visual
322 // confirmation that the resulting blur is the right size and in the right place.
323 {
325 static constexpr float kAlpha = 0.6f;
326 paint.setColor4f({0, kAlpha, 0, kAlpha});
327 SkPaint stroke;
329 stroke.setStrokeWidth(1.f);
330 GrStyle style(stroke);
331 auto dstR = SkRect::Make(dstRect).makeOutset(0.5f, 0.5f);
332 sdc->drawRect(nullptr, std::move(paint), GrAA::kNo, m, dstR, &style);
333 }
334 }
335 // Show the rect that's being blurred.
336 {
338 static constexpr float kAlpha = 0.3f;
339 paint.setColor4f({0, 0, 0, kAlpha});
340 SkPaint stroke;
342 stroke.setStrokeWidth(1.f);
343 GrStyle style(stroke);
344 auto srcR = SkRect::Make(srcRect).makeOutset(0.5f, 0.5f);
345 sdc->drawRect(nullptr, std::move(paint), GrAA::kNo, m, srcR, &style);
346 }
347 trans.fX += testArea.width() + kPad;
348 }
349 trans.fX = kPad;
350 trans.fY += testArea.height() + kPad;
351 }
352
353 return DrawResult::kOk;
354}
static const uint64_t kAlpha
constexpr SkPMColor4f SK_PMColor4fWHITE
static constexpr GrSamplerState::WrapMode SkTileModeToWrapMode(SkTileMode tileMode)
Definition SkGr.h:77
const GrCaps * caps() const
static std::unique_ptr< GrFragmentProcessor > ModulateRGBA(std::unique_ptr< GrFragmentProcessor > child, const SkPMColor4f &color)
GrRecordingContextPriv priv()
static std::unique_ptr< GrFragmentProcessor > MakeSubset(GrSurfaceProxyView, SkAlphaType, const SkMatrix &, GrSamplerState, const SkRect &subset, const GrCaps &caps, const float border[4]=kDefaultBorder, bool alwaysUseShaderTileMode=false)
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 mode
Definition switches.h:228
constexpr int32_t x() const
Definition SkRect.h:141
constexpr int32_t y() const
Definition SkRect.h:148
constexpr int32_t height() const
Definition SkRect.h:165
constexpr int32_t width() const
Definition SkRect.h:158
void outset(int32_t dx, int32_t dy)
Definition SkRect.h:428
constexpr float y() const
constexpr float x() const
SkRect makeOutset(float dx, float dy) const
Definition SkRect.h:1002

◆ scale()

static SkPath skiagm::scale ( const SkPath path,
SkScalar  scale 
)
static

Definition at line 69 of file patheffects.cpp.

69 {
70 SkMatrix m;
71 m.setScale(scale, scale);
72 return path.makeTransform(m);
73}

◆ SkSamplingOptions() [1/2]

skiagm::SkSamplingOptions ( SkFilterMode::kLinear  )

◆ SkSamplingOptions() [2/2]

skiagm::SkSamplingOptions ( {1/3.0f, 1/3.0f}  )

◆ stroke_pe()

static void skiagm::stroke_pe ( SkPaint paint)
static

Definition at line 53 of file patheffects.cpp.

53 {
54 paint->setStrokeWidth(12);
56}

◆ tile_pe()

static void skiagm::tile_pe ( SkPaint paint)
static

Definition at line 108 of file patheffects.cpp.

108 {
109 paint->setPathEffect(MakeTileEffect());
110}
static sk_sp< SkPathEffect > MakeTileEffect()

Variable Documentation

◆ false

skiagm::false

Definition at line 1040 of file wacky_yuv_formats.cpp.

◆ fCount

const int skiagm::fCount

Definition at line 307 of file gradients_2pt_conical.cpp.

◆ fMaker

const GradMaker* skiagm::fMaker

Definition at line 306 of file gradients_2pt_conical.cpp.

◆ fName

const char* skiagm::fName

Definition at line 308 of file gradients_2pt_conical.cpp.

◆ gClipAColor

constexpr SkColor skiagm::gClipAColor = SK_ColorBLUE
constexpr

Definition at line 35 of file complexclip.cpp.

◆ gClipBColor

constexpr SkColor skiagm::gClipBColor = SK_ColorRED
constexpr

Definition at line 36 of file complexclip.cpp.

◆ gColorClamp

constexpr SkColor skiagm::gColorClamp[]
constexpr

◆ gColors

constexpr SkColor skiagm::gColors[]
constexpr

◆ gDrawMthds

constexpr drawMth skiagm::gDrawMthds[]
constexpr
Initial value:
= {
}
static void draw_bitmap(SkCanvas *canvas, const SkRect &r, sk_sp< SkImageFilter > imf)
static void draw_rect(SkCanvas *canvas, SkImage *, const SkRect &r, sk_sp< SkImageFilter > imf)
static void draw_drrect(SkCanvas *canvas, const SkRect &r, const SkPaint &p)
static void draw_rrect(SkCanvas *canvas, const SkRect &r, const SkPaint &p)
static void draw_points(SkCanvas *canvas, SkImage *image)
static void draw_oval(SkCanvas *canvas, const SkPaint &paint, const SkFont &)
Definition srcmode.cpp:65

Definition at line 94 of file filterfastbounds.cpp.

◆ [struct]

constexpr struct { ... } skiagm::gGradCases[]
Initial value:
= {
{ gGradMakersOutside, std::size(gGradMakersOutside), "outside" },
{ gGradMakersInside, std::size(gGradMakersInside), "inside" },
{ gGradMakersEdgeCases, std::size(gGradMakersEdgeCases), "edge" },
}
constexpr GradMaker gGradMakersInside[]
constexpr GradMaker gGradMakersOutside[]

◆ gGradData

constexpr GradData skiagm::gGradData[]
constexpr
Initial value:
= {
{ 2, gColors, gPos0 },
{ 2, gColors, gPos1 },
{ 5, gColors, gPos2 },
}
static const SkColor gColors[]
static const SkScalar gPos2[]
static const SkScalar gPos1[]
static const SkScalar gPos0[]
constexpr SkColor gColorClamp[]
constexpr SkScalar gPosClamp[]

Definition at line 46 of file gradients_2pt_conical.cpp.

46 {
47 { 2, gColors, gPos0 },
48 { 2, gColors, gPos1 },
49 { 5, gColors, gPos2 },
51};

◆ gGradMakersEdgeCases

constexpr GradMaker skiagm::gGradMakersEdgeCases[]
constexpr
Initial value:
= {
}
static sk_sp< SkShader > Make2ConicalInsideSmallRad(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalTouchX(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalZeroRadEdgeY(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalEdgeY(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalTouchY(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalEdgeX(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalZeroRadEdgeX(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)

Definition at line 297 of file gradients_2pt_conical.cpp.

◆ gGradMakersInside

constexpr GradMaker skiagm::gGradMakersInside[]
constexpr
Initial value:
= {
}
static sk_sp< SkShader > Make2ConicalZeroRad(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalZeroRadCenter(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalZeroRadFlip(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalInside(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalInsideCenter(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalInsideCenterReversed(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalInsideFlip(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)

Definition at line 291 of file gradients_2pt_conical.cpp.

◆ gGradMakersOutside

constexpr GradMaker skiagm::gGradMakersOutside[]
constexpr
Initial value:
= {
}
static sk_sp< SkShader > Make2ConicalZeroRadOutside(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalOutsideStrip(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalZeroRadFlipOutside(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalOutside(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)
static sk_sp< SkShader > Make2ConicalOutsideFlip(const SkPoint pts[2], const GradData &data, SkTileMode tm, const SkMatrix &localMatrix)

Definition at line 285 of file gradients_2pt_conical.cpp.

◆ gPathColor

constexpr SkColor skiagm::gPathColor = SK_ColorBLACK
constexpr

Definition at line 34 of file complexclip.cpp.

◆ gPE

constexpr PE_Proc skiagm::gPE[] = { hair_pe, hair2_pe, stroke_pe, dash_pe, one_d_pe }
constexpr

Definition at line 90 of file patheffects.cpp.

static bool one_d_pe(const int *array, const unsigned int count, skiatest::Reporter *reporter)
static void hair_pe(SkPaint *paint)
static void stroke_pe(SkPaint *paint)
static void dash_pe(SkPaint *paint)
static void hair2_pe(SkPaint *paint)

◆ gPE2

constexpr PE_Proc skiagm::gPE2[] = { fill_pe, discrete_pe, tile_pe }
constexpr

Definition at line 112 of file patheffects.cpp.

static void fill_pe(SkPaint *paint)
static void tile_pe(SkPaint *paint)
static void discrete_pe(SkPaint *paint)

◆ gPos0

constexpr SkScalar skiagm::gPos0[] = { 0, SK_Scalar1 }
constexpr

Definition at line 35 of file gradients_2pt_conical.cpp.

35{ 0, SK_Scalar1 };

◆ gPos1

constexpr SkScalar skiagm::gPos1[] = { SK_Scalar1/4, SK_Scalar1*3/4 }
constexpr

Definition at line 36 of file gradients_2pt_conical.cpp.

36{ SK_Scalar1/4, SK_Scalar1*3/4 };

◆ gPos2

constexpr SkScalar skiagm::gPos2[]
constexpr
Initial value:

Definition at line 37 of file gradients_2pt_conical.cpp.

37 {
39};

◆ gPosClamp

constexpr SkScalar skiagm::gPosClamp[] = {0.0f, 0.0f, 1.0f, 1.0f}
constexpr

Definition at line 41 of file gradients_2pt_conical.cpp.

41{0.0f, 0.0f, 1.0f, 1.0f};

◆ gXY

constexpr int skiagm::gXY[]
constexpr
Initial value:
= {
4, 0, 0, -4, 8, -4, 12, 0, 8, 4, 0, 4
}

Definition at line 65 of file patheffects.cpp.

65 {
664, 0, 0, -4, 8, -4, 12, 0, 8, 4, 0, 4
67};

◆ imageHeight [1/2]

const int skiagm::imageHeight = 128
static

Definition at line 25 of file encode_color_types.cpp.

◆ imageHeight [2/2]

const int skiagm::imageHeight = 128
static

Definition at line 33 of file encode_srgb.cpp.

◆ imageWidth [1/2]

const int skiagm::imageWidth = 128
static

Definition at line 24 of file encode_color_types.cpp.

◆ imageWidth [2/2]

const int skiagm::imageWidth = 128
static

Definition at line 32 of file encode_srgb.cpp.

◆ kBoxSize

constexpr int skiagm::kBoxSize = 100
staticconstexpr

Definition at line 29 of file sharedcorners.cpp.

◆ kColWidth

constexpr int skiagm::kColWidth = 180
constexpr

Definition at line 32 of file lcdblendmodes.cpp.

◆ kHeight

constexpr int skiagm::kHeight = 750
constexpr

Definition at line 35 of file lcdblendmodes.cpp.

◆ kJitters

constexpr SkPoint skiagm::kJitters[] = {{0, 0}, {.5f, .5f}, {2/3.f, 1/3.f}}
staticconstexpr

Definition at line 30 of file sharedcorners.cpp.

30{{0, 0}, {.5f, .5f}, {2/3.f, 1/3.f}};

◆ kNumCols

constexpr int skiagm::kNumCols = 4
constexpr

Definition at line 33 of file lcdblendmodes.cpp.

◆ kPadSize

constexpr int skiagm::kPadSize = 20
staticconstexpr

Definition at line 28 of file sharedcorners.cpp.

◆ kPointSize

constexpr int skiagm::kPointSize = 300
constexpr

Definition at line 61 of file shaderpath.cpp.

◆ kPts

constexpr SkPoint skiagm::kPts[kPtsCount]
staticconstexpr
Initial value:
= {
{40, 40},
{80, 40},
{120, 40},
}

Definition at line 123 of file emptypath.cpp.

123 {
124 {40, 40},
125 {80, 40},
126 {120, 40},
127};

◆ kPtsCount

constexpr int skiagm::kPtsCount = 3
staticconstexpr

Definition at line 122 of file emptypath.cpp.

◆ kShowSlowRefImages

bool constexpr skiagm::kShowSlowRefImages = false
staticconstexpr

Definition at line 375 of file gpu_blur_utils.cpp.

◆ kSize

static constexpr int skiagm::kSize = 700
constexpr

Definition at line 139 of file bigrrectaaeffect.cpp.

◆ kSrcImageClip

constexpr SkRect skiagm::kSrcImageClip {75, 75, 275, 275}
constexpr

Definition at line 26 of file croppedrects.cpp.

26{75, 75, 275, 275};

◆ kStrokeWidth

constexpr float skiagm::kStrokeWidth = 20.f
staticconstexpr

Definition at line 261 of file strokedlines.cpp.

◆ kWidth

constexpr int skiagm::kWidth = kColWidth * kNumCols
constexpr

Definition at line 34 of file lcdblendmodes.cpp.

◆ SH

constexpr SkScalar skiagm::SH = SkIntToScalar(H)
constexpr

Definition at line 24 of file strokerects.cpp.

◆ SW

constexpr SkScalar skiagm::SW = SkIntToScalar(W)
constexpr

Definition at line 23 of file strokerects.cpp.

◆ true

skiagm::true

Definition at line 1039 of file wacky_yuv_formats.cpp.

◆ ttf

fonts Distortable skiagm::ttf

Definition at line 192 of file fontations.cpp.