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

Side by Side Diff: src/gpu/effects/GrRRectEffect.cpp

Issue 195423002: Fix radical assumption that 0.5 in double is exactly convertible to float. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« 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 "GrRRectEffect.h" 8 #include "GrRRectEffect.h"
9 9
10 #include "gl/GrGLEffect.h" 10 #include "gl/GrGLEffect.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 break; 307 break;
308 case RRectEffect::kTopLeft_CornerFlag: 308 case RRectEffect::kTopLeft_CornerFlag:
309 radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX; 309 radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX;
310 rect.fLeft += radius; 310 rect.fLeft += radius;
311 rect.fTop += radius; 311 rect.fTop += radius;
312 rect.fRight += 0.5f; 312 rect.fRight += 0.5f;
313 rect.fBottom += 0.5f; 313 rect.fBottom += 0.5f;
314 break; 314 break;
315 case RRectEffect::kTopRight_CornerFlag: 315 case RRectEffect::kTopRight_CornerFlag:
316 radius = rrect.radii(SkRRect::kUpperRight_Corner).fX; 316 radius = rrect.radii(SkRRect::kUpperRight_Corner).fX;
317 rect.fLeft -= 0.5; 317 rect.fLeft -= 0.5f;
318 rect.fTop += radius; 318 rect.fTop += radius;
319 rect.fRight -= radius; 319 rect.fRight -= radius;
320 rect.fBottom += 0.5f; 320 rect.fBottom += 0.5f;
321 break; 321 break;
322 case RRectEffect::kBottomRight_CornerFlag: 322 case RRectEffect::kBottomRight_CornerFlag:
323 radius = rrect.radii(SkRRect::kLowerRight_Corner).fX; 323 radius = rrect.radii(SkRRect::kLowerRight_Corner).fX;
324 rect.fLeft -= 0.5; 324 rect.fLeft -= 0.5f;
325 rect.fTop -= 0.5; 325 rect.fTop -= 0.5f;
326 rect.fRight -= radius; 326 rect.fRight -= radius;
327 rect.fBottom -= radius; 327 rect.fBottom -= radius;
328 break; 328 break;
329 case RRectEffect::kBottomLeft_CornerFlag: 329 case RRectEffect::kBottomLeft_CornerFlag:
330 radius = rrect.radii(SkRRect::kLowerLeft_Corner).fX; 330 radius = rrect.radii(SkRRect::kLowerLeft_Corner).fX;
331 rect.fLeft += radius; 331 rect.fLeft += radius;
332 rect.fTop -= 0.5; 332 rect.fTop -= 0.5f;
333 rect.fRight += 0.5; 333 rect.fRight += 0.5f;
334 rect.fBottom -= radius; 334 rect.fBottom -= radius;
335 break; 335 break;
336 case RRectEffect::kLeft_CornerFlags: 336 case RRectEffect::kLeft_CornerFlags:
337 radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX; 337 radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX;
338 rect.fLeft += radius; 338 rect.fLeft += radius;
339 rect.fTop += radius; 339 rect.fTop += radius;
340 rect.fRight += 0.5f; 340 rect.fRight += 0.5f;
341 rect.fBottom -= radius; 341 rect.fBottom -= radius;
342 break; 342 break;
343 case RRectEffect::kTop_CornerFlags: 343 case RRectEffect::kTop_CornerFlags:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 case RRectEffect::kAll_CornerFlags: 421 case RRectEffect::kAll_CornerFlags:
422 break; 422 break;
423 default: 423 default:
424 return NULL; 424 return NULL;
425 } 425 }
426 } else { 426 } else {
427 return NULL; 427 return NULL;
428 } 428 }
429 return RRectEffect::Create(edgeType, cornerFlags, rrect); 429 return RRectEffect::Create(edgeType, cornerFlags, rrect);
430 } 430 }
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