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

Side by Side Diff: gm/hairlines.cpp

Issue 1085453002: always layout w/ same bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 2013 Google Inc. 2 * Copyright 2013 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkTArray.h" 10 #include "SkTArray.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 } 162 }
163 163
164 void onDraw(SkCanvas* canvas) override { 164 void onDraw(SkCanvas* canvas) override {
165 static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; 165 static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 };
166 static const SkScalar kWidths[] = { 0, 0.5f, 1.5f }; 166 static const SkScalar kWidths[] = { 0, 0.5f, 1.5f };
167 167
168 enum { 168 enum {
169 kMargin = 5, 169 kMargin = 5,
170 }; 170 };
171 int wrapX = canvas->getDeviceSize().fWidth - kMargin; 171 int wrapX = 1250 - kMargin;
172 172
173 SkScalar maxH = 0; 173 SkScalar maxH = 0;
174 canvas->translate(SkIntToScalar(kMargin), SkIntToScalar(kMargin)); 174 canvas->translate(SkIntToScalar(kMargin), SkIntToScalar(kMargin));
175 canvas->save(); 175 canvas->save();
176 176
177 SkScalar x = SkIntToScalar(kMargin); 177 SkScalar x = SkIntToScalar(kMargin);
178 for (int p = 0; p < fPaths.count(); ++p) { 178 for (int p = 0; p < fPaths.count(); ++p) {
179 for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) { 179 for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) {
180 for (int aa = 0; aa < 2; ++aa) { 180 for (int aa = 0; aa < 2; ++aa) {
181 for (size_t w = 0; w < SK_ARRAY_COUNT(kWidths); w++) { 181 for (size_t w = 0; w < SK_ARRAY_COUNT(kWidths); w++) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 SkTArray<SkPath> fPaths; 216 SkTArray<SkPath> fPaths;
217 typedef GM INHERITED; 217 typedef GM INHERITED;
218 }; 218 };
219 219
220 ////////////////////////////////////////////////////////////////////////////// 220 //////////////////////////////////////////////////////////////////////////////
221 221
222 static GM* MyFactory(void*) { return new HairlinesGM; } 222 static GM* MyFactory(void*) { return new HairlinesGM; }
223 static GMRegistry reg(MyFactory); 223 static GMRegistry reg(MyFactory);
224 224
225 } 225 }
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