Chromium Code Reviews| Index: Source/platform/graphics/GraphicsContext.cpp |
| diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp |
| index b51203fb649a04edd422aeaa76bd7d161e30f250..79f38d3483513d577e82d33e7016c8fe4d665bb7 100644 |
| --- a/Source/platform/graphics/GraphicsContext.cpp |
| +++ b/Source/platform/graphics/GraphicsContext.cpp |
| @@ -465,6 +465,9 @@ bool GraphicsContext::concat(const SkMatrix& matrix) |
| if (paintingDisabled()) |
| return false; |
| + if (matrix.isIdentity()) |
| + return true; |
| + |
| realizeSave(SkCanvas::kMatrix_SaveFlag); |
| return m_canvas->concat(matrix); |
| @@ -562,7 +565,7 @@ void GraphicsContext::drawDisplayList(DisplayList* displayList) |
| { |
| ASSERT(!displayList->picture()->getRecordingCanvas()); |
| - if (paintingDisabled() || !displayList) |
| + if (paintingDisabled() || !displayList || displayList->bounds().isEmpty()) |
| return; |
| realizeSave(SkCanvas::kMatrixClip_SaveFlag); |
| @@ -1587,6 +1590,9 @@ void GraphicsContext::translate(float w, float h) |
| if (paintingDisabled()) |
| return; |
| + if (!w && !h) |
| + return; |
| + |
| realizeSave(SkCanvas::kMatrix_SaveFlag); |
| m_canvas->translate(WebCoreFloatToSkScalar(w), WebCoreFloatToSkScalar(h)); |
| @@ -1597,6 +1603,9 @@ void GraphicsContext::scale(const FloatSize& size) |
| if (paintingDisabled()) |
| return; |
| + if (size.width() == 1 && size.height() == 1) |
|
Stephen Chennney
2014/01/17 21:53:21
Not sure if the compiler automatically casts the 1
|
| + return; |
| + |
| realizeSave(SkCanvas::kMatrix_SaveFlag); |
| m_canvas->scale(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(size.height())); |