OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "sky_surface.h" | 5 #import "sky_surface.h" |
6 | 6 |
7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 #import <OpenGLES/EAGL.h> | 8 #import <OpenGLES/EAGL.h> |
9 #import <OpenGLES/EAGLDrawable.h> | 9 #import <OpenGLES/EAGLDrawable.h> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 - (void)layoutSubviews { | 79 - (void)layoutSubviews { |
80 [super layoutSubviews]; | 80 [super layoutSubviews]; |
81 | 81 |
82 [self configureLayerDefaults]; | 82 [self configureLayerDefaults]; |
83 | 83 |
84 [self setupPlatformViewIfNecessary]; | 84 [self setupPlatformViewIfNecessary]; |
85 | 85 |
86 CGSize size = self.bounds.size; | 86 CGSize size = self.bounds.size; |
87 CGFloat scale = [UIScreen mainScreen].scale; | 87 CGFloat scale = [UIScreen mainScreen].scale; |
88 | 88 |
89 ViewportMetricsPtr metrics = ViewportMetrics::New(); | 89 sky::ViewportMetricsPtr metrics = sky::ViewportMetrics::New(); |
90 metrics->physical_width = size.width * scale; | 90 metrics->physical_width = size.width * scale; |
91 metrics->physical_height = size.height * scale; | 91 metrics->physical_height = size.height * scale; |
92 metrics->device_pixel_ratio = scale; | 92 metrics->device_pixel_ratio = scale; |
93 _sky_engine->OnViewportMetricsChanged(metrics.Pass()); | 93 _sky_engine->OnViewportMetricsChanged(metrics.Pass()); |
94 } | 94 } |
95 | 95 |
96 - (void)configureLayerDefaults { | 96 - (void)configureLayerDefaults { |
97 CAEAGLLayer* layer = reinterpret_cast<CAEAGLLayer*>(self.layer); | 97 CAEAGLLayer* layer = reinterpret_cast<CAEAGLLayer*>(self.layer); |
98 layer.allowsGroupOpacity = YES; | 98 layer.allowsGroupOpacity = YES; |
99 layer.opaque = YES; | 99 layer.opaque = YES; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 + (Class)layerClass { | 289 + (Class)layerClass { |
290 return [CAEAGLLayer class]; | 290 return [CAEAGLLayer class]; |
291 } | 291 } |
292 | 292 |
293 - (void)dealloc { | 293 - (void)dealloc { |
294 [self notifySurfaceDestruction]; | 294 [self notifySurfaceDestruction]; |
295 [super dealloc]; | 295 [super dealloc]; |
296 } | 296 } |
297 | 297 |
298 @end | 298 @end |
OLD | NEW |