| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/content_layer_updater.h" | 5 #include "cc/resources/content_layer_updater.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 const gfx::Rect layer_content_rect = gfx::Rect(layer_content_size); | 56 const gfx::Rect layer_content_rect = gfx::Rect(layer_content_size); |
| 57 gfx::Rect deflated_layer_content_rect = layer_content_rect; | 57 gfx::Rect deflated_layer_content_rect = layer_content_rect; |
| 58 deflated_layer_content_rect.Inset(0, 0, 1, 1); | 58 deflated_layer_content_rect.Inset(0, 0, 1, 1); |
| 59 | 59 |
| 60 if (!layer_content_rect.Contains(deflated_layer_content_rect)) { | 60 if (!layer_content_rect.Contains(deflated_layer_content_rect)) { |
| 61 // Drawing at most 1 x 1 x (canvas width + canvas height) texels is 2-3X | 61 // Drawing at most 1 x 1 x (canvas width + canvas height) texels is 2-3X |
| 62 // faster than clearing, so special case this. | 62 // faster than clearing, so special case this. |
| 63 DCHECK_LE(paint_rect.right(), layer_content_rect.right()); | 63 DCHECK_LE(paint_rect.right(), layer_content_rect.right()); |
| 64 DCHECK_LE(paint_rect.bottom(), layer_content_rect.bottom()); | 64 DCHECK_LE(paint_rect.bottom(), layer_content_rect.bottom()); |
| 65 canvas->save(); | 65 canvas->save(); |
| 66 canvas->clipRect(gfx::RectToSkRect(layer_content_rect), | 66 canvas->legacyClipRect(gfx::RectToSkRect(layer_content_rect), |
| 67 SkRegion::kReplace_Op); | 67 SkRegion::kReplace_Op); |
| 68 canvas->clipRect(gfx::RectToSkRect(deflated_layer_content_rect), | 68 canvas->clipRect(gfx::RectToSkRect(deflated_layer_content_rect), |
| 69 SkRegion::kDifference_Op); | 69 kDifference_SkClipOp); |
| 70 canvas->drawColor(background_color_, SkXfermode::kSrc_Mode); | 70 canvas->drawColor(background_color_, SkXfermode::kSrc_Mode); |
| 71 canvas->restore(); | 71 canvas->restore(); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 gfx::Rect layer_rect; | 75 gfx::Rect layer_rect; |
| 76 if (is_scaled) { | 76 if (is_scaled) { |
| 77 canvas->scale(SkFloatToScalar(contents_width_scale), | 77 canvas->scale(SkFloatToScalar(contents_width_scale), |
| 78 SkFloatToScalar(contents_height_scale)); | 78 SkFloatToScalar(contents_height_scale)); |
| 79 | 79 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 | 109 |
| 110 void ContentLayerUpdater::SetFillsBoundsCompletely(bool fills_bounds) { | 110 void ContentLayerUpdater::SetFillsBoundsCompletely(bool fills_bounds) { |
| 111 layer_fills_bounds_completely_ = fills_bounds; | 111 layer_fills_bounds_completely_ = fills_bounds; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ContentLayerUpdater::SetBackgroundColor(SkColor background_color) { | 114 void ContentLayerUpdater::SetBackgroundColor(SkColor background_color) { |
| 115 background_color_ = background_color; | 115 background_color_ = background_color; |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace cc | 118 } // namespace cc |
| OLD | NEW |