| 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 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 canvas->clipRect(r); | 38 canvas->clipRect(r); |
| 39 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint); | 39 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint); |
| 40 canvas->restore(); | 40 canvas->restore(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { | 43 static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 44 SkPaint paint; | 44 SkPaint paint; |
| 45 paint.setImageFilter(imf); | 45 paint.setImageFilter(imf); |
| 46 paint.setColor(SK_ColorGREEN); | 46 paint.setColor(SK_ColorGREEN); |
| 47 paint.setAntiAlias(true); | 47 paint.setAntiAlias(true); |
| 48 sk_tool_utils::set_portable_typeface(&paint); |
| 48 paint.setTextSize(r.height()/2); | 49 paint.setTextSize(r.height()/2); |
| 49 paint.setTextAlign(SkPaint::kCenter_Align); | 50 paint.setTextAlign(SkPaint::kCenter_Align); |
| 50 canvas->save(); | 51 canvas->save(); |
| 51 canvas->clipRect(r); | 52 canvas->clipRect(r); |
| 52 canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint); | 53 canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint); |
| 53 canvas->restore(); | 54 canvas->restore(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { | 57 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 57 SkPaint paint; | 58 SkPaint paint; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 173 } |
| 173 | 174 |
| 174 private: | 175 private: |
| 175 typedef GM INHERITED; | 176 typedef GM INHERITED; |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 /////////////////////////////////////////////////////////////////////////////// | 179 /////////////////////////////////////////////////////////////////////////////// |
| 179 | 180 |
| 180 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } | 181 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } |
| 181 static skiagm::GMRegistry reg(MyFactory); | 182 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |