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

Side by Side Diff: gm/imageblur2.cpp

Issue 1263553002: make pixelsnap textblob* etc gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add more 565 compatibility Created 5 years, 4 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
« no previous file with comments | « gm/gm.cpp ('k') | gm/multipicturedraw.cpp » ('j') | 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 "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 for (int y = 0; y < sigmaCount; y++) { 57 for (int y = 0; y < sigmaCount; y++) {
58 SkScalar sigmaY = kBlurSigmas[y]; 58 SkScalar sigmaY = kBlurSigmas[y];
59 59
60 SkPaint paint; 60 SkPaint paint;
61 paint.setImageFilter(SkBlurImageFilter::Create(sigmaX, sigmaY))- >unref(); 61 paint.setImageFilter(SkBlurImageFilter::Create(sigmaX, sigmaY))- >unref();
62 canvas->saveLayer(NULL, &paint); 62 canvas->saveLayer(NULL, &paint);
63 63
64 SkRandom rand; 64 SkRandom rand;
65 SkPaint textPaint; 65 SkPaint textPaint;
66 textPaint.setAntiAlias(false); 66 textPaint.setAntiAlias(false);
67 textPaint.setColor(rand.nextBits(24) | 0xFF000000); 67 textPaint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0xFF000000));
68 sk_tool_utils::set_portable_typeface(&textPaint);
68 textPaint.setTextSize(textSize); 69 textPaint.setTextSize(textSize);
69 70
70 for (int i = 0; i < testStringCount; i++) { 71 for (int i = 0; i < testStringCount; i++) {
71 canvas->drawText(kTestStrings[i], 72 canvas->drawText(kTestStrings[i],
72 strlen(kTestStrings[i]), 73 strlen(kTestStrings[i]),
73 SkIntToScalar(x * dx), 74 SkIntToScalar(x * dx),
74 SkIntToScalar(y * dy + textSize * i + textS ize), 75 SkIntToScalar(y * dy + textSize * i + textS ize),
75 textPaint); 76 textPaint);
76 } 77 }
77 canvas->restore(); 78 canvas->restore();
78 } 79 }
79 } 80 }
80 } 81 }
81 82
82 private: 83 private:
83 SkString fName; 84 SkString fName;
84 85
85 typedef GM INHERITED; 86 typedef GM INHERITED;
86 }; 87 };
87 88
88 ////////////////////////////////////////////////////////////////////////////// 89 //////////////////////////////////////////////////////////////////////////////
89 90
90 static GM* MyFactory(void*) { return new BlurImageFilter; } 91 static GM* MyFactory(void*) { return new BlurImageFilter; }
91 static GMRegistry reg(MyFactory); 92 static GMRegistry reg(MyFactory);
92 93
93 } 94 }
OLDNEW
« no previous file with comments | « gm/gm.cpp ('k') | gm/multipicturedraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698