blob: 0c848421c0c308c249b7eac64a6806b714a486f6 [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,
joshualitt56995b52014-12-11 15:44:02 -080025 bool useColorAttrib, bool opaqueVertexColors) {
26 return SkNEW_ARGS(GrBitmapTextGeoProc, (color, tex, p, useColorAttrib, opaqueVertexColors));
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000027 }
28
egdaniel309e3462014-12-09 10:35:58 -080029 virtual ~GrBitmapTextGeoProc() {}
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000030
joshualitteb2a6762014-12-04 11:35:33 -080031 virtual const char* name() const SK_OVERRIDE { return "Texture"; }
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000032
joshualitt2dd1ae02014-12-03 06:24:10 -080033 const GrAttribute* inPosition() const { return fInPosition; }
34 const GrAttribute* inColor() const { return fInColor; }
35 const GrAttribute* inTextureCoords() const { return fInTextureCoords; }
joshualitt249af152014-09-15 11:41:13 -070036
joshualitteb2a6762014-12-04 11:35:33 -080037 virtual void getGLProcessorKey(const GrBatchTracker& bt,
38 const GrGLCaps& caps,
39 GrProcessorKeyBuilder* b) const SK_OVERRIDE;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000040
joshualitteb2a6762014-12-04 11:35:33 -080041 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000042
43private:
joshualitt56995b52014-12-11 15:44:02 -080044 GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params,
45 bool useColorAttrib, bool opaqueVertexColors);
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000046
bsalomon0e08fc12014-10-15 08:19:04 -070047 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000048
joshualitt56995b52014-12-11 15:44:02 -080049 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE;
egdaniel1a8ecdf2014-10-03 06:24:12 -070050
joshualitt249af152014-09-15 11:41:13 -070051 GrTextureAccess fTextureAccess;
joshualitt2dd1ae02014-12-03 06:24:10 -080052 const GrAttribute* fInPosition;
53 const GrAttribute* fInColor;
54 const GrAttribute* fInTextureCoords;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000055
joshualittb0a8a372014-09-23 09:50:21 -070056 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000057
joshualitt249af152014-09-15 11:41:13 -070058 typedef GrGeometryProcessor INHERITED;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000059};
60
61#endif