Chromium Code Reviews| 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/layers/tiled_layer.h" | 5 #include "cc/layers/tiled_layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 void TiledLayer::UpdateTileTextures(const gfx::Rect& update_rect, | 456 void TiledLayer::UpdateTileTextures(const gfx::Rect& update_rect, |
| 457 const gfx::Rect& paint_rect, | 457 const gfx::Rect& paint_rect, |
| 458 int left, | 458 int left, |
| 459 int top, | 459 int top, |
| 460 int right, | 460 int right, |
| 461 int bottom, | 461 int bottom, |
| 462 ResourceUpdateQueue* queue, | 462 ResourceUpdateQueue* queue, |
| 463 const OcclusionTracker<Layer>* occlusion) { | 463 const OcclusionTracker<Layer>* occlusion) { |
| 464 // The update_rect should be in layer space. So we have to convert the | 464 // The update_rect should be in layer space. So we have to convert the |
| 465 // paint_rect from content space to layer space. | 465 // paint_rect from content space to layer space. |
| 466 float width_scale = | 466 float width_scale = 1 / draw_properties().contents_scale_x; |
|
danakj
2014/09/13 13:04:50
Ok ya, this would be correct, but you need to fill
| |
| 467 paint_properties().bounds.width() / | 467 float height_scale = 1 / draw_properties().contents_scale_y; |
| 468 static_cast<float>(content_bounds().width()); | |
| 469 float height_scale = | |
| 470 paint_properties().bounds.height() / | |
| 471 static_cast<float>(content_bounds().height()); | |
| 472 update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale); | 468 update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale); |
| 473 | 469 |
| 474 // Calling PrepareToUpdate() calls into WebKit to paint, which may have the | 470 // Calling PrepareToUpdate() calls into WebKit to paint, which may have the |
| 475 // side effect of disabling compositing, which causes our reference to the | 471 // side effect of disabling compositing, which causes our reference to the |
| 476 // texture updater to be deleted. However, we can't free the memory backing | 472 // texture updater to be deleted. However, we can't free the memory backing |
| 477 // the SkCanvas until the paint finishes, so we grab a local reference here to | 473 // the SkCanvas until the paint finishes, so we grab a local reference here to |
| 478 // hold the updater alive until the paint completes. | 474 // hold the updater alive until the paint completes. |
| 479 scoped_refptr<LayerUpdater> protector(Updater()); | 475 scoped_refptr<LayerUpdater> protector(Updater()); |
| 480 gfx::Rect painted_opaque_rect; | 476 gfx::Rect painted_opaque_rect; |
| 481 Updater()->PrepareToUpdate(paint_rect, | 477 Updater()->PrepareToUpdate(paint_rect, |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 892 gfx::Rect prepaint_rect = visible_content_rect(); | 888 gfx::Rect prepaint_rect = visible_content_rect(); |
| 893 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, | 889 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, |
| 894 -tiler_->tile_size().height() * kPrepaintRows); | 890 -tiler_->tile_size().height() * kPrepaintRows); |
| 895 gfx::Rect content_rect(content_bounds()); | 891 gfx::Rect content_rect(content_bounds()); |
| 896 prepaint_rect.Intersect(content_rect); | 892 prepaint_rect.Intersect(content_rect); |
| 897 | 893 |
| 898 return prepaint_rect; | 894 return prepaint_rect; |
| 899 } | 895 } |
| 900 | 896 |
| 901 } // namespace cc | 897 } // namespace cc |
| OLD | NEW |