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 = |
danakj
2016/11/14 20:44:06
New code requires new unit tests of the class.
xlai (Olivia)
2016/11/15 16:36:20
Done.
| |
72 draw_properties().target_space_transform; | |
73 | |
74 float boundsWidth = bounds().width(); | |
75 float boundsHeight = bounds().height(); | |
76 float surfaceSizeWidth = surface_size_.width(); | |
77 float surfaceSizeHeight = surface_size_.height(); | |
78 float scale_x = surfaceSizeWidth / boundsWidth * surface_scale_; | |
79 float scale_y = surfaceSizeHeight / boundsHeight * surface_scale_; | |
80 | |
81 scaled_draw_transform.Scale(SK_MScalar1 / scale_x, SK_MScalar1 / scale_y); | |
Justin Novosad
2016/11/14 20:41:27
How does this affect other uses of surface_layer?
xlai (Olivia)
2016/11/15 16:36:20
I don't think it will not affect other uses of sur
| |
82 | |
83 gfx::Size scaled_bounds = gfx::ScaleToCeiledSize(bounds(), surface_scale_); | |
84 gfx::Rect scaled_visible_layer_rect = | |
85 gfx::ScaleToEnclosingRect(visible_layer_rect(), surface_scale_); | |
86 scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds)); | |
87 | |
88 shared_quad_state->SetAll( | |
89 scaled_draw_transform, scaled_bounds, scaled_visible_layer_rect, | |
90 draw_properties().clip_rect, draw_properties().is_clipped, | |
91 draw_properties().opacity, draw_blend_mode(), sorting_context_id_); | |
72 | 92 |
73 if (!surface_id_.is_valid()) | 93 if (!surface_id_.is_valid()) |
74 return; | 94 return; |
75 | 95 |
76 gfx::Rect quad_rect(surface_size_); | 96 gfx::Rect quad_rect(surface_size_); |
77 gfx::Rect visible_quad_rect = | 97 gfx::Rect visible_quad_rect = |
78 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 98 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
79 quad_rect); | 99 quad_rect); |
80 if (visible_quad_rect.IsEmpty()) | 100 if (visible_quad_rect.IsEmpty()) |
81 return; | 101 return; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 void SurfaceLayerImpl::AsValueInto(base::trace_event::TracedValue* dict) const { | 200 void SurfaceLayerImpl::AsValueInto(base::trace_event::TracedValue* dict) const { |
181 LayerImpl::AsValueInto(dict); | 201 LayerImpl::AsValueInto(dict); |
182 dict->SetString("surface_id", surface_id_.ToString()); | 202 dict->SetString("surface_id", surface_id_.ToString()); |
183 } | 203 } |
184 | 204 |
185 const char* SurfaceLayerImpl::LayerTypeAsString() const { | 205 const char* SurfaceLayerImpl::LayerTypeAsString() const { |
186 return "cc::SurfaceLayerImpl"; | 206 return "cc::SurfaceLayerImpl"; |
187 } | 207 } |
188 | 208 |
189 } // namespace cc | 209 } // namespace cc |
OLD | NEW |