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

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 1297283003: Fix VS 2015 build (Closed) Base URL: https://skia.googlesource.com/skia.git@nvpr
Patch Set: Created 5 years, 4 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "sk_tool_utils_flags.h" 9 #include "sk_tool_utils_flags.h"
10 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 for (int y = dst.fTop; y < dst.fBottom; ++y) { 228 for (int y = dst.fTop; y < dst.fBottom; ++y) {
229 for (int x = dst.fLeft; x < dst.fRight; ++x) { 229 for (int x = dst.fLeft; x < dst.fRight; ++x) {
230 norm.fX = (x + 0.5f - center.fX) / halfSize.fX; 230 norm.fX = (x + 0.5f - center.fX) / halfSize.fX;
231 norm.fY = (y + 0.5f - center.fY) / halfSize.fY; 231 norm.fY = (y + 0.5f - center.fY) / halfSize.fY;
232 232
233 SkScalar tmp = norm.fX * norm.fX + norm.fY * norm.fY; 233 SkScalar tmp = norm.fX * norm.fX + norm.fY * norm.fY;
234 if (tmp >= 1.0f) { 234 if (tmp >= 1.0f) {
235 norm.set(0.0f, 0.0f, 1.0f); 235 norm.set(0.0f, 0.0f, 1.0f);
236 } else { 236 } else {
237 norm.fZ = sqrt(1.0f - tmp); 237 norm.fZ = sqrtf(1.0f - tmp);
238 } 238 }
239 239
240 norm_to_rgb(bm, x, y, norm); 240 norm_to_rgb(bm, x, y, norm);
241 } 241 }
242 } 242 }
243 } 243 }
244 244
245 void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst) { 245 void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst) {
246 const SkPoint center = SkPoint::Make(dst.fLeft + (dst.width() / 2.0f), 246 const SkPoint center = SkPoint::Make(dst.fLeft + (dst.width() / 2.0f),
247 dst.fTop + (dst.height() / 2.0f)); 247 dst.fTop + (dst.height() / 2.0f));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 norm = leftUp; 312 norm = leftUp;
313 } 313 }
314 } 314 }
315 315
316 norm_to_rgb(bm, x, y, norm); 316 norm_to_rgb(bm, x, y, norm);
317 } 317 }
318 } 318 }
319 } 319 }
320 320
321 } // namespace sk_tool_utils 321 } // namespace sk_tool_utils
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