| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/gfx/compositor/layer.h" | 5 #include "ui/gfx/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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 if (!texture_.get()) | 317 if (!texture_.get()) |
| 318 texture_ = GetCompositor()->CreateTexture(); | 318 texture_ = GetCompositor()->CreateTexture(); |
| 319 | 319 |
| 320 texture_->SetCanvas(canvas, origin, bounds_.size()); | 320 texture_->SetCanvas(canvas, origin, bounds_.size()); |
| 321 invalid_rect_ = gfx::Rect(); | 321 invalid_rect_ = gfx::Rect(); |
| 322 #endif | 322 #endif |
| 323 } | 323 } |
| 324 | 324 |
| 325 void Layer::SchedulePaint(const gfx::Rect& invalid_rect) { | 325 void Layer::SchedulePaint(const gfx::Rect& invalid_rect) { |
| 326 #if defined(USE_WEBKIT_COMPOSITOR) | 326 #if defined(USE_WEBKIT_COMPOSITOR) |
| 327 WebKit::WebFloatRect web_rect(invalid_rect.x(), | 327 WebKit::WebFloatRect web_rect( |
| 328 invalid_rect.x(), |
| 328 invalid_rect.y(), | 329 invalid_rect.y(), |
| 329 invalid_rect.width(), | 330 invalid_rect.width(), |
| 330 invalid_rect.height()); | 331 invalid_rect.height()); |
| 331 if (!web_layer_is_accelerated_) | 332 if (!web_layer_is_accelerated_) |
| 332 web_layer_.to<WebKit::WebContentLayer>().invalidateRect(web_rect); | 333 web_layer_.to<WebKit::WebContentLayer>().invalidateRect(web_rect); |
| 334 else |
| 335 web_layer_.to<WebKit::WebExternalTextureLayer>().invalidateRect(web_rect); |
| 333 #else | 336 #else |
| 334 invalid_rect_ = invalid_rect_.Union(invalid_rect); | 337 invalid_rect_ = invalid_rect_.Union(invalid_rect); |
| 335 ScheduleDraw(); | 338 ScheduleDraw(); |
| 336 #endif | 339 #endif |
| 337 } | 340 } |
| 338 | 341 |
| 339 void Layer::ScheduleDraw() { | 342 void Layer::ScheduleDraw() { |
| 340 Compositor* compositor = GetCompositor(); | 343 Compositor* compositor = GetCompositor(); |
| 341 if (compositor) | 344 if (compositor) |
| 342 compositor->ScheduleDraw(); | 345 compositor->ScheduleDraw(); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 unsigned int color = 0xFF000000; | 764 unsigned int color = 0xFF000000; |
| 762 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 765 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
| 763 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 766 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
| 764 if (!opaque) | 767 if (!opaque) |
| 765 color |= 0xFF; | 768 color |= 0xFF; |
| 766 web_layer_.setDebugBorderColor(color); | 769 web_layer_.setDebugBorderColor(color); |
| 767 } | 770 } |
| 768 #endif | 771 #endif |
| 769 | 772 |
| 770 } // namespace ui | 773 } // namespace ui |
| OLD | NEW |