| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return; | 288 return; |
| 289 // We need to de-reference the currently linked object so that no problem | 289 // We need to de-reference the currently linked object so that no problem |
| 290 // arises if the mask layer gets deleted before this object. | 290 // arises if the mask layer gets deleted before this object. |
| 291 if (layer_mask_) | 291 if (layer_mask_) |
| 292 layer_mask_->layer_mask_back_link_ = NULL; | 292 layer_mask_->layer_mask_back_link_ = NULL; |
| 293 layer_mask_ = layer_mask; | 293 layer_mask_ = layer_mask; |
| 294 web_layer_->setMaskLayer( | 294 web_layer_->setMaskLayer( |
| 295 layer_mask ? layer_mask->web_layer() : NULL); | 295 layer_mask ? layer_mask->web_layer() : NULL); |
| 296 // We need to reference the linked object so that it can properly break the | 296 // We need to reference the linked object so that it can properly break the |
| 297 // link to us when it gets deleted. | 297 // link to us when it gets deleted. |
| 298 if (layer_mask) | 298 if (layer_mask) { |
| 299 layer_mask->layer_mask_back_link_ = this; | 299 layer_mask->layer_mask_back_link_ = this; |
| 300 layer_mask->OnDeviceScaleFactorChanged(device_scale_factor_); |
| 301 } |
| 300 } | 302 } |
| 301 | 303 |
| 302 void Layer::SetLayerFilters() { | 304 void Layer::SetLayerFilters() { |
| 303 WebKit::WebFilterOperations filters; | 305 WebKit::WebFilterOperations filters; |
| 304 if (layer_saturation_) { | 306 if (layer_saturation_) { |
| 305 filters.append(WebKit::WebFilterOperation::createSaturateFilter( | 307 filters.append(WebKit::WebFilterOperation::createSaturateFilter( |
| 306 layer_saturation_)); | 308 layer_saturation_)); |
| 307 } | 309 } |
| 308 if (layer_grayscale_) { | 310 if (layer_grayscale_) { |
| 309 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter( | 311 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter( |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (device_scale_factor_ == device_scale_factor) | 486 if (device_scale_factor_ == device_scale_factor) |
| 485 return; | 487 return; |
| 486 device_scale_factor_ = device_scale_factor; | 488 device_scale_factor_ = device_scale_factor; |
| 487 RecomputeTransform(); | 489 RecomputeTransform(); |
| 488 RecomputeDrawsContentAndUVRect(); | 490 RecomputeDrawsContentAndUVRect(); |
| 489 SchedulePaint(gfx::Rect(bounds_.size())); | 491 SchedulePaint(gfx::Rect(bounds_.size())); |
| 490 if (delegate_) | 492 if (delegate_) |
| 491 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); | 493 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); |
| 492 for (size_t i = 0; i < children_.size(); ++i) | 494 for (size_t i = 0; i < children_.size(); ++i) |
| 493 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); | 495 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); |
| 496 if (layer_mask_) |
| 497 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor); |
| 494 } | 498 } |
| 495 | 499 |
| 496 void Layer::paintContents(WebKit::WebCanvas* web_canvas, | 500 void Layer::paintContents(WebKit::WebCanvas* web_canvas, |
| 497 const WebKit::WebRect& clip, | 501 const WebKit::WebRect& clip, |
| 498 #if WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT | 502 #if WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT |
| 499 bool can_paint_lcd_text, | 503 bool can_paint_lcd_text, |
| 500 #endif // WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT | 504 #endif // WEBCONTENTLAYERCLIENT_HAS_CANPAINTLCDTEXT |
| 501 WebKit::WebFloatRect& opaque) { | 505 WebKit::WebFloatRect& opaque) { |
| 502 TRACE_EVENT0("ui", "Layer::paintContents"); | 506 TRACE_EVENT0("ui", "Layer::paintContents"); |
| 503 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( | 507 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 return; | 794 return; |
| 791 unsigned int color = 0xFF000000; | 795 unsigned int color = 0xFF000000; |
| 792 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 796 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
| 793 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 797 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
| 794 if (!opaque) | 798 if (!opaque) |
| 795 color |= 0xFF; | 799 color |= 0xFF; |
| 796 web_layer_->setDebugBorderColor(color); | 800 web_layer_->setDebugBorderColor(color); |
| 797 } | 801 } |
| 798 | 802 |
| 799 } // namespace ui | 803 } // namespace ui |
| OLD | NEW |