| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 p.setXfermode(NULL); | 71 p.setXfermode(NULL); |
| 72 rast->addLayer(p); | 72 rast->addLayer(p); |
| 73 } | 73 } |
| 74 | 74 |
| 75 #include "SkDiscretePathEffect.h" | 75 #include "SkDiscretePathEffect.h" |
| 76 | 76 |
| 77 static void r5(SkLayerRasterizer* rast, SkPaint& p) { | 77 static void r5(SkLayerRasterizer* rast, SkPaint& p) { |
| 78 rast->addLayer(p); | 78 rast->addLayer(p); |
| 79 | 79 |
| 80 p.setPathEffect(new SkDiscretePathEffect(SK_Scalar1*4, SK_Scalar1*3))->unref
(); | 80 p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->u
nref(); |
| 81 p.setXfermodeMode(SkXfermode::kSrcOut_Mode); | 81 p.setXfermodeMode(SkXfermode::kSrcOut_Mode); |
| 82 rast->addLayer(p); | 82 rast->addLayer(p); |
| 83 } | 83 } |
| 84 | 84 |
| 85 static void r6(SkLayerRasterizer* rast, SkPaint& p) { | 85 static void r6(SkLayerRasterizer* rast, SkPaint& p) { |
| 86 rast->addLayer(p); | 86 rast->addLayer(p); |
| 87 | 87 |
| 88 p.setAntiAlias(false); | 88 p.setAntiAlias(false); |
| 89 SkLayerRasterizer* rast2 = new SkLayerRasterizer; | 89 SkLayerRasterizer* rast2 = new SkLayerRasterizer; |
| 90 r5(rast2, p); | 90 r5(rast2, p); |
| 91 p.setRasterizer(rast2)->unref(); | 91 p.setRasterizer(rast2)->unref(); |
| 92 p.setXfermodeMode(SkXfermode::kClear_Mode); | 92 p.setXfermodeMode(SkXfermode::kClear_Mode); |
| 93 rast->addLayer(p); | 93 rast->addLayer(p); |
| 94 } | 94 } |
| 95 | 95 |
| 96 #include "Sk2DPathEffect.h" | 96 #include "Sk2DPathEffect.h" |
| 97 | 97 |
| 98 static SkPathEffect* MakeDotEffect(SkScalar radius, const SkMatrix& matrix) { | 98 static SkPathEffect* MakeDotEffect(SkScalar radius, const SkMatrix& matrix) { |
| 99 SkPath path; | 99 SkPath path; |
| 100 path.addCircle(0, 0, radius); | 100 path.addCircle(0, 0, radius); |
| 101 return new SkPath2DPathEffect(matrix, path); | 101 return SkPath2DPathEffect::Create(matrix, path); |
| 102 } | 102 } |
| 103 | 103 |
| 104 static void r7(SkLayerRasterizer* rast, SkPaint& p) { | 104 static void r7(SkLayerRasterizer* rast, SkPaint& p) { |
| 105 SkMatrix lattice; | 105 SkMatrix lattice; |
| 106 lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); | 106 lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); |
| 107 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); | 107 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
| 108 p.setPathEffect(MakeDotEffect(SK_Scalar1*4, lattice))->unref(); | 108 p.setPathEffect(MakeDotEffect(SK_Scalar1*4, lattice))->unref(); |
| 109 rast->addLayer(p); | 109 rast->addLayer(p); |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 125 p.setStrokeWidth(SK_Scalar1); | 125 p.setStrokeWidth(SK_Scalar1); |
| 126 rast->addLayer(p); | 126 rast->addLayer(p); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static void r9(SkLayerRasterizer* rast, SkPaint& p) { | 129 static void r9(SkLayerRasterizer* rast, SkPaint& p) { |
| 130 rast->addLayer(p); | 130 rast->addLayer(p); |
| 131 | 131 |
| 132 SkMatrix lattice; | 132 SkMatrix lattice; |
| 133 lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); | 133 lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); |
| 134 lattice.postRotate(SkIntToScalar(30), 0, 0); | 134 lattice.postRotate(SkIntToScalar(30), 0, 0); |
| 135 p.setPathEffect(new SkLine2DPathEffect(SK_Scalar1*2, lattice))->unref(); | 135 p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref(); |
| 136 p.setXfermodeMode(SkXfermode::kClear_Mode); | 136 p.setXfermodeMode(SkXfermode::kClear_Mode); |
| 137 rast->addLayer(p); | 137 rast->addLayer(p); |
| 138 | 138 |
| 139 p.setPathEffect(NULL); | 139 p.setPathEffect(NULL); |
| 140 p.setXfermode(NULL); | 140 p.setXfermode(NULL); |
| 141 p.setStyle(SkPaint::kStroke_Style); | 141 p.setStyle(SkPaint::kStroke_Style); |
| 142 p.setStrokeWidth(SK_Scalar1); | 142 p.setStrokeWidth(SK_Scalar1); |
| 143 rast->addLayer(p); | 143 rast->addLayer(p); |
| 144 } | 144 } |
| 145 | 145 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 private: | 212 private: |
| 213 typedef skiagm::GM INHERITED; | 213 typedef skiagm::GM INHERITED; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 ////////////////////////////////////////////////////////////////////////////// | 216 ////////////////////////////////////////////////////////////////////////////// |
| 217 | 217 |
| 218 static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } | 218 static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } |
| 219 static skiagm::GMRegistry reg(MyFactory); | 219 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |