| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/HTMLCanvasPainter.h" | 5 #include "core/paint/HTMLCanvasPainter.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLCanvasElement.h" | 7 #include "core/html/HTMLCanvasElement.h" |
| 8 #include "core/html/canvas/CanvasRenderingContext.h" | 8 #include "core/html/canvas/CanvasRenderingContext.h" |
| 9 #include "core/layout/LayoutHTMLCanvas.h" | 9 #include "core/layout/LayoutHTMLCanvas.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (clip) { | 49 if (clip) { |
| 50 context.Save(); | 50 context.Save(); |
| 51 // TODO(chrishtr): this should be pixel-snapped. | 51 // TODO(chrishtr): this should be pixel-snapped. |
| 52 context.Clip(FloatRect(content_rect)); | 52 context.Clip(FloatRect(content_rect)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast | 55 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast |
| 56 // is set. See bug for more details: crbug.com/353716. | 56 // is set. See bug for more details: crbug.com/353716. |
| 57 InterpolationQuality interpolation_quality = | 57 InterpolationQuality interpolation_quality = |
| 58 layout_html_canvas_.Style()->ImageRendering() == | 58 layout_html_canvas_.Style()->ImageRendering() == |
| 59 EImageRendering::kOptimizeContrast | 59 EImageRendering::kWebkitOptimizeContrast |
| 60 ? kInterpolationLow | 60 ? kInterpolationLow |
| 61 : CanvasDefaultInterpolationQuality; | 61 : CanvasDefaultInterpolationQuality; |
| 62 if (layout_html_canvas_.Style()->ImageRendering() == | 62 if (layout_html_canvas_.Style()->ImageRendering() == |
| 63 EImageRendering::kPixelated) | 63 EImageRendering::kPixelated) |
| 64 interpolation_quality = kInterpolationNone; | 64 interpolation_quality = kInterpolationNone; |
| 65 | 65 |
| 66 InterpolationQuality previous_interpolation_quality = | 66 InterpolationQuality previous_interpolation_quality = |
| 67 context.ImageInterpolationQuality(); | 67 context.ImageInterpolationQuality(); |
| 68 context.SetImageInterpolationQuality(interpolation_quality); | 68 context.SetImageInterpolationQuality(interpolation_quality); |
| 69 canvas->Paint(context, paint_rect); | 69 canvas->Paint(context, paint_rect); |
| 70 context.SetImageInterpolationQuality(previous_interpolation_quality); | 70 context.SetImageInterpolationQuality(previous_interpolation_quality); |
| 71 | 71 |
| 72 if (clip) | 72 if (clip) |
| 73 context.Restore(); | 73 context.Restore(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |