| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // A8 | 42 // A8 |
| 43 paint.setTextSize(28); | 43 paint.setTextSize(28); |
| 44 text = "The quick brown fox jumps over the lazy dog."; | 44 text = "The quick brown fox jumps over the lazy dog."; |
| 45 paint.setSubpixelText(false); | 45 paint.setSubpixelText(false); |
| 46 paint.setLCDRenderText(false); | 46 paint.setLCDRenderText(false); |
| 47 paint.measureText(text, strlen(text), &bounds); | 47 paint.measureText(text, strlen(text), &bounds); |
| 48 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset - 8); | 48 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset - 8); |
| 49 | 49 |
| 50 // build | 50 // build |
| 51 fBlob.reset(builder.build()); | 51 fBlob = builder.make(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 SkString onShortName() override { | 54 SkString onShortName() override { |
| 55 return SkString("textblobcolortrans"); | 55 return SkString("textblobcolortrans"); |
| 56 } | 56 } |
| 57 | 57 |
| 58 SkISize onISize() override { | 58 SkISize onISize() override { |
| 59 return SkISize::Make(kWidth, kHeight); | 59 return SkISize::Make(kWidth, kHeight); |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 80 y += SkScalarFloorToInt(bounds.height())) { | 80 y += SkScalarFloorToInt(bounds.height())) { |
| 81 paint.setColor(colors[colorIndex++ % count]); | 81 paint.setColor(colors[colorIndex++ % count]); |
| 82 canvas->save(); | 82 canvas->save(); |
| 83 canvas->translate(0, SkIntToScalar(y)); | 83 canvas->translate(0, SkIntToScalar(y)); |
| 84 canvas->drawTextBlob(fBlob, 0, 0, paint); | 84 canvas->drawTextBlob(fBlob, 0, 0, paint); |
| 85 canvas->restore(); | 85 canvas->restore(); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 SkAutoTUnref<const SkTextBlob> fBlob; | 90 sk_sp<SkTextBlob> fBlob; |
| 91 | 91 |
| 92 static constexpr int kWidth = 675; | 92 static constexpr int kWidth = 675; |
| 93 static constexpr int kHeight = 1600; | 93 static constexpr int kHeight = 1600; |
| 94 | 94 |
| 95 typedef GM INHERITED; | 95 typedef GM INHERITED; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 ////////////////////////////////////////////////////////////////////////////// | 98 ////////////////////////////////////////////////////////////////////////////// |
| 99 | 99 |
| 100 DEF_GM(return new TextBlobColorTrans;) | 100 DEF_GM(return new TextBlobColorTrans;) |
| 101 } | 101 } |
| OLD | NEW |