'<(skia_src_path)/gpu/effects/GrConvexPolyEffect.h',
'<(skia_src_path)/gpu/effects/GrBicubicEffect.cpp',
'<(skia_src_path)/gpu/effects/GrBicubicEffect.h',
- '<(skia_src_path)/gpu/effects/GrCustomCoordsTextureEffect.cpp',
- '<(skia_src_path)/gpu/effects/GrCustomCoordsTextureEffect.h',
+ '<(skia_src_path)/gpu/effects/GrBitmapTextGeoProc.cpp',
+ '<(skia_src_path)/gpu/effects/GrBitmapTextGeoProc.h',
'<(skia_src_path)/gpu/effects/GrDashingEffect.cpp',
'<(skia_src_path)/gpu/effects/GrDashingEffect.h',
'<(skia_src_path)/gpu/effects/GrDistanceFieldTextureEffect.cpp',
class GrInvariantOutput {
public:
GrInvariantOutput(GrColor color, GrColorComponentFlags flags, bool isSingleComponent)
- : fColor(color), fValidFlags(flags), fIsSingleComponent(isSingleComponent),
- fNonMulStageFound(false), fWillUseInputColor(true) {}
+ : fColor(color)
+ , fValidFlags(flags)
+ , fIsSingleComponent(isSingleComponent)
+ , fNonMulStageFound(false)
+ , fWillUseInputColor(true)
+ , fIsLCDCoverage(false) {}
virtual ~GrInvariantOutput() {}
}
}
+ // Temporary setter to handle LCD text correctly until we improve texture pixel config queries
+ // and thus can rely solely on number of coverage components for RGA vs single channel coverage.
+ void setUsingLCDCoverage() {
+ fIsLCDCoverage = true;
+ }
+
GrColor color() const { return fColor; }
uint8_t validFlags() const { return fValidFlags; }
*/
SkDEBUGCODE(void validate() const;)
-protected:
- GrColor fColor;
- uint32_t fValidFlags;
- bool fIsSingleComponent;
- bool fNonMulStageFound;
- bool fWillUseInputColor;
-
private:
friend class GrProcOptInfo;
void resetNonMulStageFound() { fNonMulStageFound = false; }
+ bool isLCDCoverage() const { return fIsLCDCoverage; }
+
SkDEBUGCODE(bool colorComponentsAllEqual() const;)
/**
* If alpha is valid, check that any valid R,G,B values are <= A
*/
SkDEBUGCODE(bool validPreMulColor() const;)
+
+ GrColor fColor;
+ uint32_t fValidFlags;
+ bool fIsSingleComponent;
+ bool fNonMulStageFound;
+ bool fWillUseInputColor;
+ bool fIsLCDCoverage; // Temorary data member until texture pixel configs are updated
+
};
#endif
#include "SkStrokeRec.h"
#include "SkTextMapStateProc.h"
-#include "effects/GrCustomCoordsTextureEffect.h"
+#include "effects/GrBitmapTextGeoProc.h"
#include "effects/GrSimpleTextureEffect.h"
SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
} else {
uint32_t textureUniqueID = fCurrTexture->getUniqueID();
if (textureUniqueID != fEffectTextureUniqueID) {
- bool hasColor = kA8_GrMaskFormat == fCurrMaskFormat;
- fCachedGeometryProcessor.reset(GrCustomCoordsTextureEffect::Create(fCurrTexture,
- params,
- hasColor));
+ bool useColorAttrib = kA8_GrMaskFormat == fCurrMaskFormat;
+ fCachedGeometryProcessor.reset(GrBitmapTextGeoProc::Create(fCurrTexture,
+ params,
+ useColorAttrib));
fEffectTextureUniqueID = textureUniqueID;
}
drawState.setGeometryProcessor(fCachedGeometryProcessor.get());
bool isOpaque() const { return fInOut.isOpaque(); }
bool isSingleComponent() const { return fInOut.isSingleComponent(); }
+ // TODO: Once texture pixel configs quaries are updated, we no longer need this function.
+ // For now this function will correctly tell us if we are using LCD text or not and should only
+ // be called when looking at the coverage output.
+ bool isFourChannelOutput() const { return !fInOut.isSingleComponent() &&
+ fInOut.isLCDCoverage(); }
+
GrColor color() const { return fInOut.color(); }
uint8_t validFlags() const { return fInOut.validFlags(); }
* found in the LICENSE file.
*/
-#include "GrCustomCoordsTextureEffect.h"
+#include "GrBitmapTextGeoProc.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
#include "gl/GrGLProcessor.h"
#include "gl/GrGLGeometryProcessor.h"
#include "gl/builders/GrGLProgramBuilder.h"
-class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor {
+class GrGLBitmapTextGeoProc : public GrGLGeometryProcessor {
public:
- GrGLCustomCoordsTextureEffect(const GrGeometryProcessor&,
- const GrBatchTracker&) {}
+ GrGLBitmapTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&) {}
virtual void emitCode(const EmitArgs& args) SK_OVERRIDE {
- const GrCustomCoordsTextureEffect& cte =
- args.fGP.cast<GrCustomCoordsTextureEffect>();
+ const GrBitmapTextGeoProc& cte = args.fGP.cast<GrBitmapTextGeoProc>();
GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
const GrBatchTracker&,
const GrGLCaps&,
GrProcessorKeyBuilder* b) {
- const GrCustomCoordsTextureEffect& gp = proc.cast<GrCustomCoordsTextureEffect>();
+ const GrBitmapTextGeoProc& gp = proc.cast<GrBitmapTextGeoProc>();
b->add32(SkToBool(gp.inColor()));
}
///////////////////////////////////////////////////////////////////////////////
-GrCustomCoordsTextureEffect::GrCustomCoordsTextureEffect(GrTexture* texture,
- const GrTextureParams& params,
- bool hasColor)
+GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrTexture* texture, const GrTextureParams& params,
+ bool useColorAttrib)
: fTextureAccess(texture, params), fInColor(NULL) {
- this->initClassID<GrCustomCoordsTextureEffect>();
+ this->initClassID<GrBitmapTextGeoProc>();
fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_GrVertexAttribType));
- if (hasColor) {
+ if (useColorAttrib) {
fInColor = &this->addVertexAttrib(GrAttribute("inColor", kVec4ub_GrVertexAttribType));
this->setHasVertexColor();
}
this->addTextureAccess(&fTextureAccess);
}
-bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) const {
- const GrCustomCoordsTextureEffect& gp = other.cast<GrCustomCoordsTextureEffect>();
+bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
+ const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>();
return SkToBool(this->inColor()) == SkToBool(gp.inColor());
}
-void GrCustomCoordsTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
+void GrBitmapTextGeoProc::onComputeInvariantOutput(GrInvariantOutput* inout) const {
if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
inout->mulByUnknownAlpha();
} else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
inout->mulByUnknownOpaqueColor();
+ inout->setUsingLCDCoverage();
} else {
inout->mulByUnknownColor();
+ inout->setUsingLCDCoverage();
}
}
-void GrCustomCoordsTextureEffect::getGLProcessorKey(const GrBatchTracker& bt,
- const GrGLCaps& caps,
- GrProcessorKeyBuilder* b) const {
- GrGLCustomCoordsTextureEffect::GenKey(*this, bt, caps, b);
+void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
+ const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const {
+ GrGLBitmapTextGeoProc::GenKey(*this, bt, caps, b);
}
GrGLGeometryProcessor*
-GrCustomCoordsTextureEffect::createGLInstance(const GrBatchTracker& bt) const {
- return SkNEW_ARGS(GrGLCustomCoordsTextureEffect, (*this, bt));
+GrBitmapTextGeoProc::createGLInstance(const GrBatchTracker& bt) const {
+ return SkNEW_ARGS(GrGLBitmapTextGeoProc, (*this, bt));
}
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCustomCoordsTextureEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc);
-GrGeometryProcessor* GrCustomCoordsTextureEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
+GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
static const SkShader::TileMode kTileModes[] = {
GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode :
GrTextureParams::kNone_FilterMode);
- return GrCustomCoordsTextureEffect::Create(textures[texIdx], params, random->nextBool());
+ return GrBitmapTextGeoProc::Create(textures[texIdx], params, random->nextBool());
}
* found in the LICENSE file.
*/
-#ifndef GrCustomCoordsTextureEffect_DEFINED
-#define GrCustomCoordsTextureEffect_DEFINED
+#ifndef GrBitmapTextGeoProc_DEFINED
+#define GrBitmapTextGeoProc_DEFINED
#include "GrProcessor.h"
#include "GrGeometryProcessor.h"
-class GrGLCustomCoordsTextureEffect;
+class GrGLBitmapTextGeoProc;
class GrInvariantOutput;
/**
* It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
* coords are a custom attribute.
*/
-class GrCustomCoordsTextureEffect : public GrGeometryProcessor {
+class GrBitmapTextGeoProc : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p, bool hasColor) {
- return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p, hasColor));
+ static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p,
+ bool useColorAttrib) {
+ return SkNEW_ARGS(GrBitmapTextGeoProc, (tex, p, useColorAttrib));
}
- virtual ~GrCustomCoordsTextureEffect() {}
+ virtual ~GrBitmapTextGeoProc() {}
virtual const char* name() const SK_OVERRIDE { return "Texture"; }
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params, bool hasColor);
+ GrBitmapTextGeoProc(GrTexture* texture, const GrTextureParams& params, bool useColorAttrib);
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
void GrDistanceFieldLCDTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
inout->mulByUnknownColor();
+ inout->setUsingLCDCoverage();
}
void GrDistanceFieldLCDTextureEffect::getGLProcessorKey(const GrBatchTracker& bt,