| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 bool clip = !contentRect.contains(paintRect); | 61 bool clip = !contentRect.contains(paintRect); |
| 62 if (clip) { | 62 if (clip) { |
| 63 // Not allowed to overflow the content box. | 63 // Not allowed to overflow the content box. |
| 64 paintInfo.context->save(); | 64 paintInfo.context->save(); |
| 65 paintInfo.context->clip(pixelSnappedIntRect(contentRect)); | 65 paintInfo.context->clip(pixelSnappedIntRect(contentRect)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast
is set. | 68 // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast
is set. |
| 69 // See bug for more details: crbug.com/353716. | 69 // See bug for more details: crbug.com/353716. |
| 70 InterpolationQuality interpolationQuality = style()->imageRendering() == Ima
geRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuali
ty; | 70 InterpolationQuality interpolationQuality; |
| 71 switch (style()->imageRendering()) { |
| 72 case ImageRenderingOptimizeContrast: |
| 73 interpolationQuality = InterpolationLow; |
| 74 break; |
| 75 case ImageRenderingPixelated: |
| 76 interpolationQuality = InterpolationNone; |
| 77 break; |
| 78 default: |
| 79 interpolationQuality = CanvasDefaultInterpolationQuality; |
| 80 } |
| 81 |
| 71 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); | 82 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); |
| 72 context->setImageInterpolationQuality(interpolationQuality); | 83 context->setImageInterpolationQuality(interpolationQuality); |
| 73 toHTMLCanvasElement(node())->paint(context, paintRect); | 84 toHTMLCanvasElement(node())->paint(context, paintRect); |
| 74 context->setImageInterpolationQuality(previousInterpolationQuality); | 85 context->setImageInterpolationQuality(previousInterpolationQuality); |
| 75 | 86 |
| 76 if (clip) | 87 if (clip) |
| 77 context->restore(); | 88 context->restore(); |
| 78 } | 89 } |
| 79 | 90 |
| 80 void RenderHTMLCanvas::canvasSizeChanged() | 91 void RenderHTMLCanvas::canvasSizeChanged() |
| (...skipping 28 matching lines...) Expand all Loading... |
| 109 return CompositingReasonNone; | 120 return CompositingReasonNone; |
| 110 | 121 |
| 111 HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); | 122 HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); |
| 112 if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated(
)) | 123 if (canvas->renderingContext() && canvas->renderingContext()->isAccelerated(
)) |
| 113 return CompositingReasonCanvas; | 124 return CompositingReasonCanvas; |
| 114 | 125 |
| 115 return CompositingReasonNone; | 126 return CompositingReasonNone; |
| 116 } | 127 } |
| 117 | 128 |
| 118 } // namespace WebCore | 129 } // namespace WebCore |
| OLD | NEW |