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

Side by Side Diff: samplecode/SampleFilterQuality.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « samplecode/SampleFilterFuzz.cpp ('k') | samplecode/SampleFontCache.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 2015 Google Inc. 2 * Copyright 2015 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 SkPath path; 48 SkPath path;
49 path.setFillType(SkPath::kEvenOdd_FillType); 49 path.setFillType(SkPath::kEvenOdd_FillType);
50 50
51 path.addRect(SkRect::MakeWH(N/2, N)); 51 path.addRect(SkRect::MakeWH(N/2, N));
52 path.addRect(SkRect::MakeWH(N, N/2)); 52 path.addRect(SkRect::MakeWH(N, N/2));
53 path.moveTo(0, 0); path.lineTo(N, 0); path.lineTo(0, N); path.close(); 53 path.moveTo(0, 0); path.lineTo(N, 0); path.lineTo(0, N); path.close();
54 54
55 SkPaint paint; 55 SkPaint paint;
56 paint.setShader(make_shader(SkRect::MakeWH(N, N))); 56 paint.setShader(make_shader(SkRect::MakeWH(N, N)));
57 57
58 canvas->drawPath(path, paint); 58 canvas->drawPath(path, paint);
59 return surface->makeImageSnapshot(); 59 return surface->makeImageSnapshot();
60 } 60 }
61 61
62 static sk_sp<SkImage> zoom_up(SkSurface* origSurf, SkImage* orig) { 62 static sk_sp<SkImage> zoom_up(SkSurface* origSurf, SkImage* orig) {
63 const SkScalar S = 16; // amount to scale up 63 const SkScalar S = 16; // amount to scale up
64 const int D = 2; // dimension scaling for the offscreen 64 const int D = 2; // dimension scaling for the offscreen
65 // since we only view the center, don't need to produce the entire thing 65 // since we only view the center, don't need to produce the entire thing
66 66
67 SkImageInfo info = SkImageInfo::MakeN32(orig->width() * D, orig->height() * D, 67 SkImageInfo info = SkImageInfo::MakeN32(orig->width() * D, orig->height() * D,
68 kOpaque_SkAlphaType); 68 kOpaque_SkAlphaType);
69 auto surface(origSurf->makeSurface(info)); 69 auto surface(origSurf->makeSurface(info));
70 SkCanvas* canvas = surface->getCanvas(); 70 SkCanvas* canvas = surface->getCanvas();
71 canvas->drawColor(SK_ColorWHITE); 71 canvas->drawColor(SK_ColorWHITE);
72 canvas->scale(S, S); 72 canvas->scale(S, S);
73 canvas->translate(-SkScalarHalf(orig->width()) * (S - D) / S, 73 canvas->translate(-SkScalarHalf(orig->width()) * (S - D) / S,
74 -SkScalarHalf(orig->height()) * (S - D) / S); 74 -SkScalarHalf(orig->height()) * (S - D) / S);
75 canvas->drawImage(orig, 0, 0, nullptr); 75 canvas->drawImage(orig, 0, 0, nullptr);
76 76
77 if (S > 3) { 77 if (S > 3) {
78 SkPaint paint; 78 SkPaint paint;
79 paint.setColor(SK_ColorWHITE); 79 paint.setColor(SK_ColorWHITE);
80 for (int i = 1; i < orig->height(); ++i) { 80 for (int i = 1; i < orig->height(); ++i) {
81 SkScalar y = SkIntToScalar(i); 81 SkScalar y = SkIntToScalar(i);
82 canvas->drawLine(0, y, SkIntToScalar(orig->width()), y, paint); 82 canvas->drawLine(0, y, SkIntToScalar(orig->width()), y, paint);
83 } 83 }
84 for (int i = 1; i < orig->width(); ++i) { 84 for (int i = 1; i < orig->width(); ++i) {
85 SkScalar x = SkIntToScalar(i); 85 SkScalar x = SkIntToScalar(i);
86 canvas->drawLine(x, 0, x, SkIntToScalar(orig->height()), paint); 86 canvas->drawLine(x, 0, x, SkIntToScalar(orig->height()), paint);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 301 }
302 302
303 private: 303 private:
304 typedef SampleView INHERITED; 304 typedef SampleView INHERITED;
305 }; 305 };
306 306
307 ////////////////////////////////////////////////////////////////////////////// 307 //////////////////////////////////////////////////////////////////////////////
308 308
309 static SkView* MyFactory() { return new FilterQualityView; } 309 static SkView* MyFactory() { return new FilterQualityView; }
310 static SkViewRegister reg(MyFactory); 310 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | samplecode/SampleFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698