Go to the source code of this file.
|
static NSColor * | GetBorderColorForLayer (int layer) |
|
static void | UpdateContentSubLayers (CALayer *layer, IOSurfaceRef surface, CGFloat scale, CGSize surfaceSize, NSColor *borderColor, const std::vector< FlutterRect > &paintRegion) |
|
◆ GetBorderColorForLayer()
static NSColor* GetBorderColorForLayer |
( |
int |
layer | ) |
|
|
static |
Definition at line 48 of file FlutterSurfaceManager.mm.
50 [NSColor yellowColor],
52 [NSColor magentaColor],
54 [NSColor purpleColor],
55 [NSColor orangeColor],
58 return colors[layer % colors.count];
◆ UpdateContentSubLayers()
static void UpdateContentSubLayers |
( |
CALayer * |
layer, |
|
|
IOSurfaceRef |
surface, |
|
|
CGFloat |
scale, |
|
|
CGSize |
surfaceSize, |
|
|
NSColor * |
borderColor, |
|
|
const std::vector< FlutterRect > & |
paintRegion |
|
) |
| |
|
static |
Creates sublayers for given layer, each one displaying a portion of the of the surface determined by a rectangle in the provided paint region.
Definition at line 63 of file FlutterSurfaceManager.mm.
70 while (layer.sublayers.count > paintRegion.size()) {
71 [layer.sublayers.lastObject removeFromSuperlayer];
74 while (layer.sublayers.count < paintRegion.size()) {
75 CALayer* newLayer = [CALayer layer];
76 [layer addSublayer:newLayer];
79 for (
size_t i = 0; i < paintRegion.size(); i++) {
80 CALayer* subLayer = [layer.sublayers objectAtIndex:i];
81 const auto& rect = paintRegion[i];
82 subLayer.frame = CGRectMake(rect.left / scale, rect.top / scale,
83 (rect.right - rect.left) / scale, (rect.bottom - rect.top) / scale);
85 double width = surfaceSize.width;
86 double height = surfaceSize.height;
88 subLayer.contentsRect =
89 CGRectMake(rect.left / width, rect.top / height, (rect.right - rect.left) / width,
90 (rect.bottom - rect.top) / height);
92 if (borderColor != nil) {
94 subLayer.borderColor = borderColor.CGColor;
95 subLayer.borderWidth = 1.0;
98 subLayer.contents = (__bridge id)surface;
◆ kIdleDelay
const double kIdleDelay = 1.0 |
|
static |
◆ kSurfaceEvictionAge
const int kSurfaceEvictionAge = 30 |
|
static |