blob: d2d0422fc9d683ed0447f3e9e32c5a610b7861ab [file] [log] [blame]
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +00001/*
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
egdaniel309e3462014-12-09 10:35:58 -08008#ifndef GrBitmapTextGeoProc_DEFINED
9#define GrBitmapTextGeoProc_DEFINED
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000010
joshualittb0a8a372014-09-23 09:50:21 -070011#include "GrProcessor.h"
joshualitt249af152014-09-15 11:41:13 -070012#include "GrGeometryProcessor.h"
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000013
egdaniel309e3462014-12-09 10:35:58 -080014class GrGLBitmapTextGeoProc;
egdaniel605dd0f2014-11-12 08:35:25 -080015class GrInvariantOutput;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000016
17/**
18 * The output color of this effect is a modulation of the input color and a sample from a texture.
19 * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
20 * coords are a custom attribute.
21 */
egdaniel309e3462014-12-09 10:35:58 -080022class GrBitmapTextGeoProc : public GrGeometryProcessor {
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000023public:
joshualitt2e3b3e32014-12-09 13:31:14 -080024 static GrGeometryProcessor* Create(GrColor color, GrTexture* tex, const GrTextureParams& p,
joshualitt1ba8cc92015-05-13 12:24:23 -070025 GrMaskFormat format,
joshualitt8fc6c2d2014-12-22 15:27:05 -080026 const SkMatrix& localMatrix) {
joshualitt1ba8cc92015-05-13 12:24:23 -070027 return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, format, localMatrix));
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000028 }
29
egdaniel309e3462014-12-09 10:35:58 -080030 virtual ~GrBitmapTextGeoProc() {}
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000031
mtklein36352bf2015-03-25 18:17:31 -070032 const char* name() const override { return "Texture"; }
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000033
joshualitt71c92602015-01-14 08:12:47 -080034 const Attribute* inPosition() const { return fInPosition; }
35 const Attribute* inColor() const { return fInColor; }
36 const Attribute* inTextureCoords() const { return fInTextureCoords; }
joshualitt02b05012015-02-11 06:56:30 -080037 GrMaskFormat maskFormat() const { return fMaskFormat; }
joshualitt249af152014-09-15 11:41:13 -070038
joshualitteb2a6762014-12-04 11:35:33 -080039 virtual void getGLProcessorKey(const GrBatchTracker& bt,
jvanverthcfc18862015-04-28 08:48:20 -070040 const GrGLSLCaps& caps,
mtklein36352bf2015-03-25 18:17:31 -070041 GrProcessorKeyBuilder* b) const override;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000042
joshualittabb52a12015-01-13 15:02:10 -080043 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
jvanverthcfc18862015-04-28 08:48:20 -070044 const GrGLSLCaps& caps) const override;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000045
mtklein36352bf2015-03-25 18:17:31 -070046 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override;
joshualitt9b989322014-12-15 14:16:27 -080047
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000048private:
joshualitt56995b52014-12-11 15:44:02 -080049 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params,
joshualitt1ba8cc92015-05-13 12:24:23 -070050 GrMaskFormat format, const SkMatrix& localMatrix);
egdaniel1a8ecdf2014-10-03 06:24:12 -070051
joshualitt02b05012015-02-11 06:56:30 -080052 GrTextureAccess fTextureAccess;
joshualitt71c92602015-01-14 08:12:47 -080053 const Attribute* fInPosition;
54 const Attribute* fInColor;
55 const Attribute* fInTextureCoords;
joshualitt02b05012015-02-11 06:56:30 -080056 GrMaskFormat fMaskFormat;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000057
joshualittb0a8a372014-09-23 09:50:21 -070058 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000059
joshualitt249af152014-09-15 11:41:13 -070060 typedef GrGeometryProcessor INHERITED;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000061};
62
63#endif