| 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 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 | 50 |
| 51 SkString onShortName() SK_OVERRIDE { | 51 SkString onShortName() SK_OVERRIDE { |
| 52 return SkString("shadertext2"); | 52 return SkString("shadertext2"); |
| 53 } | 53 } |
| 54 | 54 |
| 55 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1800, 900); } | 55 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1800, 900); } |
| 56 | 56 |
| 57 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 57 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 58 static const char kText[] = "SKIA"; | 58 static const char kText[] = "SKIA"; |
| 59 static const int kTextLen = SK_ARRAY_COUNT(kText) - 1; | 59 static const int kTextLen = SK_ARRAY_COUNT(kText) - 1; |
| 60 static const int kPointSize = 55; | 60 static const int kPointSize = 55; |
| 61 | 61 |
| 62 SkTDArray<LabeledMatrix> matrices; | 62 SkTDArray<LabeledMatrix> matrices; |
| 63 matrices.append()->fMatrix.reset(); | 63 matrices.append()->fMatrix.reset(); |
| 64 matrices.top().fLabel = "Identity"; | 64 matrices.top().fLabel = "Identity"; |
| 65 matrices.append()->fMatrix.setScale(1.2f, 0.8f); | 65 matrices.append()->fMatrix.setScale(1.2f, 0.8f); |
| 66 matrices.top().fLabel = "Scale"; | 66 matrices.top().fLabel = "Scale"; |
| 67 matrices.append()->fMatrix.setRotate(10.f); | 67 matrices.append()->fMatrix.setRotate(10.f); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 static const char kStrokeLabel[] = "Stroked"; | 192 static const char kStrokeLabel[] = "Stroked"; |
| 193 SkScalar y = columnH + kPadY / 2; | 193 SkScalar y = columnH + kPadY / 2; |
| 194 SkScalar fillX = -outlinePaint.measureText(kFillLabel, strlen(kF
illLabel)) - kPadX; | 194 SkScalar fillX = -outlinePaint.measureText(kFillLabel, strlen(kF
illLabel)) - kPadX; |
| 195 SkScalar strokeX = kPadX; | 195 SkScalar strokeX = kPadX; |
| 196 canvas->drawText(kFillLabel, strlen(kFillLabel), fillX, y, label
Paint); | 196 canvas->drawText(kFillLabel, strlen(kFillLabel), fillX, y, label
Paint); |
| 197 canvas->drawText(kStrokeLabel, strlen(kStrokeLabel), strokeX, y,
labelPaint); | 197 canvas->drawText(kStrokeLabel, strlen(kStrokeLabel), strokeX, y,
labelPaint); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 202 uint32_t onGetFlags() const SK_OVERRIDE { |
| 203 // disable 565 for now, til mike fixes the debug assert | 203 // disable 565 for now, til mike fixes the debug assert |
| 204 return kSkip565_Flag | kSkipTiled_Flag; | 204 return kSkip565_Flag | kSkipTiled_Flag; |
| 205 } | 205 } |
| 206 | 206 |
| 207 private: | 207 private: |
| 208 typedef GM INHERITED; | 208 typedef GM INHERITED; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 /////////////////////////////////////////////////////////////////////////////// | 211 /////////////////////////////////////////////////////////////////////////////// |
| 212 | 212 |
| 213 static GM* MyFactory(void*) { return new ShaderText2GM; } | 213 static GM* MyFactory(void*) { return new ShaderText2GM; } |
| 214 static GMRegistry reg(MyFactory); | 214 static GMRegistry reg(MyFactory); |
| 215 } | 215 } |
| OLD | NEW |