| 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 #include "gm.h" | 7 #include "gm.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 #include "SkUnitMappers.h" | 10 #include "SkUnitMappers.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 SkScalar columnH = 0; | 148 SkScalar columnH = 0; |
| 149 for (int m = 0; m < matrices.count(); ++m) { | 149 for (int m = 0; m < matrices.count(); ++m) { |
| 150 columnH = 0; | 150 columnH = 0; |
| 151 canvas->save(); | 151 canvas->save(); |
| 152 canvas->drawText(matrices[m].fLabel, strlen(matrices[m].fLabel), | 152 canvas->drawText(matrices[m].fLabel, strlen(matrices[m].fLabel), |
| 153 0, labelPaint.getTextSize() - 1, labelPaint); | 153 0, labelPaint.getTextSize() - 1, labelPaint); |
| 154 canvas->translate(0, kPadY / 2 + kPointSize); | 154 canvas->translate(0, kPadY / 2 + kPointSize); |
| 155 columnH += kPadY / 2 + kPointSize; | 155 columnH += kPadY / 2 + kPointSize; |
| 156 for (int lm = 0; lm < localMatrices.count(); ++lm) { | 156 for (int lm = 0; lm < localMatrices.count(); ++lm) { |
| 157 paint.setShader(SkShader::CreateBitmapShader(bmp, | 157 paint.setShader( |
| 158 SkShader::kMirr
or_TileMode, | 158 SkShader::CreateBitmapShader(bmp, |
| 159 SkShader::kRepe
at_TileMode, | 159 SkShader::kMirror_TileM
ode, |
| 160 &localMatrices[
lm].fMatrix)); | 160 SkShader::kRepeat_TileM
ode, |
| 161 &localMatrices[lm].fMat
rix))->unref(); |
| 161 | 162 |
| 162 canvas->save(); | 163 canvas->save(); |
| 163 canvas->concat(matrices[m].fMatrix); | 164 canvas->concat(matrices[m].fMatrix); |
| 164 canvas->drawText(kText, kTextLen, 0, 0, paint); | 165 canvas->drawText(kText, kTextLen, 0, 0, paint); |
| 165 canvas->drawText(kText, kTextLen, 0, 0, outlinePaint); | 166 canvas->drawText(kText, kTextLen, 0, 0, outlinePaint); |
| 166 canvas->restore(); | 167 canvas->restore(); |
| 167 | 168 |
| 168 SkPath path; | 169 SkPath path; |
| 169 path.arcTo(SkRect::MakeXYWH(-0.1f * w, 0.f, | 170 path.arcTo(SkRect::MakeXYWH(-0.1f * w, 0.f, |
| 170 1.2f * w, 2.f * kPointSize), | 171 1.2f * w, 2.f * kPointSize), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 210 |
| 210 private: | 211 private: |
| 211 typedef GM INHERITED; | 212 typedef GM INHERITED; |
| 212 }; | 213 }; |
| 213 | 214 |
| 214 /////////////////////////////////////////////////////////////////////////////// | 215 /////////////////////////////////////////////////////////////////////////////// |
| 215 | 216 |
| 216 static GM* MyFactory(void*) { return new ShaderText2GM; } | 217 static GM* MyFactory(void*) { return new ShaderText2GM; } |
| 217 static GMRegistry reg(MyFactory); | 218 static GMRegistry reg(MyFactory); |
| 218 } | 219 } |
| OLD | NEW |