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

View File

@ -10,7 +10,7 @@
// The class in this header defines the interface between Skia's internal // 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. // 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. // that event to SkEventTracer::SetInstance.
// If you're looking for the tracing macros to instrument Skia itself, those // If you're looking for the tracing macros to instrument Skia itself, those
@ -26,10 +26,10 @@ class SK_API SkEventTracer {
public: public:
typedef uint32_t Handle; typedef uint32_t Handle;
static SkEventTracer* GetInstance(); static SkEventTracer* GetInstance();
static void SetInstance(SkEventTracer* tracer) { static void SetInstance(SkEventTracer* tracer) {
SkDELETE(SkEventTracer::gInstance); SkDELETE(SkEventTracer::gInstance);
SkEventTracer::gInstance = tracer; SkEventTracer::gInstance = tracer;
} }
@ -52,8 +52,8 @@ public:
virtual const unsigned char* getCategoryGroupEnabled(const char* name) = 0; virtual const unsigned char* getCategoryGroupEnabled(const char* name) = 0;
virtual const char* getCategoryGroupName( virtual const char* getCategoryGroupName(
const uint8_t* category_group_enabled) = 0; const uint8_t* category_group_enabled) = 0;
virtual SkEventTracer::Handle virtual SkEventTracer::Handle
addTraceEvent(char phase, addTraceEvent(char phase,
const uint8_t* categoryEnabledFlag, const uint8_t* categoryEnabledFlag,
const char* name, const char* name,
@ -63,10 +63,10 @@ public:
const uint8_t* argTypes, const uint8_t* argTypes,
const uint64_t* argValues, const uint64_t* argValues,
uint8_t flags) = 0; uint8_t flags) = 0;
virtual void virtual void
updateTraceEventDuration(const uint8_t* categoryEnabledFlag, updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
const char* name, const char* name,
SkEventTracer::Handle) = 0; SkEventTracer::Handle) = 0;
private: private:
static SkEventTracer *gInstance; 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]; 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 width, SkScalar sigma) {
unsigned int profile_size = SkScalarCeilToInt(6*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); float giX = 1.5f - (x+.5f)/(2*sigma);
pixels[x] = (uint8_t) (255 * (gaussianIntegral(giX) - gaussianIntegral(giX + span))); pixels[x] = (uint8_t) (255 * (gaussianIntegral(giX) - gaussianIntegral(giX + span)));
} }
} }
} }
bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, 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> horizontalScanline(dstWidth);
SkAutoTMalloc<uint8_t> verticalScanline(dstHeight); SkAutoTMalloc<uint8_t> verticalScanline(dstHeight);
ComputeBlurredScanline(horizontalScanline, profile, dstWidth, sigma); ComputeBlurredScanline(horizontalScanline, profile, dstWidth, sigma);
ComputeBlurredScanline(verticalScanline, profile, dstHeight, sigma); ComputeBlurredScanline(verticalScanline, profile, dstHeight, sigma);

View File

@ -62,27 +62,27 @@ public:
SkIPoint* margin = NULL); SkIPoint* margin = NULL);
static SkScalar ConvertRadiusToSigma(SkScalar radius); static SkScalar ConvertRadiusToSigma(SkScalar radius);
/* Helper functions for analytic rectangle blurs */ /* Helper functions for analytic rectangle blurs */
/** Look up the intensity of the (one dimnensional) blurred half-plane. /** Look up the intensity of the (one dimnensional) blurred half-plane.
@param profile The precomputed 1D blur profile; memory allocated by and managed by @param profile The precomputed 1D blur profile; memory allocated by and managed by
ComputeBlurProfile below. 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 meaningful data are available between 0 and blurred_width
@param blurred_width The width of the final, blurred rectangle @param blurred_width The width of the final, blurred rectangle
@param sharp_width The width of the original, unblurred 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); 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 /** 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. 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 sigma The standard deviation of the gaussian blur kernel
@param profile_out The location to store the allocated profile curve @param profile_out The location to store the allocated profile curve
*/ */
static void ComputeBlurProfile(SkScalar sigma, uint8_t** profile_out); static void ComputeBlurProfile(SkScalar sigma, uint8_t** profile_out);
/** Compute an entire scanline of a blurred step function. This is a 1D helper that /** 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. 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 @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; @param sigma Standard deviation of the gaussian blur kernel used to compute the profile;
this implicitly gives the size of the pixels array. this implicitly gives the size of the pixels array.
*/ */
static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile,
unsigned int width, SkScalar sigma); unsigned int width, SkScalar sigma);
}; };
#endif #endif

View File

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

View File

@ -133,7 +133,7 @@ inline void GrBitmapTextContext::finish() {
GrTextContext::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, const char text[], size_t byteLength,
SkScalar x, SkScalar y) { SkScalar x, SkScalar y) {
SkASSERT(byteLength == 0 || text != NULL); 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 char text[], size_t byteLength,
const SkScalar pos[], SkScalar constY, const SkScalar pos[], SkScalar constY,
int scalarsPerPosition) { int scalarsPerPosition) {

View File

@ -20,15 +20,15 @@ public:
GrBitmapTextContext(GrContext*, const SkDeviceProperties&); GrBitmapTextContext(GrContext*, const SkDeviceProperties&);
virtual ~GrBitmapTextContext(); 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; 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 char text[], size_t byteLength,
const SkScalar pos[], SkScalar constY, const SkScalar pos[], SkScalar constY,
int scalarsPerPosition) SK_OVERRIDE; int scalarsPerPosition) SK_OVERRIDE;
virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
private: private:
GrTextStrike* fStrike; GrTextStrike* fStrike;

View File

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

View File

@ -20,13 +20,13 @@ public:
GrDistanceFieldTextContext(GrContext*, const SkDeviceProperties&); GrDistanceFieldTextContext(GrContext*, const SkDeviceProperties&);
virtual ~GrDistanceFieldTextContext(); 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; 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 char text[], size_t byteLength,
const SkScalar pos[], SkScalar constY, const SkScalar pos[], SkScalar constY,
int scalarsPerPosition) SK_OVERRIDE; int scalarsPerPosition) SK_OVERRIDE;
virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
private: private:

View File

@ -25,7 +25,7 @@ class GrFontScaler;
class GrTextContext { class GrTextContext {
public: public:
virtual ~GrTextContext() {} 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; SkScalar x, SkScalar y) = 0;
virtual void drawPosText(const GrPaint&, const SkPaint&, virtual void drawPosText(const GrPaint&, const SkPaint&,
const char text[], size_t byteLength, const char text[], size_t byteLength,
@ -33,7 +33,7 @@ public:
int scalarsPerPosition) = 0; int scalarsPerPosition) = 0;
virtual bool canDraw(const SkPaint& paint) = 0; virtual bool canDraw(const SkPaint& paint) = 0;
protected: protected:
GrTextContext(GrContext*, const SkDeviceProperties&); 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 // transform the path into device space
pathPtr->transform(fContext->getMatrix(), devPathPtr); pathPtr->transform(fContext->getMatrix(), devPathPtr);
SkRect maskRect; SkRect maskRect;
if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(),
draw.fClip->getBounds(), draw.fClip->getBounds(),
@ -958,7 +958,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
// nothing to draw // nothing to draw
return; return;
} }
if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint, if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint,
SkStrokeRec(paint), *devPathPtr)) { SkStrokeRec(paint), *devPathPtr)) {
// the mask filter was able to draw itself directly, so there's nothing // 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();) SkDEBUGCODE(this->validate();)
fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos, fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
constY, scalarsPerPos); constY, scalarsPerPos);
} else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) {
GrPaint grPaint; GrPaint grPaint;
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
return; return;
} }
SkDEBUGCODE(this->validate();) SkDEBUGCODE(this->validate();)
fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos, fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
constY, scalarsPerPos); constY, scalarsPerPos);
} else { } else {
draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY, 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); return GrConvexPolyEffect::Create(edgeType, count, edges);
} }

View File

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

View File

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