OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 LayoutRect paintRect = replacedContentRect(); | 66 LayoutRect paintRect = replacedContentRect(); |
67 paintRect.moveBy(paintOffset); | 67 paintRect.moveBy(paintOffset); |
68 | 68 |
69 bool clip = !contentRect.contains(paintRect); | 69 bool clip = !contentRect.contains(paintRect); |
70 if (clip) { | 70 if (clip) { |
71 // Not allowed to overflow the content box. | 71 // Not allowed to overflow the content box. |
72 paintInfo.context->save(); | 72 paintInfo.context->save(); |
73 paintInfo.context->clip(pixelSnappedIntRect(contentRect)); | 73 paintInfo.context->clip(pixelSnappedIntRect(contentRect)); |
74 } | 74 } |
75 | 75 |
76 bool useLowQualityScale = style()->imageRendering() == ImageRenderingOptimiz
eContrast; | 76 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast
is set. |
77 toHTMLCanvasElement(node())->paint(context, paintRect, useLowQualityScale); | 77 // See bug for more details: crbug.com/353716. |
| 78 InterpolationQuality interpolationQuality = style()->imageRendering() == Ima
geRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuali
ty; |
| 79 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); |
| 80 context->setImageInterpolationQuality(interpolationQuality); |
| 81 toHTMLCanvasElement(node())->paint(context, paintRect); |
| 82 context->setImageInterpolationQuality(previousInterpolationQuality); |
78 | 83 |
79 if (clip) | 84 if (clip) |
80 context->restore(); | 85 context->restore(); |
81 } | 86 } |
82 | 87 |
83 void RenderHTMLCanvas::canvasSizeChanged() | 88 void RenderHTMLCanvas::canvasSizeChanged() |
84 { | 89 { |
85 IntSize canvasSize = toHTMLCanvasElement(node())->size(); | 90 IntSize canvasSize = toHTMLCanvasElement(node())->size(); |
86 LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasS
ize.height() * style()->effectiveZoom()); | 91 LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasS
ize.height() * style()->effectiveZoom()); |
87 | 92 |
(...skipping 12 matching lines...) Expand all Loading... |
100 updateLogicalWidth(); | 105 updateLogicalWidth(); |
101 updateLogicalHeight(); | 106 updateLogicalHeight(); |
102 if (oldSize == size()) | 107 if (oldSize == size()) |
103 return; | 108 return; |
104 | 109 |
105 if (!selfNeedsLayout()) | 110 if (!selfNeedsLayout()) |
106 setNeedsLayout(); | 111 setNeedsLayout(); |
107 } | 112 } |
108 | 113 |
109 } // namespace WebCore | 114 } // namespace WebCore |
OLD | NEW |