| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 void GraphicsContext::beginLayer(float opacity, SkXfermode::Mode xfermode, const
FloatRect* bounds, ColorFilter colorFilter, SkImageFilter* imageFilter) | 263 void GraphicsContext::beginLayer(float opacity, SkXfermode::Mode xfermode, const
FloatRect* bounds, ColorFilter colorFilter, SkImageFilter* imageFilter) |
| 264 { | 264 { |
| 265 if (contextDisabled()) | 265 if (contextDisabled()) |
| 266 return; | 266 return; |
| 267 | 267 |
| 268 SkPaint layerPaint; | 268 SkPaint layerPaint; |
| 269 layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255)); | 269 layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255)); |
| 270 layerPaint.setXfermodeMode(xfermode); | 270 layerPaint.setXfermodeMode(xfermode); |
| 271 layerPaint.setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter).g
et()); | 271 layerPaint.setColorFilter(toSkSp(WebCoreColorFilterToSkiaColorFilter(colorFi
lter))); |
| 272 layerPaint.setImageFilter(imageFilter); | 272 layerPaint.setImageFilter(imageFilter); |
| 273 | 273 |
| 274 if (bounds) { | 274 if (bounds) { |
| 275 SkRect skBounds = *bounds; | 275 SkRect skBounds = *bounds; |
| 276 saveLayer(&skBounds, &layerPaint); | 276 saveLayer(&skBounds, &layerPaint); |
| 277 } else { | 277 } else { |
| 278 saveLayer(nullptr, &layerPaint); | 278 saveLayer(nullptr, &layerPaint); |
| 279 } | 279 } |
| 280 | 280 |
| 281 #if ENABLE(ASSERT) | 281 #if ENABLE(ASSERT) |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 for (size_t i = 1; i < numPoints; ++i) { | 1251 for (size_t i = 1; i < numPoints; ++i) { |
| 1252 path->lineTo(WebCoreFloatToSkScalar(points[i].x()), | 1252 path->lineTo(WebCoreFloatToSkScalar(points[i].x()), |
| 1253 WebCoreFloatToSkScalar(points[i].y())); | 1253 WebCoreFloatToSkScalar(points[i].y())); |
| 1254 } | 1254 } |
| 1255 } | 1255 } |
| 1256 | 1256 |
| 1257 PassRefPtr<SkColorFilter> GraphicsContext::WebCoreColorFilterToSkiaColorFilter(C
olorFilter colorFilter) | 1257 PassRefPtr<SkColorFilter> GraphicsContext::WebCoreColorFilterToSkiaColorFilter(C
olorFilter colorFilter) |
| 1258 { | 1258 { |
| 1259 switch (colorFilter) { | 1259 switch (colorFilter) { |
| 1260 case ColorFilterLuminanceToAlpha: | 1260 case ColorFilterLuminanceToAlpha: |
| 1261 return adoptRef(SkLumaColorFilter::Create()); | 1261 return fromSkSp(SkLumaColorFilter::Make()); |
| 1262 case ColorFilterLinearRGBToSRGB: | 1262 case ColorFilterLinearRGBToSRGB: |
| 1263 return ColorSpaceUtilities::createColorSpaceFilter(ColorSpaceLinearRGB,
ColorSpaceDeviceRGB); | 1263 return ColorSpaceUtilities::createColorSpaceFilter(ColorSpaceLinearRGB,
ColorSpaceDeviceRGB); |
| 1264 case ColorFilterSRGBToLinearRGB: | 1264 case ColorFilterSRGBToLinearRGB: |
| 1265 return ColorSpaceUtilities::createColorSpaceFilter(ColorSpaceDeviceRGB,
ColorSpaceLinearRGB); | 1265 return ColorSpaceUtilities::createColorSpaceFilter(ColorSpaceDeviceRGB,
ColorSpaceLinearRGB); |
| 1266 case ColorFilterNone: | 1266 case ColorFilterNone: |
| 1267 break; | 1267 break; |
| 1268 default: | 1268 default: |
| 1269 ASSERT_NOT_REACHED(); | 1269 ASSERT_NOT_REACHED(); |
| 1270 break; | 1270 break; |
| 1271 } | 1271 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 static const SkPMColor colors[] = { | 1359 static const SkPMColor colors[] = { |
| 1360 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1360 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
| 1361 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1361 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
| 1362 }; | 1362 }; |
| 1363 | 1363 |
| 1364 return colors[index]; | 1364 return colors[index]; |
| 1365 } | 1365 } |
| 1366 #endif | 1366 #endif |
| 1367 | 1367 |
| 1368 } // namespace blink | 1368 } // namespace blink |
| OLD | NEW |