Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkStream.h" | 10 #include "SkStream.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 virtual SkISize onISize() { | 43 virtual SkISize onISize() { |
| 44 return make_isize(640, 480); | 44 return make_isize(640, 480); |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual void onDraw(SkCanvas* canvas) { | 47 virtual void onDraw(SkCanvas* canvas) { |
| 48 | 48 |
| 49 canvas->drawColor(SK_ColorGRAY); | 49 canvas->drawColor(SK_ColorGRAY); |
| 50 | 50 |
| 51 SkPaint paint; | 51 SkPaint paint; |
| 52 paint.setTypeface(fTypeface); | 52 paint.setTypeface(fTypeface); |
| 53 paint.setEmbeddedBitmapText(true); | |
|
bungeman-skia
2013/12/09 22:13:34
The 'embedded bitmap' flag was intended to be used
| |
| 54 | 53 |
| 55 const char* text = "hamburgerfons"; | 54 const char* text = "hamburgerfons"; |
| 56 | 55 |
| 57 // draw text at different point sizes | 56 // draw text at different point sizes |
| 58 const int textSize[] = { 10, 30, 50 }; | 57 const int textSize[] = { 10, 30, 50 }; |
| 59 const int textYOffset[] = { 10, 40, 100}; | 58 const int textYOffset[] = { 10, 40, 100}; |
| 60 SkASSERT(sizeof(textSize) == sizeof(textYOffset)); | 59 SkASSERT(sizeof(textSize) == sizeof(textYOffset)); |
| 61 for (size_t y = 0; y < sizeof(textSize) / sizeof(int); ++y) { | 60 for (size_t y = 0; y < sizeof(textSize) / sizeof(int); ++y) { |
| 62 paint.setTextSize(SkIntToScalar(textSize[y])); | 61 paint.setTextSize(SkIntToScalar(textSize[y])); |
| 63 canvas->drawText(text, strlen(text), 10, SkIntToScalar(textYOffset[y ]), paint); | 62 canvas->drawText(text, strlen(text), 10, SkIntToScalar(textYOffset[y ]), paint); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 109 |
| 111 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
| 112 | 111 |
| 113 #if !defined(SK_BUILD_FOR_ANDROID) | 112 #if !defined(SK_BUILD_FOR_ANDROID) |
| 114 // fail for now until the appropriate freetype changes are submitted | 113 // fail for now until the appropriate freetype changes are submitted |
| 115 static GM* MyFactory(void*) { return new ColorEmojiGM; } | 114 static GM* MyFactory(void*) { return new ColorEmojiGM; } |
| 116 static GMRegistry reg(MyFactory); | 115 static GMRegistry reg(MyFactory); |
| 117 #endif | 116 #endif |
| 118 | 117 |
| 119 } | 118 } |
| OLD | NEW |