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

Side by Side Diff: ui/gfx/skia_util.cc

Issue 1800373002: [MD] replace infobar bottom solid line separator with a shadow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/skia_util.h" 5 #include "ui/gfx/skia_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 skia::RefPtr<SkShader> CreateGradientShader(int start_point, 123 skia::RefPtr<SkShader> CreateGradientShader(int start_point,
124 int end_point, 124 int end_point,
125 SkColor start_color, 125 SkColor start_color,
126 SkColor end_color) { 126 SkColor end_color) {
127 SkColor grad_colors[2] = { start_color, end_color}; 127 SkColor grad_colors[2] = { start_color, end_color};
128 SkPoint grad_points[2]; 128 SkPoint grad_points[2];
129 grad_points[0].iset(0, start_point); 129 grad_points[0].iset(0, start_point);
130 grad_points[1].iset(0, end_point); 130 grad_points[1].iset(0, end_point);
131 131
132 return skia::AdoptRef(SkGradientShader::CreateLinear( 132 return skia::AdoptRef(SkGradientShader::CreateLinear(
133 grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode)); 133 grad_points, grad_colors, NULL, 2, SkShader::kClamp_TileMode));
sky 2016/03/16 15:39:42 Why does this change matter?
Evan Stade 2016/03/16 19:29:52 ASCII art of what we want is something like: ----
sky 2016/03/16 21:56:55 Are you sure other call sites don't want the curre
134 } 134 }
135 135
136 static SkScalar RadiusToSigma(double radius) { 136 static SkScalar RadiusToSigma(double radius) {
137 // This captures historically what skia did under the hood. Now skia accepts 137 // This captures historically what skia did under the hood. Now skia accepts
138 // sigma, not radius, so we perform the conversion. 138 // sigma, not radius, so we perform the conversion.
139 return radius > 0 ? SkDoubleToScalar(0.57735f * radius + 0.5) : 0; 139 return radius > 0 ? SkDoubleToScalar(0.57735f * radius + 0.5) : 0;
140 } 140 }
141 141
142 skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper( 142 skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper(
143 const std::vector<ShadowValue>& shadows) { 143 const std::vector<ShadowValue>& shadows) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 static const SkScalar kSkToHbRatio = SK_Scalar1 / kHbUnit1; 238 static const SkScalar kSkToHbRatio = SK_Scalar1 / kHbUnit1;
239 return kSkToHbRatio * value; 239 return kSkToHbRatio * value;
240 } 240 }
241 241
242 float HarfBuzzUnitsToFloat(int value) { 242 float HarfBuzzUnitsToFloat(int value) {
243 static const float kFloatToHbRatio = 1.0f / kHbUnit1; 243 static const float kFloatToHbRatio = 1.0f / kHbUnit1;
244 return kFloatToHbRatio * value; 244 return kFloatToHbRatio * value;
245 } 245 }
246 246
247 } // namespace gfx 247 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698