| 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 "cc/resources/raster_source_helper.h" | 5 #include "cc/resources/raster_source_helper.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/debug/debug_colors.h" | 8 #include "cc/debug/debug_colors.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/gfx/geometry/rect_conversions.h" | 10 #include "ui/gfx/geometry/rect_conversions.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 gfx::Rect deflated_content_rect = content_rect; | 48 gfx::Rect deflated_content_rect = content_rect; |
| 49 deflated_content_rect.Inset(0, 0, 1, 1); | 49 deflated_content_rect.Inset(0, 0, 1, 1); |
| 50 if (!deflated_content_rect.Contains(canvas_rect)) { | 50 if (!deflated_content_rect.Contains(canvas_rect)) { |
| 51 if (clear_canvas_with_debug_color) { | 51 if (clear_canvas_with_debug_color) { |
| 52 // Any non-painted areas outside of the content bounds are left in | 52 // Any non-painted areas outside of the content bounds are left in |
| 53 // this color. If this is seen then it means that cc neglected to | 53 // this color. If this is seen then it means that cc neglected to |
| 54 // rerasterize a tile that used to intersect with the content rect | 54 // rerasterize a tile that used to intersect with the content rect |
| 55 // after the content bounds grew. | 55 // after the content bounds grew. |
| 56 canvas->save(); | 56 canvas->save(); |
| 57 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); | 57 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); |
| 58 canvas->clipRect(gfx::RectToSkRect(content_rect), | 58 canvas->clipRect(gfx::RectToSkRect(content_rect), kDifference_SkClipOp); |
| 59 SkRegion::kDifference_Op); | |
| 60 canvas->drawColor(DebugColors::MissingResizeInvalidations(), | 59 canvas->drawColor(DebugColors::MissingResizeInvalidations(), |
| 61 SkXfermode::kSrc_Mode); | 60 SkXfermode::kSrc_Mode); |
| 62 canvas->restore(); | 61 canvas->restore(); |
| 63 } | 62 } |
| 64 | 63 |
| 65 // Drawing at most 2 x 2 x (canvas width + canvas height) texels is 2-3X | 64 // Drawing at most 2 x 2 x (canvas width + canvas height) texels is 2-3X |
| 66 // faster than clearing, so special case this. | 65 // faster than clearing, so special case this. |
| 67 canvas->save(); | 66 canvas->save(); |
| 68 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); | 67 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); |
| 69 gfx::Rect inflated_content_rect = content_rect; | 68 gfx::Rect inflated_content_rect = content_rect; |
| 70 inflated_content_rect.Inset(0, 0, -1, -1); | 69 inflated_content_rect.Inset(0, 0, -1, -1); |
| 71 canvas->clipRect(gfx::RectToSkRect(inflated_content_rect), | 70 canvas->legacyClipRect(gfx::RectToSkRect(inflated_content_rect), |
| 72 SkRegion::kReplace_Op); | 71 SkRegion::kReplace_Op); |
| 73 canvas->clipRect(gfx::RectToSkRect(deflated_content_rect), | 72 canvas->clipRect(gfx::RectToSkRect(deflated_content_rect), |
| 74 SkRegion::kDifference_Op); | 73 kDifference_SkClipOp); |
| 75 canvas->drawColor(background_color, SkXfermode::kSrc_Mode); | 74 canvas->drawColor(background_color, SkXfermode::kSrc_Mode); |
| 76 canvas->restore(); | 75 canvas->restore(); |
| 77 } | 76 } |
| 78 } | 77 } |
| 79 } | 78 } |
| 80 | 79 |
| 81 } // namespace cc | 80 } // namespace cc |
| OLD | NEW |