| 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 _sky_engine->OnViewportMetricsChanged(size.width * scale, | 89 ViewportMetricsPtr metrics = ViewportMetrics::New(); |
| 90 size.height * scale, scale); | 90 metrics->physical_width = size.width * scale; |
| 91 metrics->physical_height = size.height * scale; |
| 92 metrics->device_pixel_ratio = scale; |
| 93 _sky_engine->OnViewportMetricsChanged(metrics.Pass()); |
| 91 } | 94 } |
| 92 | 95 |
| 93 - (void)configureLayerDefaults { | 96 - (void)configureLayerDefaults { |
| 94 CAEAGLLayer* layer = reinterpret_cast<CAEAGLLayer*>(self.layer); | 97 CAEAGLLayer* layer = reinterpret_cast<CAEAGLLayer*>(self.layer); |
| 95 layer.allowsGroupOpacity = YES; | 98 layer.allowsGroupOpacity = YES; |
| 96 layer.opaque = YES; | 99 layer.opaque = YES; |
| 97 CGFloat screenScale = [UIScreen mainScreen].scale; | 100 CGFloat screenScale = [UIScreen mainScreen].scale; |
| 98 layer.contentsScale = screenScale; | 101 layer.contentsScale = screenScale; |
| 99 // Note: shouldRasterize is still NO. This is just a defensive measure | 102 // Note: shouldRasterize is still NO. This is just a defensive measure |
| 100 layer.rasterizationScale = screenScale; | 103 layer.rasterizationScale = screenScale; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 + (Class)layerClass { | 289 + (Class)layerClass { |
| 287 return [CAEAGLLayer class]; | 290 return [CAEAGLLayer class]; |
| 288 } | 291 } |
| 289 | 292 |
| 290 - (void)dealloc { | 293 - (void)dealloc { |
| 291 [self notifySurfaceDestruction]; | 294 [self notifySurfaceDestruction]; |
| 292 [super dealloc]; | 295 [super dealloc]; |
| 293 } | 296 } |
| 294 | 297 |
| 295 @end | 298 @end |
| OLD | NEW |