| OLD | NEW | 
|    1  |    1  | 
|    2 /* |    2 /* | 
|    3  * Copyright 2014 Google Inc. |    3  * Copyright 2014 Google Inc. | 
|    4  * |    4  * | 
|    5  * Use of this source code is governed by a BSD-style license that can be |    5  * Use of this source code is governed by a BSD-style license that can be | 
|    6  * found in the LICENSE file. |    6  * found in the LICENSE file. | 
|    7  */ |    7  */ | 
|    8  |    8  | 
|    9 #include "gm.h" |    9 #include "gm.h" | 
|   10 #if SK_SUPPORT_GPU |   10 #if SK_SUPPORT_GPU | 
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  212             virtual void setFont(SkPaint* paint) { |  212             virtual void setFont(SkPaint* paint) { | 
|  213                 sk_tool_utils::set_portable_typeface(paint); |  213                 sk_tool_utils::set_portable_typeface(paint); | 
|  214             } |  214             } | 
|  215  |  215  | 
|  216             virtual const char* text() const { return "Hello, Skia!"; } |  216             virtual const char* text() const { return "Hello, Skia!"; } | 
|  217         }; |  217         }; | 
|  218  |  218  | 
|  219         struct BmpText : public Text { |  219         struct BmpText : public Text { | 
|  220            void setFont(SkPaint* paint) override { |  220            void setFont(SkPaint* paint) override { | 
|  221                if (!fTypeface) { |  221                if (!fTypeface) { | 
|  222                     SkString filename = GetResourcePath("/Funkster.ttf"); |  222                     fTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf")
     ); | 
|  223                     SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename
     .c_str())); |  | 
|  224                     if (!stream->isValid()) { |  | 
|  225                         SkDebugf("Could not find Funkster.ttf, please set --reso
     urcePath " |  | 
|  226                                  "correctly.\n"); |  | 
|  227                         return; |  | 
|  228                     } |  | 
|  229                     fTypeface.reset(SkTypeface::CreateFromStream(stream.detach()
     )); |  | 
|  230                } |  223                } | 
|  231                paint->setTypeface(fTypeface); |  224                paint->setTypeface(fTypeface); | 
|  232             } |  225             } | 
|  233  |  226  | 
|  234             const char* text() const override { return "Hi, Skia!"; } |  227             const char* text() const override { return "Hi, Skia!"; } | 
|  235  |  228  | 
|  236             SkAutoTUnref<SkTypeface> fTypeface; |  229             SkAutoTUnref<SkTypeface> fTypeface; | 
|  237         }; |  230         }; | 
|  238         fPrims.push_back(SkNEW(Rect)); |  231         fPrims.push_back(SkNEW(Rect)); | 
|  239         fPrims.push_back(SkNEW(Circle)); |  232         fPrims.push_back(SkNEW(Circle)); | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  311     }; |  304     }; | 
|  312  |  305  | 
|  313     SkTArray<Prim*> fPrims; |  306     SkTArray<Prim*> fPrims; | 
|  314  |  307  | 
|  315     typedef GM INHERITED; |  308     typedef GM INHERITED; | 
|  316 }; |  309 }; | 
|  317  |  310  | 
|  318 DEF_GM( return SkNEW(DCShaderGM); ) |  311 DEF_GM( return SkNEW(DCShaderGM); ) | 
|  319 } |  312 } | 
|  320 #endif |  313 #endif | 
| OLD | NEW |