OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surface_layer_impl.h" | 5 #include "cc/layers/surface_layer_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 layer_impl->SetSurfaceSize(surface_size_); | 61 layer_impl->SetSurfaceSize(surface_size_); |
62 layer_impl->SetSurfaceScale(surface_scale_); | 62 layer_impl->SetSurfaceScale(surface_scale_); |
63 } | 63 } |
64 | 64 |
65 void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass, | 65 void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass, |
66 AppendQuadsData* append_quads_data) { | 66 AppendQuadsData* append_quads_data) { |
67 AppendRainbowDebugBorder(render_pass); | 67 AppendRainbowDebugBorder(render_pass); |
68 | 68 |
69 SharedQuadState* shared_quad_state = | 69 SharedQuadState* shared_quad_state = |
70 render_pass->CreateAndAppendSharedQuadState(); | 70 render_pass->CreateAndAppendSharedQuadState(); |
71 PopulateScaledSharedQuadState(shared_quad_state, surface_scale_); | 71 gfx::Transform scaled_draw_transform = |
72 draw_properties().target_space_transform; | |
73 | |
74 float boundsWidth = bounds().width(); | |
danakj
2016/11/21 23:37:22
chromium style, though I'd drop these 4 temp vars
xlai (Olivia)
2016/11/22 16:55:59
Done. I was trying to force them (integer) to floa
danakj
2016/11/22 19:19:13
Ah, you can use a static cast for that, or use tem
| |
75 float boundsHeight = bounds().height(); | |
76 float surfaceSizeWidth = surface_size_.width(); | |
77 float surfaceSizeHeight = surface_size_.height(); | |
78 float scale_x = surfaceSizeWidth / boundsWidth; | |
danakj
2016/11/21 23:37:22
why not invert these, and then you don't have to r
xlai (Olivia)
2016/11/22 16:55:59
Done.
| |
79 float scale_y = surfaceSizeHeight / boundsHeight; | |
80 scaled_draw_transform.Scale(SK_MScalar1 / scale_x, SK_MScalar1 / scale_y); | |
81 | |
82 gfx::Size scaled_bounds = gfx::ScaleToCeiledSize(bounds(), surface_scale_); | |
danakj
2016/11/21 23:37:22
I'm very confused what the function of this surfac
xlai (Olivia)
2016/11/22 16:55:59
Actually, this part of code is exactly same as the
danakj
2016/11/22 19:19:13
My feeling is that it doesn't make sense to change
| |
83 gfx::Rect scaled_visible_layer_rect = | |
84 gfx::ScaleToEnclosingRect(visible_layer_rect(), surface_scale_); | |
85 scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds)); | |
86 | |
87 shared_quad_state->SetAll( | |
danakj
2016/11/21 23:37:22
If you can't just add params toPopulateScaledShare
xlai (Olivia)
2016/11/22 16:55:59
Done.
| |
88 scaled_draw_transform, scaled_bounds, scaled_visible_layer_rect, | |
89 draw_properties().clip_rect, draw_properties().is_clipped, | |
90 draw_properties().opacity, draw_blend_mode(), sorting_context_id_); | |
72 | 91 |
73 if (!surface_id_.is_valid()) | 92 if (!surface_id_.is_valid()) |
74 return; | 93 return; |
75 | 94 |
76 gfx::Rect quad_rect(surface_size_); | 95 gfx::Rect quad_rect(surface_size_); |
77 gfx::Rect visible_quad_rect = | 96 gfx::Rect visible_quad_rect = |
78 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 97 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
79 quad_rect); | 98 quad_rect); |
80 if (visible_quad_rect.IsEmpty()) | 99 if (visible_quad_rect.IsEmpty()) |
81 return; | 100 return; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 void SurfaceLayerImpl::AsValueInto(base::trace_event::TracedValue* dict) const { | 199 void SurfaceLayerImpl::AsValueInto(base::trace_event::TracedValue* dict) const { |
181 LayerImpl::AsValueInto(dict); | 200 LayerImpl::AsValueInto(dict); |
182 dict->SetString("surface_id", surface_id_.ToString()); | 201 dict->SetString("surface_id", surface_id_.ToString()); |
183 } | 202 } |
184 | 203 |
185 const char* SurfaceLayerImpl::LayerTypeAsString() const { | 204 const char* SurfaceLayerImpl::LayerTypeAsString() const { |
186 return "cc::SurfaceLayerImpl"; | 205 return "cc::SurfaceLayerImpl"; |
187 } | 206 } |
188 | 207 |
189 } // namespace cc | 208 } // namespace cc |
OLD | NEW |