Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pubspec, changelog, formatting
  • Loading branch information
LouiseHsu committed Mar 27, 2024
commit d889ab94e7a648b4faf21e956fa4acb9546ce2e9
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.2

* Fixes the tile overlay not correctly displaying on physical ios devices.

## 2.5.1

* Makes the tile overlay callback invoke the platform channel on the platform thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @interface GoogleMapsTests : XCTestCase
@end

@interface FLTTileProviderController (Testing)
- (UIImage*)handleResultTile:(nullable UIImage*)tileImage;
- (UIImage *)handleResultTile:(nullable UIImage *)tileImage;
@end

@implementation GoogleMapsTests
Expand Down Expand Up @@ -69,7 +69,9 @@ - (void)testMapsServiceSync {
- (void)testHandleResultTileDownsamplesWideGamutImages {
FLTTileProviderController *controller = [[FLTTileProviderController alloc] init];

NSString *imagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"widegamut" ofType:@"png" inDirectory:@"assets"];
NSString *imagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"widegamut"
ofType:@"png"
inDirectory:@"assets"];
UIImage *wideGamutImage = [UIImage imageWithContentsOfFile:imagePath];

XCTAssertNotNil(wideGamutImage, @"The image should be loaded.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,26 @@ - (instancetype)init:(FlutterMethodChannel *)methodChannel

#pragma mark - GMSTileLayer method

- (UIImage *)handleResultTile:(nullable UIImage*)tile {
CGImageRef imageRef = tile.CGImage;
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
BOOL isFloat = bitmapInfo && kCGBitmapFloatComponents;
size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);

// Engine use f16 pixel format for wide gamut images
// If it is wide gamut, we want to downsample it
if (isFloat & (bitsPerComponent == 16)) {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context =
CGBitmapContextCreate(nil, tile.size.width, tile.size.height, 8, 0,
colorSpace, kCGImageAlphaPremultipliedLast);
CGContextDrawImage(context,
CGRectMake(0, 0, tile.size.width, tile.size.height),
tile.CGImage);
CGImageRef image = CGBitmapContextCreateImage(context);
tile = [UIImage imageWithCGImage:image];

CGImageRelease(image);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
}
- (UIImage *)handleResultTile:(nullable UIImage *)tile {
CGImageRef imageRef = tile.CGImage;
CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);
BOOL isFloat = bitmapInfo && kCGBitmapFloatComponents;
size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);

// Engine use f16 pixel format for wide gamut images
// If it is wide gamut, we want to downsample it
if (isFloat & (bitsPerComponent == 16)) {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(nil, tile.size.width, tile.size.height, 8, 0,
colorSpace, kCGImageAlphaPremultipliedLast);
CGContextDrawImage(context, CGRectMake(0, 0, tile.size.width, tile.size.height), tile.CGImage);
CGImageRef image = CGBitmapContextCreateImage(context);
tile = [UIImage imageWithCGImage:image];

CGImageRelease(image);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
}
return tile;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter_ios
description: iOS implementation of the google_maps_flutter plugin.
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 2.5.1
version: 2.5.2

environment:
sdk: ^3.2.3
Expand Down