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

Side by Side Diff: gm/imagemagnifier.cpp

Issue 2300623005: Replace a lot of 'static const' with 'constexpr' or 'const'. (Closed)
Patch Set: small msvc concession Created 4 years, 3 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/imagefromyuvtextures.cpp ('k') | gm/imagescalealigned.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 2012 Google Inc. 2 * Copyright 2012 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 "SkImageSource.h" 9 #include "SkImageSource.h"
10 #include "SkMagnifierImageFilter.h" 10 #include "SkMagnifierImageFilter.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DEF_SIMPLE_GM_BG(imagemagnifier_cropped, canvas, WIDTH_HEIGHT, WIDTH_HEIGHT, SK_ ColorBLACK) { 65 DEF_SIMPLE_GM_BG(imagemagnifier_cropped, canvas, WIDTH_HEIGHT, WIDTH_HEIGHT, SK_ ColorBLACK) {
66 66
67 sk_sp<SkImage> image(make_img()); 67 sk_sp<SkImage> image(make_img());
68 68
69 sk_sp<SkImageFilter> imageSource(SkImageSource::Make(std::move(image))); 69 sk_sp<SkImageFilter> imageSource(SkImageSource::Make(std::move(image)));
70 70
71 SkRect srcRect = SkRect::MakeWH(SkIntToScalar(WIDTH_HEIGHT-32), 71 SkRect srcRect = SkRect::MakeWH(SkIntToScalar(WIDTH_HEIGHT-32),
72 SkIntToScalar(WIDTH_HEIGHT-32)); 72 SkIntToScalar(WIDTH_HEIGHT-32));
73 srcRect.inset(64.0f, 64.0f); 73 srcRect.inset(64.0f, 64.0f);
74 74
75 static const SkScalar kInset = 64.0f; 75 constexpr SkScalar kInset = 64.0f;
76 76
77 // Crop out a 16 pixel ring around the result 77 // Crop out a 16 pixel ring around the result
78 const SkRect rect = SkRect::MakeXYWH(16, 16, WIDTH_HEIGHT-32, WIDTH_HEIGHT-3 2); 78 const SkRect rect = SkRect::MakeXYWH(16, 16, WIDTH_HEIGHT-32, WIDTH_HEIGHT-3 2);
79 SkImageFilter::CropRect cropRect(rect); 79 SkImageFilter::CropRect cropRect(rect);
80 80
81 SkPaint filterPaint; 81 SkPaint filterPaint;
82 filterPaint.setImageFilter(SkMagnifierImageFilter::Make(srcRect, kInset, 82 filterPaint.setImageFilter(SkMagnifierImageFilter::Make(srcRect, kInset,
83 std::move(imageSourc e), 83 std::move(imageSourc e),
84 &cropRect)); 84 &cropRect));
85 85
86 canvas->saveLayer(nullptr, &filterPaint); 86 canvas->saveLayer(nullptr, &filterPaint);
87 canvas->restore(); 87 canvas->restore();
88 } 88 }
OLDNEW
« no previous file with comments | « gm/imagefromyuvtextures.cpp ('k') | gm/imagescalealigned.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698