OLD | NEW |
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/picture_layer_impl.h" | 5 #include "cc/picture_layer_impl.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "cc/append_quads_data.h" | 8 #include "cc/append_quads_data.h" |
9 #include "cc/checkerboard_draw_quad.h" | 9 #include "cc/checkerboard_draw_quad.h" |
10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 SharedQuadState* sharedQuadState = | 91 SharedQuadState* sharedQuadState = |
92 quadSink.useSharedQuadState(createSharedQuadState()); | 92 quadSink.useSharedQuadState(createSharedQuadState()); |
93 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 93 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
94 | 94 |
95 bool clipped = false; | 95 bool clipped = false; |
96 gfx::QuadF target_quad = MathUtil::mapQuad( | 96 gfx::QuadF target_quad = MathUtil::mapQuad( |
97 drawTransform(), | 97 drawTransform(), |
98 gfx::QuadF(rect), | 98 gfx::QuadF(rect), |
99 clipped); | 99 clipped); |
100 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); | 100 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); |
101 bool useAA = !isAxisAlignedInTarget; | |
102 | 101 |
103 bool isPixelAligned = isAxisAlignedInTarget && drawTransform().IsIdentityOrInt
egerTranslation(); | 102 bool isPixelAligned = isAxisAlignedInTarget && drawTransform().IsIdentityOrInt
egerTranslation(); |
104 PictureLayerTiling::LayerDeviceAlignment layerDeviceAlignment = | 103 PictureLayerTiling::LayerDeviceAlignment layerDeviceAlignment = |
105 isPixelAligned ? PictureLayerTiling::LayerAlignedToDevice | 104 isPixelAligned ? PictureLayerTiling::LayerAlignedToDevice |
106 : PictureLayerTiling::LayerNotAlignedToDevice; | 105 : PictureLayerTiling::LayerNotAlignedToDevice; |
107 | 106 |
108 if (showDebugBorders()) { | 107 if (showDebugBorders()) { |
109 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), | 108 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), |
110 contentsScaleX(), | 109 contentsScaleX(), |
111 rect, | 110 rect, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 continue; | 177 continue; |
179 } | 178 } |
180 | 179 |
181 if (iter->contents_scale() != ideal_contents_scale_) | 180 if (iter->contents_scale() != ideal_contents_scale_) |
182 appendQuadsData.hadIncompleteTile = true; | 181 appendQuadsData.hadIncompleteTile = true; |
183 | 182 |
184 gfx::RectF texture_rect = iter.texture_rect(); | 183 gfx::RectF texture_rect = iter.texture_rect(); |
185 gfx::Rect opaque_rect = iter->opaque_rect(); | 184 gfx::Rect opaque_rect = iter->opaque_rect(); |
186 opaque_rect.Intersect(content_rect); | 185 opaque_rect.Intersect(content_rect); |
187 | 186 |
188 bool outside_left_edge = geometry_rect.x() == content_rect.x(); | |
189 bool outside_top_edge = geometry_rect.y() == content_rect.y(); | |
190 bool outside_right_edge = geometry_rect.right() == content_rect.right(); | |
191 bool outside_bottom_edge = geometry_rect.bottom() == content_rect.bottom(); | |
192 | |
193 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); | 187 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); |
194 quad->SetNew(sharedQuadState, | 188 quad->SetNew(sharedQuadState, |
195 geometry_rect, | 189 geometry_rect, |
196 opaque_rect, | 190 opaque_rect, |
197 resource, | 191 resource, |
198 texture_rect, | 192 texture_rect, |
199 iter.texture_size(), | 193 iter.texture_size(), |
200 iter->contents_swizzled(), | 194 iter->contents_swizzled()); |
201 outside_left_edge && useAA, | |
202 outside_top_edge && useAA, | |
203 outside_right_edge && useAA, | |
204 outside_bottom_edge && useAA); | |
205 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | 195 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
206 | 196 |
207 if (!seen_tilings.size() || seen_tilings.back() != iter.CurrentTiling()) | 197 if (!seen_tilings.size() || seen_tilings.back() != iter.CurrentTiling()) |
208 seen_tilings.push_back(iter.CurrentTiling()); | 198 seen_tilings.push_back(iter.CurrentTiling()); |
209 } | 199 } |
210 | 200 |
211 // Aggressively remove any tilings that are not seen to save memory. Note | 201 // Aggressively remove any tilings that are not seen to save memory. Note |
212 // that this is at the expense of doing cause more frequent re-painting. A | 202 // that this is at the expense of doing cause more frequent re-painting. A |
213 // better scheme would be to maintain a tighter visibleContentRect for the | 203 // better scheme would be to maintain a tighter visibleContentRect for the |
214 // finer tilings. | 204 // finer tilings. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 783 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
794 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 784 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
795 LayerImpl::AsValueInto(state.get()); | 785 LayerImpl::AsValueInto(state.get()); |
796 | 786 |
797 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 787 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
798 state->Set("tilings", tilings_->AsValue().release()); | 788 state->Set("tilings", tilings_->AsValue().release()); |
799 return state.PassAs<base::Value>(); | 789 return state.PassAs<base::Value>(); |
800 } | 790 } |
801 | 791 |
802 } // namespace cc | 792 } // namespace cc |
OLD | NEW |