Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 } 1130 }
1131 1131
1132 void LayerImpl::PushScrollOffsetFromMainThreadAndClobberActiveValue( 1132 void LayerImpl::PushScrollOffsetFromMainThreadAndClobberActiveValue(
1133 const gfx::ScrollOffset& scroll_offset) { 1133 const gfx::ScrollOffset& scroll_offset) {
1134 scroll_offset_->set_clobber_active_value(); 1134 scroll_offset_->set_clobber_active_value();
1135 PushScrollOffset(&scroll_offset); 1135 PushScrollOffset(&scroll_offset);
1136 } 1136 }
1137 1137
1138 gfx::ScrollOffset LayerImpl::PullDeltaForMainThread() { 1138 gfx::ScrollOffset LayerImpl::PullDeltaForMainThread() {
1139 RefreshFromScrollDelegate(); 1139 RefreshFromScrollDelegate();
1140 return scroll_offset_->PullDeltaForMainThread(); 1140
1141 // TODO(miletus): Remove all this temporary flooring machinery when
1142 // Blink fully supports fractional scrolls.
1143 gfx::ScrollOffset current_offset = CurrentScrollOffset();
1144 gfx::Vector2dF current_delta = ScrollDelta();
1145 gfx::Vector2dF floored_delta(floor(current_delta.x()),
1146 floor(current_delta.y()));
1147 gfx::Vector2dF diff_delta = floored_delta - current_delta;
1148 gfx::ScrollOffset tmp_offset = ScrollOffsetWithDelta(current_offset,
1149 diff_delta);
1150 scroll_offset_->SetCurrent(tmp_offset);
1151 gfx::ScrollOffset delta = scroll_offset_->PullDeltaForMainThread();
1152 scroll_offset_->SetCurrent(current_offset);
1153 return delta;
1141 } 1154 }
1142 1155
1143 void LayerImpl::RefreshFromScrollDelegate() { 1156 void LayerImpl::RefreshFromScrollDelegate() {
1144 if (scroll_offset_delegate_) { 1157 if (scroll_offset_delegate_) {
1145 SetCurrentScrollOffset( 1158 SetCurrentScrollOffset(
1146 gfx::ScrollOffset(scroll_offset_delegate_->GetCurrentScrollOffset())); 1159 gfx::ScrollOffset(scroll_offset_delegate_->GetCurrentScrollOffset()));
1147 } 1160 }
1148 } 1161 }
1149 1162
1150 gfx::ScrollOffset LayerImpl::CurrentScrollOffset() const { 1163 gfx::ScrollOffset LayerImpl::CurrentScrollOffset() const {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 } 1432 }
1420 1433
1421 void LayerImpl::RemoveDependentNeedsPushProperties() { 1434 void LayerImpl::RemoveDependentNeedsPushProperties() {
1422 num_dependents_need_push_properties_--; 1435 num_dependents_need_push_properties_--;
1423 DCHECK_GE(num_dependents_need_push_properties_, 0); 1436 DCHECK_GE(num_dependents_need_push_properties_, 0);
1424 1437
1425 if (!parent_should_know_need_push_properties() && parent_) 1438 if (!parent_should_know_need_push_properties() && parent_)
1426 parent_->RemoveDependentNeedsPushProperties(); 1439 parent_->RemoveDependentNeedsPushProperties();
1427 } 1440 }
1428 1441
1429 void LayerImpl::GetAllTilesForTracing(std::set<const Tile*>* tiles) const { 1442 void LayerImpl::GetAllTilesAndPrioritiesForTracing(
1443 std::map<const Tile*, TilePriority>* tile_map) const {
1430 } 1444 }
1431 1445
1432 void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { 1446 void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
1433 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 1447 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
1434 TRACE_DISABLED_BY_DEFAULT("cc.debug"), 1448 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
1435 state, 1449 state,
1436 "cc::LayerImpl", 1450 "cc::LayerImpl",
1437 LayerTypeAsString(), 1451 LayerTypeAsString(),
1438 this); 1452 this);
1439 state->SetInteger("layer_id", id()); 1453 state->SetInteger("layer_id", id());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); 1601 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this));
1588 return; 1602 return;
1589 } 1603 }
1590 render_surface_.reset(); 1604 render_surface_.reset();
1591 } 1605 }
1592 1606
1593 Region LayerImpl::GetInvalidationRegion() { 1607 Region LayerImpl::GetInvalidationRegion() {
1594 return Region(update_rect_); 1608 return Region(update_rect_);
1595 } 1609 }
1596 1610
1611 gfx::Rect LayerImpl::GetEnclosingRectInTargetSpace() const {
1612 return MathUtil::MapEnclosingClippedRect(
1613 draw_properties_.target_space_transform,
1614 gfx::Rect(draw_properties_.content_bounds));
1615 }
1616
1617 gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const {
1618 gfx::Transform scaled_draw_transform =
1619 draw_properties_.target_space_transform;
1620 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
1621 gfx::Size scaled_content_bounds =
1622 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
1623 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
1624 gfx::Rect(scaled_content_bounds));
1625 }
1626
1597 } // namespace cc 1627 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698