| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 if (contextDisabled()) | 336 if (contextDisabled()) |
| 337 return; | 337 return; |
| 338 mutableState()->setCompositeOperation(compositeOperation, blendMode); | 338 mutableState()->setCompositeOperation(compositeOperation, blendMode); |
| 339 } | 339 } |
| 340 | 340 |
| 341 SkColorFilter* GraphicsContext::colorFilter() const | 341 SkColorFilter* GraphicsContext::colorFilter() const |
| 342 { | 342 { |
| 343 return immutableState()->colorFilter(); | 343 return immutableState()->colorFilter(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void GraphicsContext::setColorFilter(ColorFilter colorFilter) | 346 void GraphicsContext::setColorFilter(ColorFilterObsolete colorFilter) |
| 347 { | 347 { |
| 348 GraphicsContextState* stateToSet = mutableState(); | 348 GraphicsContextState* stateToSet = mutableState(); |
| 349 | 349 |
| 350 // We only support one active color filter at the moment. If (when) this bec
omes a problem, | 350 // We only support one active color filter at the moment. If (when) this bec
omes a problem, |
| 351 // we should switch to using color filter chains (Skia work in progress). | 351 // we should switch to using color filter chains (Skia work in progress). |
| 352 ASSERT(!stateToSet->colorFilter()); | 352 ASSERT(!stateToSet->colorFilter()); |
| 353 stateToSet->setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter))
; | 353 stateToSet->setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter))
; |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool GraphicsContext::readPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, int x, int y) | 356 bool GraphicsContext::readPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, int x, int y) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 382 realizeCanvasSave(); | 382 realizeCanvasSave(); |
| 383 | 383 |
| 384 m_canvas->concat(matrix); | 384 m_canvas->concat(matrix); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void GraphicsContext::beginTransparencyLayer(float opacity, const FloatRect* bou
nds) | 387 void GraphicsContext::beginTransparencyLayer(float opacity, const FloatRect* bou
nds) |
| 388 { | 388 { |
| 389 beginLayer(opacity, immutableState()->compositeOperator(), bounds); | 389 beginLayer(opacity, immutableState()->compositeOperator(), bounds); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void GraphicsContext::beginLayer(float opacity, CompositeOperator op, const Floa
tRect* bounds, ColorFilter colorFilter, ImageFilter* imageFilter) | 392 void GraphicsContext::beginLayer(float opacity, CompositeOperator op, const Floa
tRect* bounds, ColorFilterObsolete colorFilter, ImageFilter* imageFilter) |
| 393 { | 393 { |
| 394 if (contextDisabled()) | 394 if (contextDisabled()) |
| 395 return; | 395 return; |
| 396 | 396 |
| 397 SkPaint layerPaint; | 397 SkPaint layerPaint; |
| 398 layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255)); | 398 layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255)); |
| 399 layerPaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, m_paintState-
>blendMode())); | 399 layerPaint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op, m_paintState-
>blendMode())); |
| 400 layerPaint.setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter).g
et()); | 400 layerPaint.setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter).g
et()); |
| 401 layerPaint.setImageFilter(imageFilter); | 401 layerPaint.setImageFilter(imageFilter); |
| 402 | 402 |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 radii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(topLeft.width()), | 1572 radii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(topLeft.width()), |
| 1573 SkIntToScalar(topLeft.height())); | 1573 SkIntToScalar(topLeft.height())); |
| 1574 radii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(topRight.width()), | 1574 radii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(topRight.width()), |
| 1575 SkIntToScalar(topRight.height())); | 1575 SkIntToScalar(topRight.height())); |
| 1576 radii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(bottomRight.width()), | 1576 radii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(bottomRight.width()), |
| 1577 SkIntToScalar(bottomRight.height())); | 1577 SkIntToScalar(bottomRight.height())); |
| 1578 radii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(bottomLeft.width()), | 1578 radii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(bottomLeft.width()), |
| 1579 SkIntToScalar(bottomLeft.height())); | 1579 SkIntToScalar(bottomLeft.height())); |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 PassRefPtr<SkColorFilter> GraphicsContext::WebCoreColorFilterToSkiaColorFilter(C
olorFilter colorFilter) | 1582 PassRefPtr<SkColorFilter> GraphicsContext::WebCoreColorFilterToSkiaColorFilter(C
olorFilterObsolete colorFilter) |
| 1583 { | 1583 { |
| 1584 // FIXME(sky): Remove | 1584 // FIXME(sky): Remove |
| 1585 return nullptr; | 1585 return nullptr; |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 void GraphicsContext::draw2xMarker(SkBitmap* bitmap, int index) | 1588 void GraphicsContext::draw2xMarker(SkBitmap* bitmap, int index) |
| 1589 { | 1589 { |
| 1590 const SkPMColor lineColor = lineColors(index); | 1590 const SkPMColor lineColor = lineColors(index); |
| 1591 const SkPMColor antiColor1 = antiColors1(index); | 1591 const SkPMColor antiColor1 = antiColors1(index); |
| 1592 const SkPMColor antiColor2 = antiColors2(index); | 1592 const SkPMColor antiColor2 = antiColors2(index); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1720 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
| 1721 // being set to true). We need to decide if we respect InterpolationNone | 1721 // being set to true). We need to decide if we respect InterpolationNone |
| 1722 // being returned from computeInterpolationQuality. | 1722 // being returned from computeInterpolationQuality. |
| 1723 resampling = InterpolationLow; | 1723 resampling = InterpolationLow; |
| 1724 } | 1724 } |
| 1725 resampling = limitInterpolationQuality(this, resampling); | 1725 resampling = limitInterpolationQuality(this, resampling); |
| 1726 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); | 1726 paint->setFilterQuality(static_cast<SkFilterQuality>(resampling)); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 } // namespace blink | 1729 } // namespace blink |
| OLD | NEW |