| 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 "ios/chrome/browser/ui/background_generator.h" | 5 #include "ios/chrome/browser/ui/background_generator.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
| 11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 #import "ios/chrome/browser/ui/ui_util.h" | 13 #import "ios/chrome/browser/ui/ui_util.h" |
| 14 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 14 | 15 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) | 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." | 17 #error "This file requires ARC support." |
| 17 #endif | 18 #endif |
| 18 | 19 |
| 19 // This is a utility function that may be used as a standalone helper function | 20 // This is a utility function that may be used as a standalone helper function |
| 20 // to generate a radial gradient UIImage. | 21 // to generate a radial gradient UIImage. |
| 21 UIImage* GetRadialGradient(CGRect backgroundRect, | 22 UIImage* GetRadialGradient(CGRect backgroundRect, |
| 22 CGPoint centerPoint, | 23 CGPoint centerPoint, |
| 23 CGFloat radius, | 24 CGFloat radius, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 CGPointMake(centerPoint.x - logoImage.size.width / 2.0, | 45 CGPointMake(centerPoint.x - logoImage.size.width / 2.0, |
| 45 centerPoint.y - logoImage.size.height / 2.0)); | 46 centerPoint.y - logoImage.size.height / 2.0)); |
| 46 [logoImage drawAtPoint:corner]; | 47 [logoImage drawAtPoint:corner]; |
| 47 } | 48 } |
| 48 UIImage* background = UIGraphicsGetImageFromCurrentImageContext(); | 49 UIImage* background = UIGraphicsGetImageFromCurrentImageContext(); |
| 49 UIGraphicsEndImageContext(); | 50 UIGraphicsEndImageContext(); |
| 50 return background; | 51 return background; |
| 51 } | 52 } |
| 52 | 53 |
| 53 void InstallBackgroundInView(UIView* view) { | 54 void InstallBackgroundInView(UIView* view) { |
| 54 UIImageView* imageView = [[UIImageView alloc] initWithFrame:view.bounds]; | 55 [view setBackgroundColor:[[MDCPalette greyPalette] tint900]]; |
| 55 imageView.image = [UIImage imageNamed:@"stack_view_background_noise.jpg"]; | |
| 56 imageView.contentMode = UIViewContentModeScaleAspectFill; | |
| 57 imageView.autoresizingMask = | |
| 58 UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; | |
| 59 [view insertSubview:imageView atIndex:0]; | |
| 60 } | 56 } |
| OLD | NEW |