Sanitizing source files in Housekeeper-Nightly

git-svn-id: http://skia.googlecode.com/svn/trunk@13258 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
skia.committer@gmail.com 2014-01-31 03:01:59 +00:00
parent cc787fa802
commit 4c18e9fbb6
14 changed files with 95 additions and 96 deletions

View File

@ -51,19 +51,19 @@ protected:
// This is a GPU-specific GM.
return kGPUOnly_Flag;
}
virtual void onOnceBeforeDraw() SK_OVERRIDE {
SkPath tri;
tri.moveTo(5.f, 5.f);
tri.lineTo(100.f, 20.f);
tri.lineTo(15.f, 100.f);
fPaths.addToTail(tri);
fPaths.addToTail(SkPath())->reverseAddPath(tri);
tri.close();
fPaths.addToTail(tri);
SkPath ngon;
static const SkScalar kRadius = 50.f;
const SkPoint center = { kRadius, kRadius };
@ -79,7 +79,7 @@ protected:
ngon.lineTo(point);
}
}
fPaths.addToTail(ngon);
SkMatrix scaleM;
scaleM.setScale(1.1f, 0.4f);
@ -114,12 +114,12 @@ protected:
}
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs));
SkMatrix m;
SkPath p;
m.setTranslate(x, y);
path->transform(m, &p);
GrConvexPolyEffect::EdgeType edgeType = (GrConvexPolyEffect::EdgeType) et;
SkAutoTUnref<GrEffectRef> effect(GrConvexPolyEffect::Create(edgeType, p));
if (!effect) {
@ -130,7 +130,7 @@ protected:
drawState->setIdentityViewMatrix();
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
SkPoint verts[4];
SkRect bounds = p.getBounds();
// Make sure any artifacts around the exterior of path are visible by using overly
@ -141,10 +141,10 @@ protected:
tt.target()->setVertexSourceToArray(verts, 4);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
x += path->getBounds().width() + 10.f;
}
// Draw AA and non AA paths using normal API for reference.
canvas->save();
canvas->translate(x, y);
@ -154,7 +154,7 @@ protected:
paint.setAntiAlias(true);
canvas->drawPath(*path, paint);
canvas->restore();
y += path->getBounds().height() + 20.f;
}
}

View File

@ -10,7 +10,7 @@
// The class in this header defines the interface between Skia's internal
// tracing macros and an external entity (e.g., Chrome) that will consume them.
// Such an entity should subclass SkEventTracer and provide an instance of
// Such an entity should subclass SkEventTracer and provide an instance of
// that event to SkEventTracer::SetInstance.
// If you're looking for the tracing macros to instrument Skia itself, those
@ -26,10 +26,10 @@ class SK_API SkEventTracer {
public:
typedef uint32_t Handle;
static SkEventTracer* GetInstance();
static void SetInstance(SkEventTracer* tracer) {
static void SetInstance(SkEventTracer* tracer) {
SkDELETE(SkEventTracer::gInstance);
SkEventTracer::gInstance = tracer;
}
@ -52,8 +52,8 @@ public:
virtual const unsigned char* getCategoryGroupEnabled(const char* name) = 0;
virtual const char* getCategoryGroupName(
const uint8_t* category_group_enabled) = 0;
virtual SkEventTracer::Handle
virtual SkEventTracer::Handle
addTraceEvent(char phase,
const uint8_t* categoryEnabledFlag,
const char* name,
@ -63,10 +63,10 @@ public:
const uint8_t* argTypes,
const uint64_t* argValues,
uint8_t flags) = 0;
virtual void
updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
const char* name,
virtual void
updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
const char* name,
SkEventTracer::Handle) = 0;
private:
static SkEventTracer *gInstance;

View File

@ -717,7 +717,7 @@ uint8_t SkBlurMask::ProfileLookup(const uint8_t *profile, int loc, int blurred_w
return profile[ox];
}
void SkBlurMask::ComputeBlurredScanline(uint8_t *pixels, const uint8_t *profile,
void SkBlurMask::ComputeBlurredScanline(uint8_t *pixels, const uint8_t *profile,
unsigned int width, SkScalar sigma) {
unsigned int profile_size = SkScalarCeilToInt(6*sigma);
@ -738,7 +738,7 @@ void SkBlurMask::ComputeBlurredScanline(uint8_t *pixels, const uint8_t *profile,
float giX = 1.5f - (x+.5f)/(2*sigma);
pixels[x] = (uint8_t) (255 * (gaussianIntegral(giX) - gaussianIntegral(giX + span)));
}
}
}
}
bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src,
@ -802,7 +802,7 @@ bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst,
SkAutoTMalloc<uint8_t> horizontalScanline(dstWidth);
SkAutoTMalloc<uint8_t> verticalScanline(dstHeight);
ComputeBlurredScanline(horizontalScanline, profile, dstWidth, sigma);
ComputeBlurredScanline(verticalScanline, profile, dstHeight, sigma);

View File

@ -62,27 +62,27 @@ public:
SkIPoint* margin = NULL);
static SkScalar ConvertRadiusToSigma(SkScalar radius);
/* Helper functions for analytic rectangle blurs */
/** Look up the intensity of the (one dimnensional) blurred half-plane.
@param profile The precomputed 1D blur profile; memory allocated by and managed by
ComputeBlurProfile below.
@param loc the location to look up; The lookup will clamp invalid inputs, but
@param loc the location to look up; The lookup will clamp invalid inputs, but
meaningful data are available between 0 and blurred_width
@param blurred_width The width of the final, blurred rectangle
@param sharp_width The width of the original, unblurred rectangle.
*/
*/
static uint8_t ProfileLookup(const uint8_t* profile, int loc, int blurred_width, int sharp_width);
/** Allocate memory for and populate the profile of a 1D blurred halfplane. The caller
must free the memory. The amount of memory allocated will be exactly 6*sigma bytes.
@param sigma The standard deviation of the gaussian blur kernel
@param profile_out The location to store the allocated profile curve
*/
static void ComputeBlurProfile(SkScalar sigma, uint8_t** profile_out);
/** Compute an entire scanline of a blurred step function. This is a 1D helper that
will produce both the horizontal and vertical profiles of the blurry rectangle.
@param pixels Location to store the resulting pixel data; allocated and managed by caller
@ -91,12 +91,12 @@ public:
@param sigma Standard deviation of the gaussian blur kernel used to compute the profile;
this implicitly gives the size of the pixels array.
*/
static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile,
unsigned int width, SkScalar sigma);
};
#endif

View File

@ -525,36 +525,36 @@ public:
/**
* Create a simple filter effect with custom bicubic coefficients.
*/
static GrEffectRef* Create(GrContext *context, const SkRect& rect,
static GrEffectRef* Create(GrContext *context, const SkRect& rect,
float sigma) {
GrTexture *horizontalScanline, *verticalScanline;
bool createdScanlines = CreateScanlineTextures(context, sigma,
bool createdScanlines = CreateScanlineTextures(context, sigma,
SkScalarCeilToInt(rect.width()),
SkScalarCeilToInt(rect.height()),
&horizontalScanline, &verticalScanline);
if (!createdScanlines) {
return NULL;
}
AutoEffectUnref effect(SkNEW_ARGS(GrRectBlurEffect, (rect, sigma,
AutoEffectUnref effect(SkNEW_ARGS(GrRectBlurEffect, (rect, sigma,
horizontalScanline, verticalScanline)));
return CreateEffectRef(effect);
return CreateEffectRef(effect);
}
unsigned int getWidth() const { return fWidth; }
unsigned int getHeight() const { return fHeight; }
float getSigma() const { return fSigma; }
const GrCoordTransform& getTransform() const { return fTransform; }
private:
GrRectBlurEffect(const SkRect& rect, float sigma,
GrRectBlurEffect(const SkRect& rect, float sigma,
GrTexture *horizontal_scanline, GrTexture *vertical_scanline);
virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
static bool CreateScanlineTextures(GrContext *context, float sigma,
unsigned int width, unsigned int height,
GrTexture **horizontalScanline,
GrTexture **verticalScanline);
unsigned int fWidth, fHeight;
float fSigma;
GrTextureAccess fHorizontalScanlineAccess;
@ -600,22 +600,22 @@ void GrGLRectBlurEffect::emitCode(GrGLShaderBuilder* builder,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
SkString texture_coords = builder->ensureFSCoords2D(coords, 0);
if (inputColor) {
builder->fsCodeAppendf("\tvec4 src=%s;\n", inputColor);
} else {
builder->fsCodeAppendf("\tvec4 src=vec4(1)\n;");
}
builder->fsCodeAppendf("\tvec4 horiz = ");
builder->fsAppendTextureLookup( samplers[0], texture_coords.c_str() );
builder->fsCodeAppendf(";\n");
builder->fsCodeAppendf("\tvec4 vert = ");
builder->fsAppendTextureLookup( samplers[1], texture_coords.c_str() );
builder->fsCodeAppendf(";\n");
builder->fsCodeAppendf("\tfloat final = (horiz*vert).r;\n");
builder->fsCodeAppendf("\t%s = final*src;\n", outputColor);
}
@ -630,13 +630,13 @@ bool GrRectBlurEffect::CreateScanlineTextures(GrContext *context, float sigma,
GrTexture **verticalScanline) {
GrTextureParams params;
GrTextureDesc texDesc;
unsigned int profile_size = SkScalarFloorToInt(6*sigma);
texDesc.fWidth = width;
texDesc.fHeight = 1;
texDesc.fConfig = kAlpha_8_GrPixelConfig;
static const GrCacheID::Domain gBlurProfileDomain = GrCacheID::GenerateDomain();
GrCacheID::Key key;
memset(&key, 0, sizeof(key));
@ -644,58 +644,58 @@ bool GrRectBlurEffect::CreateScanlineTextures(GrContext *context, float sigma,
key.fData32[1] = width;
key.fData32[2] = 1;
GrCacheID horizontalCacheID(gBlurProfileDomain, key);
uint8_t *profile = NULL;
SkAutoTDeleteArray<uint8_t> ada(NULL);
*horizontalScanline = context->findAndRefTexture(texDesc, horizontalCacheID, &params);
if (NULL == *horizontalScanline) {
SkBlurMask::ComputeBlurProfile(sigma, &profile);
ada.reset(profile);
SkAutoTMalloc<uint8_t> horizontalPixels(width);
SkBlurMask::ComputeBlurredScanline(horizontalPixels, profile, width, sigma);
*horizontalScanline = context->createTexture(&params, texDesc, horizontalCacheID,
*horizontalScanline = context->createTexture(&params, texDesc, horizontalCacheID,
horizontalPixels, 0);
if (NULL == *horizontalScanline) {
return false;
}
}
texDesc.fWidth = 1;
texDesc.fHeight = height;
key.fData32[1] = 1;
key.fData32[2] = height;
GrCacheID verticalCacheID(gBlurProfileDomain, key);
*verticalScanline = context->findAndRefTexture(texDesc, verticalCacheID, &params);
if (NULL == *verticalScanline) {
if (NULL == profile) {
SkBlurMask::ComputeBlurProfile(sigma, &profile);
ada.reset(profile);
}
SkAutoTMalloc<uint8_t> verticalPixels(height);
SkBlurMask::ComputeBlurredScanline(verticalPixels, profile, height, sigma);
*verticalScanline = context->createTexture(&params, texDesc, verticalCacheID,
*verticalScanline = context->createTexture(&params, texDesc, verticalCacheID,
verticalPixels, 0);
if (NULL == *verticalScanline) {
return false;
}
}
return true;
}
GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma,
GrTexture *horizontal_scanline, GrTexture *vertical_scanline)
: INHERITED(),
: INHERITED(),
fWidth(horizontal_scanline->width()),
fHeight(vertical_scanline->width()),
fSigma(sigma),
@ -704,8 +704,8 @@ GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma,
SkMatrix mat;
mat.setRectToRect(rect, SkRect::MakeWH(1,1), SkMatrix::kFill_ScaleToFit);
fTransform.reset(kLocal_GrCoordSet, mat);
this->addTextureAccess(&fHorizontalScanlineAccess);
this->addTextureAccess(&fVerticalScanlineAccess);
this->addTextureAccess(&fHorizontalScanlineAccess);
this->addTextureAccess(&fVerticalScanlineAccess);
this->addCoordTransform(&fTransform);
}
@ -749,20 +749,20 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context,
if (fBlurStyle != SkBlurMaskFilter::kNormal_BlurStyle) {
return false;
}
SkRect rect;
if (!path.isRect(&rect)) {
return false;
}
if (!strokeRec.isFillStyle()) {
return false;
}
SkMatrix ctm = context->getMatrix();
SkScalar xformedSigma = this->computeXformedSigma(ctm);
rect.outset(3*xformedSigma, 3*xformedSigma);
SkAutoTUnref<GrEffectRef> effect(GrRectBlurEffect::Create(
context, rect, xformedSigma));
if (!effect) {
@ -776,7 +776,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context,
grp->addCoverageEffect(effect);
context->drawRect(*grp, rect);
return true;
}

View File

@ -133,7 +133,7 @@ inline void GrBitmapTextContext::finish() {
GrTextContext::finish();
}
void GrBitmapTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint,
void GrBitmapTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint,
const char text[], size_t byteLength,
SkScalar x, SkScalar y) {
SkASSERT(byteLength == 0 || text != NULL);
@ -316,7 +316,7 @@ BitmapTextMapState::Proc BitmapTextMapState::pickProc(int scalarsPerPosition) {
///////////////////////////////////////////////////////////////////////////////
void GrBitmapTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint,
void GrBitmapTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint,
const char text[], size_t byteLength,
const SkScalar pos[], SkScalar constY,
int scalarsPerPosition) {

View File

@ -20,15 +20,15 @@ public:
GrBitmapTextContext(GrContext*, const SkDeviceProperties&);
virtual ~GrBitmapTextContext();
virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
SkScalar x, SkScalar y) SK_OVERRIDE;
virtual void drawPosText(const GrPaint&, const SkPaint&,
virtual void drawPosText(const GrPaint&, const SkPaint&,
const char text[], size_t byteLength,
const SkScalar pos[], SkScalar constY,
int scalarsPerPosition) SK_OVERRIDE;
virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
private:
GrTextStrike* fStrike;

View File

@ -294,7 +294,7 @@ inline void GrDistanceFieldTextContext::init(const GrPaint& paint, const SkPaint
fMaxVertices = 0;
fTextRatio = fSkPaint.getTextSize()/kBaseDFFontSize;
fSkPaint.setTextSize(SkIntToScalar(kBaseDFFontSize));
fSkPaint.setLCDRenderText(false);
fSkPaint.setAutohinted(false);

View File

@ -20,13 +20,13 @@ public:
GrDistanceFieldTextContext(GrContext*, const SkDeviceProperties&);
virtual ~GrDistanceFieldTextContext();
virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
SkScalar x, SkScalar y) SK_OVERRIDE;
virtual void drawPosText(const GrPaint&, const SkPaint&,
virtual void drawPosText(const GrPaint&, const SkPaint&,
const char text[], size_t byteLength,
const SkScalar pos[], SkScalar constY,
int scalarsPerPosition) SK_OVERRIDE;
virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
private:

View File

@ -25,7 +25,7 @@ class GrFontScaler;
class GrTextContext {
public:
virtual ~GrTextContext() {}
virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
virtual void drawText(const GrPaint&, const SkPaint&, const char text[], size_t byteLength,
SkScalar x, SkScalar y) = 0;
virtual void drawPosText(const GrPaint&, const SkPaint&,
const char text[], size_t byteLength,
@ -33,7 +33,7 @@ public:
int scalarsPerPosition) = 0;
virtual bool canDraw(const SkPaint& paint) = 0;
protected:
GrTextContext(GrContext*, const SkDeviceProperties&);

View File

@ -938,7 +938,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
// transform the path into device space
pathPtr->transform(fContext->getMatrix(), devPathPtr);
SkRect maskRect;
if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(),
draw.fClip->getBounds(),
@ -958,7 +958,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
// nothing to draw
return;
}
if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint,
SkStrokeRec(paint), *devPathPtr)) {
// the mask filter was able to draw itself directly, so there's nothing
@ -1821,17 +1821,17 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
SkDEBUGCODE(this->validate();)
fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
constY, scalarsPerPos);
} else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) {
GrPaint grPaint;
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
return;
}
SkDEBUGCODE(this->validate();)
fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
constY, scalarsPerPos);
} else {
draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY,

View File

@ -182,4 +182,3 @@ GrEffectRef* GrConvexPolyEffect::TestCreate(SkRandom* random,
return GrConvexPolyEffect::Create(edgeType, count, edges);
}

View File

@ -27,7 +27,7 @@ public:
enum EdgeType {
kFillNoAA_EdgeType,
kFillAA_EdgeType,
kLastEdgeType = kFillAA_EdgeType,
};

View File

@ -9,7 +9,7 @@
#include "SkOnce.h"
class SkDefaultEventTracer: public SkEventTracer {
virtual SkEventTracer::Handle
virtual SkEventTracer::Handle
addTraceEvent(char phase,
const uint8_t* categoryEnabledFlag,
const char* name,
@ -19,10 +19,10 @@ class SkDefaultEventTracer: public SkEventTracer {
const uint8_t* argTypes,
const uint64_t* argValues,
uint8_t flags) SK_OVERRIDE { return 0; }
virtual void
updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
const char* name,
virtual void
updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
const char* name,
SkEventTracer::Handle) SK_OVERRIDE {};
virtual const uint8_t* getCategoryGroupEnabled(const char* name) SK_OVERRIDE {