| 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/playback/raster_source_helper.h" | 5 #include "cc/playback/raster_source_helper.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin())); | 53 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin())); |
| 54 canvas->drawColor(SK_ColorTRANSPARENT, SkXfermode::kClear_Mode); | 54 canvas->drawColor(SK_ColorTRANSPARENT, SkXfermode::kClear_Mode); |
| 55 canvas->restore(); | 55 canvas->restore(); |
| 56 } | 56 } |
| 57 } else { | 57 } else { |
| 58 // Even if completely covered, for rasterizations that touch the edge of the | 58 // Even if completely covered, for rasterizations that touch the edge of the |
| 59 // layer, we also need to raster the background color underneath the last | 59 // layer, we also need to raster the background color underneath the last |
| 60 // texel (since the recording won't cover it) and outside the last texel | 60 // texel (since the recording won't cover it) and outside the last texel |
| 61 // (due to linear filtering when using this texture). | 61 // (due to linear filtering when using this texture). |
| 62 gfx::Rect content_rect = | 62 gfx::Rect content_rect = |
| 63 gfx::ToEnclosingRect(gfx::ScaleRect(source_rect, contents_scale)); | 63 gfx::ScaleToEnclosingRect(source_rect, contents_scale); |
| 64 | 64 |
| 65 // The final texel of content may only be partially covered by a | 65 // The final texel of content may only be partially covered by a |
| 66 // rasterization; this rect represents the content rect that is fully | 66 // rasterization; this rect represents the content rect that is fully |
| 67 // covered by content. | 67 // covered by content. |
| 68 gfx::Rect deflated_content_rect = content_rect; | 68 gfx::Rect deflated_content_rect = content_rect; |
| 69 deflated_content_rect.Inset(0, 0, 1, 1); | 69 deflated_content_rect.Inset(0, 0, 1, 1); |
| 70 deflated_content_rect.Intersect(canvas_playback_rect); | 70 deflated_content_rect.Intersect(canvas_playback_rect); |
| 71 if (!deflated_content_rect.Contains(canvas_playback_rect)) { | 71 if (!deflated_content_rect.Contains(canvas_playback_rect)) { |
| 72 if (clear_canvas_with_debug_color) { | 72 if (clear_canvas_with_debug_color) { |
| 73 // Any non-painted areas outside of the content bounds are left in | 73 // Any non-painted areas outside of the content bounds are left in |
| (...skipping 22 matching lines...) Expand all Loading... |
| 96 SkRegion::kReplace_Op); | 96 SkRegion::kReplace_Op); |
| 97 canvas->clipRect(gfx::RectToSkRect(deflated_content_rect), | 97 canvas->clipRect(gfx::RectToSkRect(deflated_content_rect), |
| 98 SkRegion::kDifference_Op); | 98 SkRegion::kDifference_Op); |
| 99 canvas->drawColor(background_color, SkXfermode::kSrc_Mode); | 99 canvas->drawColor(background_color, SkXfermode::kSrc_Mode); |
| 100 canvas->restore(); | 100 canvas->restore(); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace cc | 105 } // namespace cc |
| OLD | NEW |