blob: 3bb7aa1553dae19cc480ed7234d6c16e55131cc6 [file] [log] [blame]
* Copyright 2015 Google Inc.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
#ifndef GrDrawAtlasOp_DEFINED
#define GrDrawAtlasOp_DEFINED
#include "GrColor.h"
#include "GrDefaultGeoProcFactory.h"
#include "GrMeshDrawOp.h"
#include "GrSimpleMeshDrawOpHelper.h"
class GrDrawAtlasOp final : public GrMeshDrawOp {
using Helper = GrSimpleMeshDrawOpHelper;
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
GrPaint&& paint,
const SkMatrix& viewMatrix,
GrAAType aaType,
int spriteCount,
const SkRSXform* xforms,
const SkRect* rects,
const SkColor* colors) {
return Helper::FactoryHelper<GrDrawAtlasOp>(context, std::move(paint), viewMatrix, aaType,
spriteCount, xforms, rects, colors);
GrDrawAtlasOp(const Helper::MakeArgs& helperArgs, GrColor color, const SkMatrix& viewMatrix,
GrAAType, int spriteCount, const SkRSXform* xforms, const SkRect* rects,
const SkColor* colors);
const char* name() const override { return "DrawAtlasOp"; }
void visitProxies(const VisitProxyFunc& func) const override {
SkString dumpInfo() const override;
FixedFunctionFlags fixedFunctionFlags() const override;
RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip,
GrPixelConfigIsClamped dstIsClamped) override;
void onPrepareDraws(Target*) override;
GrColor color() const { return fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
bool hasColors() const { return fHasColors; }
int quadCount() const { return fQuadCount; }
bool onCombineIfPossible(GrOp* t, const GrCaps&) override;
struct Geometry {
GrColor fColor;
SkTArray<uint8_t, true> fVerts;
SkSTArray<1, Geometry, true> fGeoData;
Helper fHelper;
SkMatrix fViewMatrix;
GrColor fColor;
int fQuadCount;
bool fHasColors;
typedef GrMeshDrawOp INHERITED;