Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e143ac2d
Unverified
Commit
e143ac2d
authored
Jan 12, 2021
by
Devon Carew
Committed by
GitHub
Jan 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
increase the value of debugImageOverheadAllowance from 104 bytes to 128kb (#73720)
parent
f7dc19eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
debug.dart
packages/flutter/lib/src/painting/debug.dart
+5
-3
paint_image_test.dart
packages/flutter/test/painting/paint_image_test.dart
+31
-0
No files found.
packages/flutter/lib/src/painting/debug.dart
View file @
e143ac2d
...
...
@@ -157,11 +157,13 @@ PaintImageCallback? debugOnPaintImage;
/// This has no effect unless asserts are enabled.
bool
debugInvertOversizedImages
=
false
;
const
int
_imageOverheadAllowanceDefault
=
128
*
1024
;
/// The number of bytes an image must use before it triggers inversion when
/// [debugInvertOversizedImages] is true.
///
/// Default is 1
024 (1kb)
.
int
debugImageOverheadAllowance
=
1024
;
/// Default is 1
28kb
.
int
debugImageOverheadAllowance
=
_imageOverheadAllowanceDefault
;
/// Returns true if none of the painting library debug variables have been changed.
///
...
...
@@ -180,7 +182,7 @@ bool debugAssertAllPaintingVarsUnset(String reason, { bool debugDisableShadowsOv
debugNetworkImageHttpClientProvider
!=
null
||
debugOnPaintImage
!=
null
||
debugInvertOversizedImages
==
true
||
debugImageOverheadAllowance
!=
1024
)
{
debugImageOverheadAllowance
!=
_imageOverheadAllowanceDefault
)
{
throw
FlutterError
(
reason
);
}
return
true
;
...
...
packages/flutter/test/painting/paint_image_test.dart
View file @
e143ac2d
...
...
@@ -20,6 +20,7 @@ class TestCanvas implements Canvas {
void
main
(
)
{
late
ui
.
Image
image300x300
;
late
ui
.
Image
image300x200
;
setUpAll
(()
async
{
image300x300
=
await
createTestImage
(
width:
300
,
height:
300
,
cache:
false
);
image300x200
=
await
createTestImage
(
width:
300
,
height:
200
,
cache:
false
);
...
...
@@ -108,6 +109,36 @@ void main() {
FlutterError
.
onError
=
oldFlutterError
;
});
test
(
'debugInvertOversizedImages smaller than overhead allowance'
,
()
async
{
debugInvertOversizedImages
=
true
;
final
FlutterExceptionHandler
?
oldFlutterError
=
FlutterError
.
onError
;
final
List
<
String
>
messages
=
<
String
>[];
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
messages
.
add
(
details
.
exceptionAsString
());
};
try
{
// Create a 290x290 sized image, which is ~24kb less than the allocated size,
// and below the default debugImageOverheadAllowance size of 128kb.
const
Rect
rect
=
Rect
.
fromLTWH
(
50.0
,
50.0
,
290.0
,
290.0
);
final
TestCanvas
canvas
=
TestCanvas
();
paintImage
(
canvas:
canvas
,
rect:
rect
,
image:
image300x300
,
debugImageLabel:
'TestImage'
,
fit:
BoxFit
.
fill
,
);
expect
(
messages
,
isEmpty
);
}
finally
{
debugInvertOversizedImages
=
false
;
FlutterError
.
onError
=
oldFlutterError
;
}
});
test
(
'centerSlice with scale ≠ 1'
,
()
async
{
final
TestCanvas
canvas
=
TestCanvas
();
paintImage
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment