OLD | NEW |
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 Loading... |
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 blend_mode) { | 78 WebBlendMode blend_mode) { |
79 ASSERT(op == kCompositeSourceOver || blend_mode == kWebBlendModeNormal); | 79 DCHECK(op == kCompositeSourceOver || blend_mode == kWebBlendModeNormal); |
80 if (blend_mode != kWebBlendModeNormal) { | 80 if (blend_mode != kWebBlendModeNormal) { |
81 if (static_cast<uint8_t>(blend_mode) >= | 81 if (static_cast<uint8_t>(blend_mode) >= |
82 SK_ARRAY_COUNT(kGMapBlendOpsToXfermodeModes)) { | 82 SK_ARRAY_COUNT(kGMapBlendOpsToXfermodeModes)) { |
83 SkDEBUGF( | 83 SkDEBUGF( |
84 ("GraphicsContext::setPlatformCompositeOperation unknown " | 84 ("GraphicsContext::setPlatformCompositeOperation unknown " |
85 "WebBlendMode %d\n", | 85 "WebBlendMode %d\n", |
86 blend_mode)); | 86 blend_mode)); |
87 return SkBlendMode::kSrcOver; | 87 return SkBlendMode::kSrcOver; |
88 } | 88 } |
89 return kGMapBlendOpsToXfermodeModes[static_cast<uint8_t>(blend_mode)]; | 89 return kGMapBlendOpsToXfermodeModes[static_cast<uint8_t>(blend_mode)]; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 SkColor ScaleAlpha(SkColor color, int alpha) { | 304 SkColor ScaleAlpha(SkColor color, int alpha) { |
305 int a = (SkColorGetA(color) * alpha) >> 8; | 305 int a = (SkColorGetA(color) * alpha) >> 8; |
306 return (color & 0x00FFFFFF) | (a << 24); | 306 return (color & 0x00FFFFFF) | (a << 24); |
307 } | 307 } |
308 | 308 |
309 template <typename PrimitiveType> | 309 template <typename PrimitiveType> |
310 void DrawFocusRingPrimitive(const PrimitiveType&, | 310 void DrawFocusRingPrimitive(const PrimitiveType&, |
311 PaintCanvas*, | 311 PaintCanvas*, |
312 const PaintFlags&, | 312 const PaintFlags&, |
313 float corner_radius) { | 313 float corner_radius) { |
314 ASSERT_NOT_REACHED(); // Missing an explicit specialization? | 314 NOTREACHED(); // Missing an explicit specialization? |
315 } | 315 } |
316 | 316 |
317 template <> | 317 template <> |
318 void DrawFocusRingPrimitive<SkRect>(const SkRect& rect, | 318 void DrawFocusRingPrimitive<SkRect>(const SkRect& rect, |
319 PaintCanvas* canvas, | 319 PaintCanvas* canvas, |
320 const PaintFlags& flags, | 320 const PaintFlags& flags, |
321 float corner_radius) { | 321 float corner_radius) { |
322 SkRRect rrect; | 322 SkRRect rrect; |
323 rrect.setRectXY(rect, SkFloatToScalar(corner_radius), | 323 rrect.setRectXY(rect, SkFloatToScalar(corner_radius), |
324 SkFloatToScalar(corner_radius)); | 324 SkFloatToScalar(corner_radius)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 template void PLATFORM_EXPORT DrawPlatformFocusRing<SkRect>(const SkRect&, | 367 template void PLATFORM_EXPORT DrawPlatformFocusRing<SkRect>(const SkRect&, |
368 PaintCanvas*, | 368 PaintCanvas*, |
369 SkColor, | 369 SkColor, |
370 float width); | 370 float width); |
371 template void PLATFORM_EXPORT DrawPlatformFocusRing<SkPath>(const SkPath&, | 371 template void PLATFORM_EXPORT DrawPlatformFocusRing<SkPath>(const SkPath&, |
372 PaintCanvas*, | 372 PaintCanvas*, |
373 SkColor, | 373 SkColor, |
374 float width); | 374 float width); |
375 | 375 |
376 } // namespace blink | 376 } // namespace blink |
OLD | NEW |