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 18 matching lines...) Expand all Loading... |
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 = { 0, 0, bm.width(), bm.height() }; |
38 mat.mapRect(&bounds); | 38 mat.mapRect(&bounds); |
39 return SkSize::Make(bounds.width(), bounds.height()); | 39 return SkSize::Make(SkIntToScalar(bounds.width()), |
| 40 SkIntToScalar(bounds.height())); |
40 } | 41 } |
41 | 42 |
42 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, |
43 SkScalar dx) { | 44 SkScalar dx) { |
44 SkPaint paint; | 45 SkPaint paint; |
45 | 46 |
46 SkAutoCanvasRestore acr(canvas, true); | 47 SkAutoCanvasRestore acr(canvas, true); |
47 | 48 |
48 canvas->drawBitmapMatrix(bm, mat, &paint); | 49 canvas->drawBitmapMatrix(bm, mat, &paint); |
49 | 50 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 106 } |
106 | 107 |
107 private: | 108 private: |
108 typedef skiagm::GM INHERITED; | 109 typedef skiagm::GM INHERITED; |
109 }; | 110 }; |
110 | 111 |
111 ////////////////////////////////////////////////////////////////////////////// | 112 ////////////////////////////////////////////////////////////////////////////// |
112 | 113 |
113 DEF_GM( return new FilterBitmapGM; ) | 114 DEF_GM( return new FilterBitmapGM; ) |
114 | 115 |
OLD | NEW |