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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 maxLabelW = SkMaxScalar(maxLabelW, labelW); | 142 maxLabelW = SkMaxScalar(maxLabelW, labelW); |
143 canvas->translate(0.f, 2 * kPointSize + 2.5f * kPadY); | 143 canvas->translate(0.f, 2 * kPointSize + 2.5f * kPadY); |
144 } | 144 } |
145 canvas->restore(); | 145 canvas->restore(); |
146 | 146 |
147 canvas->translate(maxLabelW + kPadX / 2.f, 0.f); | 147 canvas->translate(maxLabelW + kPadX / 2.f, 0.f); |
148 | 148 |
149 for (int s = 0; s < 2; ++s) { | 149 for (int s = 0; s < 2; ++s) { |
150 SkPaint& paint = s ? strokePaint : fillPaint; | 150 SkPaint& paint = s ? strokePaint : fillPaint; |
151 | 151 |
152 SkScalar columnH; | 152 SkScalar columnH = 0; |
153 for (int m = 0; m < matrices.count(); ++m) { | 153 for (int m = 0; m < matrices.count(); ++m) { |
154 columnH = 0; | 154 columnH = 0; |
155 canvas->save(); | 155 canvas->save(); |
156 canvas->drawText(matrices[m].fLabel, strlen(matrices[m].fLabel), | 156 canvas->drawText(matrices[m].fLabel, strlen(matrices[m].fLabel), |
157 0, labelPaint.getTextSize() - 1, labelPaint); | 157 0, labelPaint.getTextSize() - 1, labelPaint); |
158 canvas->translate(0, kPadY / 2 + kPointSize); | 158 canvas->translate(0, kPadY / 2 + kPointSize); |
159 columnH += kPadY / 2 + kPointSize; | 159 columnH += kPadY / 2 + kPointSize; |
160 for (int lm = 0; lm < localMatrices.count(); ++lm) { | 160 for (int lm = 0; lm < localMatrices.count(); ++lm) { |
161 shader->setLocalMatrix(localMatrices[lm].fMatrix); | 161 shader->setLocalMatrix(localMatrices[lm].fMatrix); |
162 | 162 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 typedef GM INHERITED; | 212 typedef GM INHERITED; |
213 }; | 213 }; |
214 | 214 |
215 /////////////////////////////////////////////////////////////////////////////// | 215 /////////////////////////////////////////////////////////////////////////////// |
216 | 216 |
217 #ifndef SK_BUILD_FOR_ANDROID | 217 #ifndef SK_BUILD_FOR_ANDROID |
218 static GM* MyFactory(void*) { return new ShaderText2GM; } | 218 static GM* MyFactory(void*) { return new ShaderText2GM; } |
219 static GMRegistry reg(MyFactory); | 219 static GMRegistry reg(MyFactory); |
220 #endif | 220 #endif |
221 } | 221 } |
OLD | NEW |