| 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 if (contextDisabled() || !image) | 755 if (contextDisabled() || !image) |
| 756 return; | 756 return; |
| 757 | 757 |
| 758 const FloatRect src = srcPtr ? *srcPtr : image->rect(); | 758 const FloatRect src = srcPtr ? *srcPtr : image->rect(); |
| 759 | 759 |
| 760 SkPaint imagePaint = immutableState()->fillPaint(); | 760 SkPaint imagePaint = immutableState()->fillPaint(); |
| 761 imagePaint.setXfermodeMode(op); | 761 imagePaint.setXfermodeMode(op); |
| 762 imagePaint.setColor(SK_ColorBLACK); | 762 imagePaint.setColor(SK_ColorBLACK); |
| 763 imagePaint.setFilterQuality(computeFilterQuality(image, dest, src)); | 763 imagePaint.setFilterQuality(computeFilterQuality(image, dest, src)); |
| 764 imagePaint.setAntiAlias(shouldAntialias()); | 764 imagePaint.setAntiAlias(shouldAntialias()); |
| 765 image->draw(m_canvas, imagePaint, dest, src, shouldRespectImageOrientation,
Image::ClampImageToSourceRect); | 765 image->draw(m_canvas, imagePaint, dest, src, true, shouldRespectImageOrienta
tion, Image::ClampImageToSourceRect); |
| 766 m_paintController.setImagePainted(); | 766 m_paintController.setImagePainted(); |
| 767 } | 767 } |
| 768 | 768 |
| 769 void GraphicsContext::drawImageRRect(Image* image, const FloatRoundedRect& dest, | 769 void GraphicsContext::drawImageRRect(Image* image, const FloatRoundedRect& dest, |
| 770 const FloatRect& srcRect, SkXfermode::Mode op, RespectImageOrientationEnum r
espectOrientation) | 770 const FloatRect& srcRect, SkXfermode::Mode op, RespectImageOrientationEnum r
espectOrientation) |
| 771 { | 771 { |
| 772 if (contextDisabled() || !image) | 772 if (contextDisabled() || !image) |
| 773 return; | 773 return; |
| 774 | 774 |
| 775 if (!dest.isRounded()) { | 775 if (!dest.isRounded()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 796 useShader = image->applyShader(imagePaint, localMatrix); | 796 useShader = image->applyShader(imagePaint, localMatrix); |
| 797 } | 797 } |
| 798 | 798 |
| 799 if (useShader) { | 799 if (useShader) { |
| 800 // Shader-based fast path. | 800 // Shader-based fast path. |
| 801 m_canvas->drawRRect(dest, imagePaint); | 801 m_canvas->drawRRect(dest, imagePaint); |
| 802 } else { | 802 } else { |
| 803 // Clip-based fallback. | 803 // Clip-based fallback. |
| 804 SkAutoCanvasRestore autoRestore(m_canvas, true); | 804 SkAutoCanvasRestore autoRestore(m_canvas, true); |
| 805 m_canvas->clipRRect(dest, SkRegion::kIntersect_Op, imagePaint.isAntiAlia
s()); | 805 m_canvas->clipRRect(dest, SkRegion::kIntersect_Op, imagePaint.isAntiAlia
s()); |
| 806 image->draw(m_canvas, imagePaint, dest.rect(), srcRect, respectOrientati
on, Image::ClampImageToSourceRect); | 806 image->draw(m_canvas, imagePaint, dest.rect(), srcRect, true, respectOri
entation, Image::ClampImageToSourceRect); |
| 807 } | 807 } |
| 808 | 808 |
| 809 m_paintController.setImagePainted(); | 809 m_paintController.setImagePainted(); |
| 810 } | 810 } |
| 811 | 811 |
| 812 SkFilterQuality GraphicsContext::computeFilterQuality(Image* image, const FloatR
ect& dest, const FloatRect& src) const | 812 SkFilterQuality GraphicsContext::computeFilterQuality(Image* image, const FloatR
ect& dest, const FloatRect& src) const |
| 813 { | 813 { |
| 814 InterpolationQuality resampling; | 814 InterpolationQuality resampling; |
| 815 if (printing()) { | 815 if (printing()) { |
| 816 resampling = InterpolationNone; | 816 resampling = InterpolationNone; |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 static const SkPMColor colors[] = { | 1331 static const SkPMColor colors[] = { |
| 1332 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1332 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
| 1333 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1333 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
| 1334 }; | 1334 }; |
| 1335 | 1335 |
| 1336 return colors[index]; | 1336 return colors[index]; |
| 1337 } | 1337 } |
| 1338 #endif | 1338 #endif |
| 1339 | 1339 |
| 1340 } // namespace blink | 1340 } // namespace blink |
| OLD | NEW |