aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/texteffects.cpp
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:19:56 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:19:56 +0000
commitae933ce0ea5fd9d21cb6ef2cee7e729d32690aac (patch)
tree62d80e33b16679d01454cf814977a7030d3a5462 /gm/texteffects.cpp
parentd6176b0dcacb124539e0cfd051e6d93a9782f020 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6475053 git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/texteffects.cpp')
-rw-r--r--gm/texteffects.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp
index fddfadf4f4..18cae70155 100644
--- a/gm/texteffects.cpp
+++ b/gm/texteffects.cpp
@@ -14,12 +14,12 @@ static void r0(SkLayerRasterizer* rast, SkPaint& p) {
p.setMaskFilter(SkBlurMaskFilter::Create(SkIntToScalar(3),
SkBlurMaskFilter::kNormal_BlurStyle))->unref();
rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
-
+
p.setMaskFilter(NULL);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1);
rast->addLayer(p);
-
+
p.setAlpha(0x11);
p.setStyle(SkPaint::kFill_Style);
p.setXfermodeMode(SkXfermode::kSrc_Mode);
@@ -28,7 +28,7 @@ static void r0(SkLayerRasterizer* rast, SkPaint& p) {
static void r1(SkLayerRasterizer* rast, SkPaint& p) {
rast->addLayer(p);
-
+
p.setAlpha(0x40);
p.setXfermodeMode(SkXfermode::kSrc_Mode);
p.setStyle(SkPaint::kStroke_Style);
@@ -40,7 +40,7 @@ static void r2(SkLayerRasterizer* rast, SkPaint& p) {
p.setStyle(SkPaint::kStrokeAndFill_Style);
p.setStrokeWidth(SK_Scalar1*4);
rast->addLayer(p);
-
+
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1*3/2);
p.setXfermodeMode(SkXfermode::kClear_Mode);
@@ -51,7 +51,7 @@ static void r3(SkLayerRasterizer* rast, SkPaint& p) {
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(SK_Scalar1*3);
rast->addLayer(p);
-
+
p.setAlpha(0x20);
p.setStyle(SkPaint::kFill_Style);
p.setXfermodeMode(SkXfermode::kSrc_Mode);
@@ -61,11 +61,11 @@ static void r3(SkLayerRasterizer* rast, SkPaint& p) {
static void r4(SkLayerRasterizer* rast, SkPaint& p) {
p.setAlpha(0x60);
rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
-
+
p.setAlpha(0xFF);
p.setXfermodeMode(SkXfermode::kClear_Mode);
rast->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2);
-
+
p.setXfermode(NULL);
rast->addLayer(p);
}
@@ -74,7 +74,7 @@ static void r4(SkLayerRasterizer* rast, SkPaint& p) {
static void r5(SkLayerRasterizer* rast, SkPaint& p) {
rast->addLayer(p);
-
+
p.setPathEffect(new SkDiscretePathEffect(SK_Scalar1*4, SK_Scalar1*3))->unref();
p.setXfermodeMode(SkXfermode::kSrcOut_Mode);
rast->addLayer(p);
@@ -82,7 +82,7 @@ static void r5(SkLayerRasterizer* rast, SkPaint& p) {
static void r6(SkLayerRasterizer* rast, SkPaint& p) {
rast->addLayer(p);
-
+
p.setAntiAlias(false);
SkLayerRasterizer* rast2 = new SkLayerRasterizer;
r5(rast2, p);
@@ -109,14 +109,14 @@ static void r7(SkLayerRasterizer* rast, SkPaint& p) {
static void r8(SkLayerRasterizer* rast, SkPaint& p) {
rast->addLayer(p);
-
+
SkMatrix lattice;
lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0);
lattice.postSkew(SK_Scalar1/3, 0, 0, 0);
p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice))->unref();
p.setXfermodeMode(SkXfermode::kClear_Mode);
rast->addLayer(p);
-
+
p.setPathEffect(NULL);
p.setXfermode(NULL);
p.setStyle(SkPaint::kStroke_Style);
@@ -128,33 +128,33 @@ class Line2DPathEffect : public Sk2DPathEffect {
public:
Line2DPathEffect(SkScalar width, const SkMatrix& matrix)
: Sk2DPathEffect(matrix), fWidth(width) {}
-
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec) SK_OVERRIDE {
+
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec) SK_OVERRIDE {
if (this->INHERITED::filterPath(dst, src, rec)) {
rec->setStrokeStyle(fWidth);
return true;
}
return false;
}
-
+
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Line2DPathEffect)
-
+
protected:
- virtual void nextSpan(int u, int v, int ucount, SkPath* dst) {
+ virtual void nextSpan(int u, int v, int ucount, SkPath* dst) {
if (ucount > 1) {
- SkPoint src[2], dstP[2];
-
+ SkPoint src[2], dstP[2];
+
src[0].set(SkIntToScalar(u) + SK_ScalarHalf,
SkIntToScalar(v) + SK_ScalarHalf);
src[1].set(SkIntToScalar(u+ucount) + SK_ScalarHalf,
SkIntToScalar(v) + SK_ScalarHalf);
this->getMatrix().mapPoints(dstP, src, 2);
-
+
dst->moveTo(dstP[0]);
dst->lineTo(dstP[1]);
}
}
-
+
Line2DPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
fWidth = buffer.readScalar();
}
@@ -162,23 +162,23 @@ protected:
this->INHERITED::flatten(buffer);
buffer.writeScalar(fWidth);
}
-
+
private:
SkScalar fWidth;
-
+
typedef Sk2DPathEffect INHERITED;
};
static void r9(SkLayerRasterizer* rast, SkPaint& p) {
rast->addLayer(p);
-
+
SkMatrix lattice;
lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0);
lattice.postRotate(SkIntToScalar(30), 0, 0);
p.setPathEffect(new Line2DPathEffect(SK_Scalar1*2, lattice))->unref();
p.setXfermodeMode(SkXfermode::kClear_Mode);
rast->addLayer(p);
-
+
p.setPathEffect(NULL);
p.setXfermode(NULL);
p.setStyle(SkPaint::kStroke_Style);
@@ -210,12 +210,12 @@ static void apply_shader(SkPaint* paint, int index) {
{
SkPaint p;
SkLayerRasterizer* rast = new SkLayerRasterizer;
-
+
p.setAntiAlias(true);
proc(rast, p);
paint->setRasterizer(rast)->unref();
}
-
+
#if 0
SkScalar dir[] = { SK_Scalar1, SK_Scalar1, SK_Scalar1 };
paint->setMaskFilter(SkBlurMaskFilter::CreateEmboss(dir, SK_Scalar1/4, SkIntToScalar(4), SkIntToScalar(3)))->unref();
@@ -225,40 +225,40 @@ static void apply_shader(SkPaint* paint, int index) {
class TextEffectsGM : public skiagm::GM {
public:
- TextEffectsGM() {}
-
+ TextEffectsGM() {}
+
protected:
virtual SkString onShortName() SK_OVERRIDE {
return SkString("texteffects");
}
-
+
virtual SkISize onISize() SK_OVERRIDE {
return SkISize::Make(460, 680);
}
-
+
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
canvas->save();
-
+
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(56));
-
+
SkScalar x = SkIntToScalar(20);
SkScalar y = paint.getTextSize();
-
+
SkString str("Hamburgefons");
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
apply_shader(&paint, i);
-
+
// paint.setMaskFilter(NULL);
// paint.setColor(SK_ColorBLACK);
-
+
canvas->drawText(str.c_str(), str.size(), x, y, paint);
-
+
y += paint.getFontSpacing();
}
-
+
canvas->restore();
}
@@ -270,9 +270,9 @@ protected:
private:
typedef skiagm::GM INHERITED;
};
-
+
//////////////////////////////////////////////////////////////////////////////
static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; }
static skiagm::GMRegistry reg(MyFactory);
-
+