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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.cpp

Issue 2807923002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/graphics (Closed)
Patch Set: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/graphics Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 SkBlendMode::kDifference, // WebBlendModeDifference 69 SkBlendMode::kDifference, // WebBlendModeDifference
70 SkBlendMode::kExclusion, // WebBlendModeExclusion 70 SkBlendMode::kExclusion, // WebBlendModeExclusion
71 SkBlendMode::kHue, // WebBlendModeHue 71 SkBlendMode::kHue, // WebBlendModeHue
72 SkBlendMode::kSaturation, // WebBlendModeSaturation 72 SkBlendMode::kSaturation, // WebBlendModeSaturation
73 SkBlendMode::kColor, // WebBlendModeColor 73 SkBlendMode::kColor, // WebBlendModeColor
74 SkBlendMode::kLuminosity // WebBlendModeLuminosity 74 SkBlendMode::kLuminosity // WebBlendModeLuminosity
75 }; 75 };
76 76
77 SkBlendMode WebCoreCompositeToSkiaComposite(CompositeOperator op, 77 SkBlendMode WebCoreCompositeToSkiaComposite(CompositeOperator op,
78 WebBlendMode blendMode) { 78 WebBlendMode blendMode) {
79 ASSERT(op == CompositeSourceOver || blendMode == WebBlendModeNormal); 79 DCHECK(op == CompositeSourceOver || blendMode == WebBlendModeNormal);
80 if (blendMode != WebBlendModeNormal) { 80 if (blendMode != WebBlendModeNormal) {
81 if (static_cast<uint8_t>(blendMode) >= 81 if (static_cast<uint8_t>(blendMode) >=
82 SK_ARRAY_COUNT(gMapBlendOpsToXfermodeModes)) { 82 SK_ARRAY_COUNT(gMapBlendOpsToXfermodeModes)) {
83 SkDEBUGF( 83 SkDEBUGF(
84 ("GraphicsContext::setPlatformCompositeOperation unknown " 84 ("GraphicsContext::setPlatformCompositeOperation unknown "
85 "WebBlendMode %d\n", 85 "WebBlendMode %d\n",
86 blendMode)); 86 blendMode));
87 return SkBlendMode::kSrcOver; 87 return SkBlendMode::kSrcOver;
88 } 88 }
89 return gMapBlendOpsToXfermodeModes[static_cast<uint8_t>(blendMode)]; 89 return gMapBlendOpsToXfermodeModes[static_cast<uint8_t>(blendMode)];
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 SkColor scaleAlpha(SkColor color, int alpha) { 303 SkColor scaleAlpha(SkColor color, int alpha) {
304 int a = (SkColorGetA(color) * alpha) >> 8; 304 int a = (SkColorGetA(color) * alpha) >> 8;
305 return (color & 0x00FFFFFF) | (a << 24); 305 return (color & 0x00FFFFFF) | (a << 24);
306 } 306 }
307 307
308 template <typename PrimitiveType> 308 template <typename PrimitiveType>
309 void drawFocusRingPrimitive(const PrimitiveType&, 309 void drawFocusRingPrimitive(const PrimitiveType&,
310 PaintCanvas*, 310 PaintCanvas*,
311 const PaintFlags&, 311 const PaintFlags&,
312 float cornerRadius) { 312 float cornerRadius) {
313 ASSERT_NOT_REACHED(); // Missing an explicit specialization? 313 NOTREACHED(); // Missing an explicit specialization?
314 } 314 }
315 315
316 template <> 316 template <>
317 void drawFocusRingPrimitive<SkRect>(const SkRect& rect, 317 void drawFocusRingPrimitive<SkRect>(const SkRect& rect,
318 PaintCanvas* canvas, 318 PaintCanvas* canvas,
319 const PaintFlags& flags, 319 const PaintFlags& flags,
320 float cornerRadius) { 320 float cornerRadius) {
321 SkRRect rrect; 321 SkRRect rrect;
322 rrect.setRectXY(rect, SkFloatToScalar(cornerRadius), 322 rrect.setRectXY(rect, SkFloatToScalar(cornerRadius),
323 SkFloatToScalar(cornerRadius)); 323 SkFloatToScalar(cornerRadius));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 template void PLATFORM_EXPORT drawPlatformFocusRing<SkRect>(const SkRect&, 366 template void PLATFORM_EXPORT drawPlatformFocusRing<SkRect>(const SkRect&,
367 PaintCanvas*, 367 PaintCanvas*,
368 SkColor, 368 SkColor,
369 float width); 369 float width);
370 template void PLATFORM_EXPORT drawPlatformFocusRing<SkPath>(const SkPath&, 370 template void PLATFORM_EXPORT drawPlatformFocusRing<SkPath>(const SkPath&,
371 PaintCanvas*, 371 PaintCanvas*,
372 SkColor, 372 SkColor,
373 float width); 373 float width);
374 374
375 } // namespace blink 375 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698