#include "src/gpu/ganesh/effects/GrBitmapTextGeoProc.h"
#include "include/core/SkSamplingOptions.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkMath.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkRandom.h"
#include "src/core/SkSLTypeShared.h"
#include "src/gpu/AtlasTypes.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrColor.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrShaderVar.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/GrTestUtils.h"
#include "src/gpu/ganesh/effects/GrAtlasedShaderHelpers.h"
#include "src/gpu/ganesh/glsl/GrGLSLColorSpaceXformHelper.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
#include "src/gpu/ganesh/glsl/GrGLSLVarying.h"
#include <algorithm>
class GrGLSLVertexBuilder;
MaskFormat;
class GrBitmapTextGeoProc::Impl : public ProgramImpl { … };
GrBitmapTextGeoProc::GrBitmapTextGeoProc(const GrShaderCaps& caps,
const SkPMColor4f& color,
bool wideColor,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const GrSurfaceProxyView* views,
int numActiveViews,
GrSamplerState params,
MaskFormat format,
const SkMatrix& localMatrix,
bool usesW)
: … { … }
void GrBitmapTextGeoProc::addNewViews(const GrSurfaceProxyView* views,
int numActiveViews,
GrSamplerState params) { … }
void GrBitmapTextGeoProc::addToKey(const GrShaderCaps& caps, skgpu::KeyBuilder* b) const { … }
std::unique_ptr<GrGeometryProcessor::ProgramImpl> GrBitmapTextGeoProc::makeProgramImpl(
const GrShaderCaps& caps) const { … }
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(…)
#if defined(GPU_TEST_UTILS)
GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) {
auto [view, ct, at] = d->randomView();
GrSamplerState::WrapMode wrapModes[2];
GrTest::TestWrapModes(d->fRandom, wrapModes);
GrSamplerState samplerState(wrapModes, d->fRandom->nextBool()
? GrSamplerState::Filter::kLinear
: GrSamplerState::Filter::kNearest);
MaskFormat format;
switch (ct) {
case GrColorType::kAlpha_8:
format = MaskFormat::kA8;
break;
case GrColorType::kBGR_565:
format = MaskFormat::kA565;
break;
case GrColorType::kRGBA_8888:
default:
format = MaskFormat::kARGB;
break;
}
GrColor color = GrTest::RandomColor(d->fRandom);
bool wideColor = d->fRandom->nextBool();
SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
bool usesW = d->fRandom->nextBool();
return GrBitmapTextGeoProc::Make(d->allocator(), *d->caps()->shaderCaps(),
SkPMColor4f::FromBytes_RGBA(color),
wideColor, nullptr,
&view, 1, samplerState, format,
localMatrix, usesW);
}
#endif