| 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 "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 canvas.drawText("Hamburgefons", 12, 10, 25, paint); | 27 canvas.drawText("Hamburgefons", 12, 10, 25, paint); |
| 28 paint.setTypeface(SkTypeface::CreateFromName("Times", SkTypeface::kItalic))-
>unref(); | 28 paint.setTypeface(SkTypeface::CreateFromName("Times", SkTypeface::kItalic))-
>unref(); |
| 29 canvas.drawText("Hamburgefons", 12, 10, 50, paint); | 29 canvas.drawText("Hamburgefons", 12, 10, 50, paint); |
| 30 paint.setTypeface(SkTypeface::CreateFromName("Times", SkTypeface::kBold))->u
nref(); | 30 paint.setTypeface(SkTypeface::CreateFromName("Times", SkTypeface::kBold))->u
nref(); |
| 31 canvas.drawText("Hamburgefons", 12, 10, 75, paint); | 31 canvas.drawText("Hamburgefons", 12, 10, 75, paint); |
| 32 paint.setTypeface(SkTypeface::CreateFromName("Times", SkTypeface::kBoldItali
c))->unref(); | 32 paint.setTypeface(SkTypeface::CreateFromName("Times", SkTypeface::kBoldItali
c))->unref(); |
| 33 canvas.drawText("Hamburgefons", 12, 10, 100, paint); | 33 canvas.drawText("Hamburgefons", 12, 10, 100, paint); |
| 34 } | 34 } |
| 35 | 35 |
| 36 static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) { | 36 static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) { |
| 37 SkRect bounds = { 0, 0, bm.width(), bm.height() }; | 37 SkRect bounds = SkRect::MakeWH(SkIntToScalar(bm.width()), |
| 38 SkIntToScalar(bm.height())); |
| 38 mat.mapRect(&bounds); | 39 mat.mapRect(&bounds); |
| 39 return SkSize::Make(SkIntToScalar(bounds.width()), | 40 return SkSize::Make(bounds.width(), bounds.height()); |
| 40 SkIntToScalar(bounds.height())); | |
| 41 } | 41 } |
| 42 | 42 |
| 43 static void draw_col(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, | 43 static void draw_col(SkCanvas* canvas, const SkBitmap& bm, const SkMatrix& mat, |
| 44 SkScalar dx) { | 44 SkScalar dx) { |
| 45 SkPaint paint; | 45 SkPaint paint; |
| 46 | 46 |
| 47 SkAutoCanvasRestore acr(canvas, true); | 47 SkAutoCanvasRestore acr(canvas, true); |
| 48 | 48 |
| 49 canvas->drawBitmapMatrix(bm, mat, &paint); | 49 canvas->drawBitmapMatrix(bm, mat, &paint); |
| 50 | 50 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 typedef skiagm::GM INHERITED; | 109 typedef skiagm::GM INHERITED; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 ////////////////////////////////////////////////////////////////////////////// | 112 ////////////////////////////////////////////////////////////////////////////// |
| 113 | 113 |
| 114 DEF_GM( return new FilterBitmapGM; ) | 114 DEF_GM( return new FilterBitmapGM; ) |
| 115 | 115 |
| OLD | NEW |