Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: gm/filterbitmap.cpp

Issue 16123004: use explicit conversion for int->scalar (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698