Flutter Engine
The Flutter Engine
GrBitmapTextGeoProc.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrBitmapTextGeoProc_DEFINED
9#define GrBitmapTextGeoProc_DEFINED
10
13#include "include/core/SkSize.h"
20
21#include <memory>
22#include <utility>
23
25struct GrShaderCaps;
26
27namespace skgpu {
28class KeyBuilder;
29enum class MaskFormat : int;
30}
31
32/**
33 * The output color of this effect is a modulation of the input color and a sample from a texture.
34 * It allows explicit specification of the filtering and wrap modes (GrSamplerState). The input
35 * coords are a custom attribute.
36 */
38public:
39 inline static constexpr int kMaxTextures = 4;
40
42 const GrShaderCaps& caps,
43 const SkPMColor4f& color,
44 bool wideColor,
45 sk_sp<GrColorSpaceXform> colorSpaceXform,
46 const GrSurfaceProxyView* views,
47 int numActiveViews,
50 const SkMatrix& localMatrix,
51 bool usesW) {
52 return arena->make([&](void* ptr) {
53 return new (ptr) GrBitmapTextGeoProc(caps, color, wideColor, std::move(colorSpaceXform),
54 views, numActiveViews,
55 p, format, localMatrix, usesW);
56 });
57 }
58
60
61 const char* name() const override { return "BitmapText"; }
62
63 void addNewViews(const GrSurfaceProxyView*, int numActiveViews, GrSamplerState);
64
65 void addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const override;
66
67 std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps& caps) const override;
68
69private:
70 class Impl;
71
72 GrBitmapTextGeoProc(const GrShaderCaps&, const SkPMColor4f&, bool wideColor,
73 sk_sp<GrColorSpaceXform> colorSpaceXform,
74 const GrSurfaceProxyView* views, int numViews, GrSamplerState params,
75 skgpu::MaskFormat format, const SkMatrix& localMatrix, bool usesW);
76
77 bool hasVertexColor() const { return fInColor.isInitialized(); }
78
79 const TextureSampler& onTextureSampler(int i) const override { return fTextureSamplers[i]; }
80
81 SkPMColor4f fColor;
82 sk_sp<GrColorSpaceXform> fColorSpaceXform;
83 SkMatrix fLocalMatrix;
84 bool fUsesW;
85 SkISize fAtlasDimensions; // dims for all textures used with fTextureSamplers
86 TextureSampler fTextureSamplers[kMaxTextures];
87 Attribute fInPosition;
88 Attribute fInColor;
89 Attribute fInTextureCoords;
90 skgpu::MaskFormat fMaskFormat;
91
93
95};
96
97#endif
#define GR_DECLARE_GEOMETRY_PROCESSOR_TEST
#define INHERITED(method,...)
Definition: SkRecorder.cpp:128
static GrGeometryProcessor * Make(SkArenaAlloc *arena, const GrShaderCaps &caps, const SkPMColor4f &color, bool wideColor, sk_sp< GrColorSpaceXform > colorSpaceXform, const GrSurfaceProxyView *views, int numActiveViews, GrSamplerState p, skgpu::MaskFormat format, const SkMatrix &localMatrix, bool usesW)
void addToKey(const GrShaderCaps &caps, skgpu::KeyBuilder *b) const override
const char * name() const override
static constexpr int kMaxTextures
std::unique_ptr< ProgramImpl > makeProgramImpl(const GrShaderCaps &caps) const override
void addNewViews(const GrSurfaceProxyView *, int numActiveViews, GrSamplerState)
constexpr bool isInitialized() const
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
Definition: SkArenaAlloc.h:120
DlColor color
const EmbeddedViewParams * params
static bool b
uint32_t uint32_t * format
Definition: GpuTools.h:21
MaskFormat
Definition: AtlasTypes.h:98
Definition: SkSize.h:16