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

Side by Side Diff: samplecode/SampleSubpixelTranslate.cpp

Issue 885783006: enable subpixel text on the subpixel translate sample (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « 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 2014 Google Inc. 2 * Copyright 2014 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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 static const SkPaint::FilterLevel gLevels[] = { 65 static const SkPaint::FilterLevel gLevels[] = {
66 SkPaint::kNone_FilterLevel, 66 SkPaint::kNone_FilterLevel,
67 SkPaint::kLow_FilterLevel, 67 SkPaint::kLow_FilterLevel,
68 SkPaint::kMedium_FilterLevel, 68 SkPaint::kMedium_FilterLevel,
69 SkPaint::kHigh_FilterLevel 69 SkPaint::kHigh_FilterLevel
70 }; 70 };
71 71
72 SkPaint paint; 72 SkPaint paint;
73 paint.setTextSize(48); 73 paint.setTextSize(48);
74 paint.setSubpixelText(true);
74 75
75 paint.setAntiAlias(true); 76 paint.setAntiAlias(true);
76 for (size_t i = 0; i < SK_ARRAY_COUNT(gLevels); ++i) { 77 for (size_t i = 0; i < SK_ARRAY_COUNT(gLevels); ++i) {
77 paint.setFilterLevel(gLevels[i]); 78 paint.setFilterLevel(gLevels[i]);
78 SkRect r = SkRect::MakeXYWH( fCurPos.fX + i * (fSize + 10), fCurPos. fY, fSize, fSize ); 79 SkRect r = SkRect::MakeXYWH( fCurPos.fX + i * (fSize + 10), fCurPos. fY, fSize, fSize );
79 canvas->drawBitmapRect( fBM, r, &paint ); 80 canvas->drawBitmapRect( fBM, r, &paint );
80 } 81 }
81 82
82 canvas->drawText( "AA Scaled", strlen("AA Scaled"), fCurPos.fX + SK_ARRA Y_COUNT(gLevels) * (fSize + 10), fCurPos.fY + fSize/2, paint ); 83 canvas->drawText( "AA Scaled", strlen("AA Scaled"), fCurPos.fX + SK_ARRA Y_COUNT(gLevels) * (fSize + 10), fCurPos.fY + fSize/2, paint );
83 84
(...skipping 28 matching lines...) Expand all
112 } 113 }
113 114
114 private: 115 private:
115 typedef SampleView INHERITED; 116 typedef SampleView INHERITED;
116 }; 117 };
117 118
118 ////////////////////////////////////////////////////////////////////////////// 119 //////////////////////////////////////////////////////////////////////////////
119 120
120 static SkView* MyFactory() { return new SubpixelTranslateView("mandrill_256.png" , .05f, .05f); } 121 static SkView* MyFactory() { return new SubpixelTranslateView("mandrill_256.png" , .05f, .05f); }
121 static SkViewRegister reg(MyFactory); 122 static SkViewRegister reg(MyFactory);
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