зеркало из https://github.com/mozilla/moz-skia.git
Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@8249 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
3fbab82bd3
Коммит
01c34ee599
|
@ -179,7 +179,7 @@ public:
|
||||||
|
|
||||||
fVertexAttribIndices[0] = -1;
|
fVertexAttribIndices[0] = -1;
|
||||||
fVertexAttribIndices[1] = -1;
|
fVertexAttribIndices[1] = -1;
|
||||||
|
|
||||||
return EffectRef;
|
return EffectRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,13 +187,13 @@ public:
|
||||||
GrAssert(0 == fSavedCoordChangeCnt);
|
GrAssert(0 == fSavedCoordChangeCnt);
|
||||||
GrSafeAssign(fEffectRef, EffectRef);
|
GrSafeAssign(fEffectRef, EffectRef);
|
||||||
fCoordChangeMatrix.reset();
|
fCoordChangeMatrix.reset();
|
||||||
|
|
||||||
fVertexAttribIndices[0] = attr0;
|
fVertexAttribIndices[0] = attr0;
|
||||||
fVertexAttribIndices[1] = attr1;
|
fVertexAttribIndices[1] = attr1;
|
||||||
|
|
||||||
return EffectRef;
|
return EffectRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GrEffectRef* getEffect() const { return fEffectRef; }
|
const GrEffectRef* getEffect() const { return fEffectRef; }
|
||||||
|
|
||||||
const int* getVertexAttribIndices() const { return fVertexAttribIndices; }
|
const int* getVertexAttribIndices() const { return fVertexAttribIndices; }
|
||||||
|
|
|
@ -124,7 +124,7 @@ static SkScalerContext* allocNextContext(const SkScalerContext::Rec& rec) {
|
||||||
if (0 == newFace) {
|
if (0 == newFace) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkAutoTUnref<SkTypeface> aur(newFace);
|
SkAutoTUnref<SkTypeface> aur(newFace);
|
||||||
uint32_t newFontID = newFace->uniqueID();
|
uint32_t newFontID = newFace->uniqueID();
|
||||||
|
|
||||||
|
@ -784,5 +784,3 @@ SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc) const
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
// never null
|
// never null
|
||||||
SkAutoTUnref<SkTypeface> fTypeface;
|
SkAutoTUnref<SkTypeface> fTypeface;
|
||||||
|
|
||||||
// optional object, which may be null
|
// optional object, which may be null
|
||||||
SkPathEffect* fPathEffect;
|
SkPathEffect* fPathEffect;
|
||||||
SkMaskFilter* fMaskFilter;
|
SkMaskFilter* fMaskFilter;
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ bool GrContext::canDrawOval(const GrPaint& paint, const GrRect& oval, bool* isCi
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we can draw circles
|
// we can draw circles
|
||||||
*isCircle = SkScalarNearlyEqual(oval.width(), oval.height())
|
*isCircle = SkScalarNearlyEqual(oval.width(), oval.height())
|
||||||
&& circleStaysCircle(this->getMatrix());
|
&& circleStaysCircle(this->getMatrix());
|
||||||
// and axis-aligned ellipses only
|
// and axis-aligned ellipses only
|
||||||
|
@ -1235,7 +1235,7 @@ void GrContext::internalDrawCircle(const GrPaint& paint,
|
||||||
kEdgeEffectStage = GrPaint::kTotalStages,
|
kEdgeEffectStage = GrPaint::kTotalStages,
|
||||||
};
|
};
|
||||||
drawState->setAttribBindings(GrDrawState::kDefault_AttribBindings);
|
drawState->setAttribBindings(GrDrawState::kDefault_AttribBindings);
|
||||||
|
|
||||||
GrEffectRef* effect = GrCircleEdgeEffect::Create(isStroked);
|
GrEffectRef* effect = GrCircleEdgeEffect::Create(isStroked);
|
||||||
static const int kCircleEdgeAttrIndex = 1;
|
static const int kCircleEdgeAttrIndex = 1;
|
||||||
drawState->setEffect(kEdgeEffectStage, effect, kCircleEdgeAttrIndex)->unref();
|
drawState->setEffect(kEdgeEffectStage, effect, kCircleEdgeAttrIndex)->unref();
|
||||||
|
|
|
@ -489,7 +489,7 @@ public:
|
||||||
fStages[stageIdx].setEffect(effect);
|
fStages[stageIdx].setEffect(effect);
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GrEffectRef* setEffect(int stageIdx, const GrEffectRef* effect,
|
const GrEffectRef* setEffect(int stageIdx, const GrEffectRef* effect,
|
||||||
int attr0, int attr1 = -1) {
|
int attr0, int attr1 = -1) {
|
||||||
fStages[stageIdx].setEffect(effect, attr0, attr1);
|
fStages[stageIdx].setEffect(effect, attr0, attr1);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
const char* inputColor,
|
const char* inputColor,
|
||||||
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
||||||
const GrCircleEdgeEffect& effect = GetEffectFromStage<GrCircleEdgeEffect>(stage);
|
const GrCircleEdgeEffect& effect = GetEffectFromStage<GrCircleEdgeEffect>(stage);
|
||||||
|
|
||||||
const char *vsName, *fsName;
|
const char *vsName, *fsName;
|
||||||
builder->addVarying(kVec4f_GrSLType, "CircleEdge", &vsName, &fsName);
|
builder->addVarying(kVec4f_GrSLType, "CircleEdge", &vsName, &fsName);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class GrGLCircleEdgeEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output of this effect is a modulation of the input color and coverage for a circle,
|
* The output of this effect is a modulation of the input color and coverage for a circle,
|
||||||
* specified as center_x, center_y, x_radius, inner radius and outer radius in window space
|
* specified as center_x, center_y, x_radius, inner radius and outer radius in window space
|
||||||
* (y-down).
|
* (y-down).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public:
|
||||||
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrCircleEdgeEffect, (true)))));
|
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrCircleEdgeEffect, (true)))));
|
||||||
static SkAutoTUnref<GrEffectRef> gCircleFillEdgeEffectRef(
|
static SkAutoTUnref<GrEffectRef> gCircleFillEdgeEffectRef(
|
||||||
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrCircleEdgeEffect, (false)))));
|
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrCircleEdgeEffect, (false)))));
|
||||||
|
|
||||||
if (stroke) {
|
if (stroke) {
|
||||||
gCircleStrokeEdgeEffectRef.get()->ref();
|
gCircleStrokeEdgeEffectRef.get()->ref();
|
||||||
return gCircleStrokeEdgeEffectRef;
|
return gCircleStrokeEdgeEffectRef;
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
typedef GrGLCircleEdgeEffect GLEffect;
|
typedef GrGLCircleEdgeEffect GLEffect;
|
||||||
|
|
||||||
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
|
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
|
||||||
|
|
||||||
inline bool isStroked() const { return fStroke; }
|
inline bool isStroked() const { return fStroke; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -54,7 +54,7 @@ private:
|
||||||
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
|
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fStroke;
|
bool fStroke;
|
||||||
|
|
||||||
GR_DECLARE_EFFECT_TEST;
|
GR_DECLARE_EFFECT_TEST;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
const char* inputColor,
|
const char* inputColor,
|
||||||
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
||||||
const GrEllipseEdgeEffect& effect = GetEffectFromStage<GrEllipseEdgeEffect>(stage);
|
const GrEllipseEdgeEffect& effect = GetEffectFromStage<GrEllipseEdgeEffect>(stage);
|
||||||
|
|
||||||
const char *vsCenterName, *fsCenterName;
|
const char *vsCenterName, *fsCenterName;
|
||||||
const char *vsEdgeName, *fsEdgeName;
|
const char *vsEdgeName, *fsEdgeName;
|
||||||
|
|
||||||
|
@ -49,16 +49,16 @@ public:
|
||||||
builder->fsCodeAppend("\tfloat dOuter = length(outerOffset);\n");
|
builder->fsCodeAppend("\tfloat dOuter = length(outerOffset);\n");
|
||||||
// compare outer lengths against xOuterRadius
|
// compare outer lengths against xOuterRadius
|
||||||
builder->fsCodeAppendf("\tfloat edgeAlpha = clamp(%s.x-dOuter, 0.0, 1.0);\n", fsEdgeName);
|
builder->fsCodeAppendf("\tfloat edgeAlpha = clamp(%s.x-dOuter, 0.0, 1.0);\n", fsEdgeName);
|
||||||
|
|
||||||
if (effect.isStroked()) {
|
if (effect.isStroked()) {
|
||||||
builder->fsCodeAppendf("\tinnerOffset.y *= %s.w;\n", fsEdgeName);
|
builder->fsCodeAppendf("\tinnerOffset.y *= %s.w;\n", fsEdgeName);
|
||||||
builder->fsCodeAppend("\tfloat dInner = length(innerOffset);\n");
|
builder->fsCodeAppend("\tfloat dInner = length(innerOffset);\n");
|
||||||
|
|
||||||
// compare inner lengths against xInnerRadius
|
// compare inner lengths against xInnerRadius
|
||||||
builder->fsCodeAppendf("\tfloat innerAlpha = clamp(dInner-%s.z, 0.0, 1.0);\n", fsEdgeName);
|
builder->fsCodeAppendf("\tfloat innerAlpha = clamp(dInner-%s.z, 0.0, 1.0);\n", fsEdgeName);
|
||||||
builder->fsCodeAppend("\tedgeAlpha *= innerAlpha;\n");
|
builder->fsCodeAppend("\tedgeAlpha *= innerAlpha;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SkString modulate;
|
SkString modulate;
|
||||||
GrGLSLModulate4f(&modulate, inputColor, "edgeAlpha");
|
GrGLSLModulate4f(&modulate, inputColor, "edgeAlpha");
|
||||||
builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str());
|
builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str());
|
||||||
|
@ -82,7 +82,7 @@ private:
|
||||||
GrEllipseEdgeEffect::GrEllipseEdgeEffect(bool stroke) : GrEffect() {
|
GrEllipseEdgeEffect::GrEllipseEdgeEffect(bool stroke) : GrEffect() {
|
||||||
this->addVertexAttrib(kVec2f_GrSLType);
|
this->addVertexAttrib(kVec2f_GrSLType);
|
||||||
this->addVertexAttrib(kVec4f_GrSLType);
|
this->addVertexAttrib(kVec4f_GrSLType);
|
||||||
|
|
||||||
fStroke = stroke;
|
fStroke = stroke;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrEllipseEdgeEffect, (true)))));
|
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrEllipseEdgeEffect, (true)))));
|
||||||
static SkAutoTUnref<GrEffectRef> gEllipseFillEdgeEffectRef(
|
static SkAutoTUnref<GrEffectRef> gEllipseFillEdgeEffectRef(
|
||||||
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrEllipseEdgeEffect, (false)))));
|
CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrEllipseEdgeEffect, (false)))));
|
||||||
|
|
||||||
if (stroke) {
|
if (stroke) {
|
||||||
gEllipseStrokeEdgeEffectRef.get()->ref();
|
gEllipseStrokeEdgeEffectRef.get()->ref();
|
||||||
return gEllipseStrokeEdgeEffectRef;
|
return gEllipseStrokeEdgeEffectRef;
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
|
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
|
||||||
|
|
||||||
inline bool isStroked() const { return fStroke; }
|
inline bool isStroked() const { return fStroke; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GrEllipseEdgeEffect(bool stroke);
|
GrEllipseEdgeEffect(bool stroke);
|
||||||
|
|
||||||
|
|
|
@ -1195,7 +1195,7 @@ void SkPDFDevice::getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
|
||||||
newResourceObjects->add(fGraphicStateResources[i]);
|
newResourceObjects->add(fGraphicStateResources[i]);
|
||||||
fGraphicStateResources[i]->ref();
|
fGraphicStateResources[i]->ref();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
fGraphicStateResources[i]->getResources(knownResourceObjects,
|
fGraphicStateResources[i]->getResources(knownResourceObjects,
|
||||||
newResourceObjects);
|
newResourceObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1206,7 +1206,7 @@ void SkPDFDevice::getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
|
||||||
newResourceObjects->add(fXObjectResources[i]);
|
newResourceObjects->add(fXObjectResources[i]);
|
||||||
fXObjectResources[i]->ref();
|
fXObjectResources[i]->ref();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
fXObjectResources[i]->getResources(knownResourceObjects,
|
fXObjectResources[i]->getResources(knownResourceObjects,
|
||||||
newResourceObjects);
|
newResourceObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1217,7 @@ void SkPDFDevice::getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
|
||||||
newResourceObjects->add(fFontResources[i]);
|
newResourceObjects->add(fFontResources[i]);
|
||||||
fFontResources[i]->ref();
|
fFontResources[i]->ref();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
fFontResources[i]->getResources(knownResourceObjects,
|
fFontResources[i]->getResources(knownResourceObjects,
|
||||||
newResourceObjects);
|
newResourceObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1228,7 +1228,7 @@ void SkPDFDevice::getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
|
||||||
newResourceObjects->add(fShaderResources[i]);
|
newResourceObjects->add(fShaderResources[i]);
|
||||||
fShaderResources[i]->ref();
|
fShaderResources[i]->ref();
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
fShaderResources[i]->getResources(knownResourceObjects,
|
fShaderResources[i]->getResources(knownResourceObjects,
|
||||||
newResourceObjects);
|
newResourceObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,5 +424,3 @@ bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
|
||||||
SkStream* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) {
|
SkStream* SkFontConfigInterfaceDirect::openStream(const FontIdentity& identity) {
|
||||||
return SkStream::NewFromFile(identity.fString.c_str());
|
return SkStream::NewFromFile(identity.fString.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@ protected:
|
||||||
// See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_handling.html#FT_Bitmap_Embolden
|
// See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_handling.html#FT_Bitmap_Embolden
|
||||||
// This value was chosen by eyeballing the result in Firefox and trying to match it.
|
// This value was chosen by eyeballing the result in Firefox and trying to match it.
|
||||||
static const FT_Pos kBitmapEmboldenStrength = 1 << 6;
|
static const FT_Pos kBitmapEmboldenStrength = 1 << 6;
|
||||||
|
|
||||||
SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc)
|
SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc)
|
||||||
: INHERITED(typeface, desc)
|
: INHERITED(typeface, desc)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void generateGlyphImage(FT_Face face, const SkGlyph& glyph);
|
void generateGlyphImage(FT_Face face, const SkGlyph& glyph);
|
||||||
void generateGlyphPath(FT_Face face, SkPath* path);
|
void generateGlyphPath(FT_Face face, SkPath* path);
|
||||||
void emboldenOutline(FT_Face face, FT_Outline* outline);
|
void emboldenOutline(FT_Face face, FT_Outline* outline);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче