| 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 "webkit/renderer/compositor_bindings/web_content_layer_impl.h" | 5 #include "webkit/renderer/compositor_bindings/web_content_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/content_layer.h" | 7 #include "cc/layers/content_layer.h" |
| 8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
| 9 #include "third_party/WebKit/public/platform/WebContentLayerClient.h" | 9 #include "third_party/WebKit/public/platform/WebContentLayerClient.h" |
| 10 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 10 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { | 45 void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { |
| 46 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); | 46 layer_->layer()->SetDrawCheckerboardForMissingTiles(enable); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WebContentLayerImpl::setHasGpuRasterizationHint(bool has_hint) { | 49 void WebContentLayerImpl::setHasGpuRasterizationHint(bool has_hint) { |
| 50 // TODO(ajuma): Convert per-layer GPU rasterization hints to per-layer | 50 // TODO(ajuma): Convert per-layer GPU rasterization hints to per-layer |
| 51 // prepaint-disabling hints (crbug.com/365885). | 51 // prepaint-disabling hints (crbug.com/365885). |
| 52 } | 52 } |
| 53 | 53 |
| 54 void WebContentLayerImpl::PaintContents(SkCanvas* canvas, | 54 void WebContentLayerImpl::PaintContents( |
| 55 const gfx::Rect& clip, | 55 SkCanvas* canvas, |
| 56 gfx::RectF* opaque) { | 56 const gfx::Rect& clip, |
| 57 gfx::RectF* opaque, |
| 58 ContentLayerClient::GraphicsContextStatus graphics_context_status) { |
| 57 if (!client_) | 59 if (!client_) |
| 58 return; | 60 return; |
| 59 | 61 |
| 60 blink::WebFloatRect web_opaque; | 62 blink::WebFloatRect web_opaque; |
| 61 // For picture layers, always record with LCD text. PictureLayerImpl | 63 // For picture layers, always record with LCD text. PictureLayerImpl |
| 62 // will turn this off later during rasterization. | 64 // will turn this off later during rasterization. |
| 63 bool use_lcd_text = WebLayerImpl::UsingPictureLayer() || can_use_lcd_text_; | 65 bool use_lcd_text = WebLayerImpl::UsingPictureLayer() || can_use_lcd_text_; |
| 64 client_->paintContents(canvas, clip, use_lcd_text, web_opaque); | 66 client_->paintContents( |
| 67 canvas, |
| 68 clip, |
| 69 use_lcd_text, |
| 70 web_opaque, |
| 71 graphics_context_status == ContentLayerClient::GRAPHICS_CONTEXT_ENABLED |
| 72 ? blink::WebContentLayerClient::GraphicsContextEnabled |
| 73 : blink::WebContentLayerClient::GraphicsContextDisabled); |
| 65 *opaque = web_opaque; | 74 *opaque = web_opaque; |
| 66 } | 75 } |
| 67 | 76 |
| 68 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() { | 77 void WebContentLayerImpl::DidChangeLayerCanUseLCDText() { |
| 69 // It is important to make this comparison because the LCD text status | 78 // It is important to make this comparison because the LCD text status |
| 70 // here can get out of sync with that in the layer. | 79 // here can get out of sync with that in the layer. |
| 71 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text()) | 80 if (can_use_lcd_text_ == layer_->layer()->can_use_lcd_text()) |
| 72 return; | 81 return; |
| 73 | 82 |
| 74 // LCD text cannot be enabled once disabled. | 83 // LCD text cannot be enabled once disabled. |
| 75 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) | 84 if (layer_->layer()->can_use_lcd_text() && ignore_lcd_text_change_) |
| 76 return; | 85 return; |
| 77 | 86 |
| 78 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); | 87 can_use_lcd_text_ = layer_->layer()->can_use_lcd_text(); |
| 79 ignore_lcd_text_change_ = true; | 88 ignore_lcd_text_change_ = true; |
| 80 layer_->invalidate(); | 89 layer_->invalidate(); |
| 81 } | 90 } |
| 82 | 91 |
| 83 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; } | 92 bool WebContentLayerImpl::FillsBoundsCompletely() const { return false; } |
| 84 | 93 |
| 85 } // namespace webkit | 94 } // namespace webkit |
| OLD | NEW |