Chromium Code Reviews| 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 return; | 821 return; |
| 822 | 822 |
| 823 const FloatRect src = srcPtr ? *srcPtr : image->rect(); | 823 const FloatRect src = srcPtr ? *srcPtr : image->rect(); |
| 824 | 824 |
| 825 PaintFlags imageFlags = immutableState()->fillFlags(); | 825 PaintFlags imageFlags = immutableState()->fillFlags(); |
| 826 imageFlags.setBlendMode(op); | 826 imageFlags.setBlendMode(op); |
| 827 imageFlags.setColor(SK_ColorBLACK); | 827 imageFlags.setColor(SK_ColorBLACK); |
| 828 imageFlags.setFilterQuality(computeFilterQuality(image, dest, src)); | 828 imageFlags.setFilterQuality(computeFilterQuality(image, dest, src)); |
| 829 imageFlags.setAntiAlias(shouldAntialias()); | 829 imageFlags.setAntiAlias(shouldAntialias()); |
| 830 image->draw(m_canvas, imageFlags, dest, src, shouldRespectImageOrientation, | 830 image->draw(m_canvas, imageFlags, dest, src, shouldRespectImageOrientation, |
| 831 Image::ClampImageToSourceRect, m_colorBehavior); | 831 Image::ClampImageToSourceRect); |
|
chrishtr
2017/02/28 21:21:28
Remove m_colorBehavior entirely?
ccameron
2017/03/01 20:40:32
Mmh, good point. Took out a little bit more.
| |
| 832 m_paintController.setImagePainted(); | 832 m_paintController.setImagePainted(); |
| 833 } | 833 } |
| 834 | 834 |
| 835 void GraphicsContext::drawImageRRect( | 835 void GraphicsContext::drawImageRRect( |
| 836 Image* image, | 836 Image* image, |
| 837 const FloatRoundedRect& dest, | 837 const FloatRoundedRect& dest, |
| 838 const FloatRect& srcRect, | 838 const FloatRect& srcRect, |
| 839 SkBlendMode op, | 839 SkBlendMode op, |
| 840 RespectImageOrientationEnum respectOrientation) { | 840 RespectImageOrientationEnum respectOrientation) { |
| 841 if (contextDisabled() || !image) | 841 if (contextDisabled() || !image) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 857 imageFlags.setColor(SK_ColorBLACK); | 857 imageFlags.setColor(SK_ColorBLACK); |
| 858 imageFlags.setFilterQuality( | 858 imageFlags.setFilterQuality( |
| 859 computeFilterQuality(image, dest.rect(), srcRect)); | 859 computeFilterQuality(image, dest.rect(), srcRect)); |
| 860 imageFlags.setAntiAlias(shouldAntialias()); | 860 imageFlags.setAntiAlias(shouldAntialias()); |
| 861 | 861 |
| 862 bool useShader = (visibleSrc == srcRect) && | 862 bool useShader = (visibleSrc == srcRect) && |
| 863 (respectOrientation == DoNotRespectImageOrientation); | 863 (respectOrientation == DoNotRespectImageOrientation); |
| 864 if (useShader) { | 864 if (useShader) { |
| 865 const SkMatrix localMatrix = SkMatrix::MakeRectToRect( | 865 const SkMatrix localMatrix = SkMatrix::MakeRectToRect( |
| 866 visibleSrc, dest.rect(), SkMatrix::kFill_ScaleToFit); | 866 visibleSrc, dest.rect(), SkMatrix::kFill_ScaleToFit); |
| 867 useShader = image->applyShader(imageFlags, localMatrix, m_colorBehavior); | 867 useShader = image->applyShader(imageFlags, localMatrix); |
| 868 } | 868 } |
| 869 | 869 |
| 870 if (useShader) { | 870 if (useShader) { |
| 871 // Shader-based fast path. | 871 // Shader-based fast path. |
| 872 m_canvas->drawRRect(dest, imageFlags); | 872 m_canvas->drawRRect(dest, imageFlags); |
| 873 } else { | 873 } else { |
| 874 // Clip-based fallback. | 874 // Clip-based fallback. |
| 875 PaintCanvasAutoRestore autoRestore(m_canvas, true); | 875 PaintCanvasAutoRestore autoRestore(m_canvas, true); |
| 876 m_canvas->clipRRect(dest, imageFlags.isAntiAlias()); | 876 m_canvas->clipRRect(dest, imageFlags.isAntiAlias()); |
| 877 image->draw(m_canvas, imageFlags, dest.rect(), srcRect, respectOrientation, | 877 image->draw(m_canvas, imageFlags, dest.rect(), srcRect, respectOrientation, |
| 878 Image::ClampImageToSourceRect, m_colorBehavior); | 878 Image::ClampImageToSourceRect); |
| 879 } | 879 } |
| 880 | 880 |
| 881 m_paintController.setImagePainted(); | 881 m_paintController.setImagePainted(); |
| 882 } | 882 } |
| 883 | 883 |
| 884 SkFilterQuality GraphicsContext::computeFilterQuality( | 884 SkFilterQuality GraphicsContext::computeFilterQuality( |
| 885 Image* image, | 885 Image* image, |
| 886 const FloatRect& dest, | 886 const FloatRect& dest, |
| 887 const FloatRect& src) const { | 887 const FloatRect& src) const { |
| 888 InterpolationQuality resampling; | 888 InterpolationQuality resampling; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1339 break; | 1339 break; |
| 1340 default: | 1340 default: |
| 1341 NOTREACHED(); | 1341 NOTREACHED(); |
| 1342 break; | 1342 break; |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 return nullptr; | 1345 return nullptr; |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 } // namespace blink | 1348 } // namespace blink |
| OLD | NEW |