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
4355302e
Commit
4355302e
authored
Nov 20, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #506 from abarth/repaint_rainbow
Add a repaint rainbow to help debug repaint issues
parents
6bfcf9bf
8fa223ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
0 deletions
+100
-0
painting.dart
packages/flutter/lib/painting.dart
+1
-0
colors.dart
packages/flutter/lib/src/painting/colors.dart
+80
-0
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+10
-0
object.dart
packages/flutter/lib/src/rendering/object.dart
+2
-0
view.dart
packages/flutter/lib/src/rendering/view.dart
+7
-0
No files found.
packages/flutter/lib/painting.dart
View file @
4355302e
...
...
@@ -14,6 +14,7 @@ library painting;
export
'src/painting/basic_types.dart'
;
export
'src/painting/box_painter.dart'
;
export
'src/painting/colors.dart'
;
export
'src/painting/shadows.dart'
;
export
'src/painting/text_painter.dart'
;
export
'src/painting/text_style.dart'
;
packages/flutter/lib/src/painting/colors.dart
0 → 100644
View file @
4355302e
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
show
Color
;
class
HSVColor
{
const
HSVColor
.
fromAHSV
(
this
.
a
,
this
.
h
,
this
.
s
,
this
.
v
);
/// Alpha, from 0.0 to 1.0.
final
double
a
;
/// Hue, from 0.0 to 360.0.
final
double
h
;
/// Saturation, from 0.0 to 1.0.
final
double
s
;
/// Value, from 0.0 to 1.0.
final
double
v
;
HSVColor
withAlpha
(
double
a
)
{
return
new
HSVColor
.
fromAHSV
(
a
,
h
,
s
,
v
);
}
HSVColor
withHue
(
double
h
)
{
return
new
HSVColor
.
fromAHSV
(
a
,
h
,
s
,
v
);
}
HSVColor
withSaturation
(
double
s
)
{
return
new
HSVColor
.
fromAHSV
(
a
,
h
,
s
,
v
);
}
HSVColor
withValue
(
double
v
)
{
return
new
HSVColor
.
fromAHSV
(
a
,
h
,
s
,
v
);
}
/// Returns this color in RGB.
Color
toColor
()
{
final
double
h
=
this
.
h
%
360
;
final
double
c
=
s
*
v
;
final
double
x
=
c
*
(
1
-
(((
h
/
60.0
)
%
2
)
-
1
).
abs
());
final
double
m
=
v
-
c
;
double
r
;
double
g
;
double
b
;
if
(
h
<
60.0
)
{
r
=
c
;
g
=
x
;
b
=
0.0
;
}
else
if
(
h
<
120.0
)
{
r
=
x
;
g
=
c
;
b
=
0.0
;
}
else
if
(
h
<
180.0
)
{
r
=
0.0
;
g
=
c
;
b
=
x
;
}
else
if
(
h
<
240.0
)
{
r
=
0.0
;
g
=
x
;
b
=
c
;
}
else
if
(
h
<
300.0
)
{
r
=
x
;
g
=
0.0
;
b
=
c
;
}
else
{
r
=
c
;
g
=
0.0
;
b
=
x
;
}
return
new
Color
.
fromARGB
(
(
a
*
0xFF
).
round
(),
((
r
+
m
)
*
0xFF
).
round
(),
((
g
+
m
)
*
0xFF
).
round
(),
((
b
+
m
)
*
0xFF
).
round
()
);
}
}
packages/flutter/lib/src/rendering/debug.dart
View file @
4355302e
...
...
@@ -6,6 +6,7 @@ import 'dart:ui' as ui;
import
'dart:async'
;
import
'dart:collection'
;
import
'package:flutter/painting.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
/// Causes each RenderBox to paint a box around its bounds.
...
...
@@ -38,6 +39,15 @@ int debugPaintPointersColorValue = 0x00BBBB;
/// The color to use when painting RenderError boxes in checked mode.
ui
.
Color
debugErrorBoxColor
=
const
ui
.
Color
(
0xFFFF0000
);
/// Overlay a rotating set of colors when repainting layers in checked mode.
bool
debugEnableRepaintRainbox
=
false
;
/// The current color to overlay when repainting a layer.
HSVColor
debugCurrentRepaintColor
=
const
HSVColor
.
fromAHSV
(
0.4
,
60.0
,
1.0
,
1.0
);
/// The amount to increment the hue of the current repaint color.
double
debugRepaintRainboxHueIncrement
=
2.0
;
List
<
String
>
debugDescribeTransform
(
Matrix4
transform
)
{
List
<
String
>
matrix
=
transform
.
toString
().
split
(
'
\n
'
).
map
((
String
s
)
=>
'
$s
'
).
toList
();
matrix
.
removeLast
();
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
4355302e
...
...
@@ -167,6 +167,8 @@ class PaintingContext {
if
(!
_isRecording
)
return
;
assert
(()
{
if
(
debugEnableRepaintRainbox
)
canvas
.
drawRect
(
_paintBounds
,
new
Paint
()..
color
=
debugCurrentRepaintColor
.
toColor
());
if
(
debugPaintLayerBordersEnabled
)
{
Paint
paint
=
new
Paint
()
..
style
=
ui
.
PaintingStyle
.
stroke
...
...
packages/flutter/lib/src/rendering/view.dart
View file @
4355302e
...
...
@@ -6,9 +6,11 @@ import 'dart:developer';
import
'dart:ui'
as
ui
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:vector_math/vector_math_64.dart'
;
import
'box.dart'
;
import
'debug.dart'
;
import
'layer.dart'
;
import
'object.dart'
;
...
...
@@ -126,6 +128,11 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
ui
.
Scene
scene
=
builder
.
build
();
ui
.
window
.
render
(
scene
);
scene
.
dispose
();
assert
(()
{
if
(
debugEnableRepaintRainbox
)
debugCurrentRepaintColor
=
debugCurrentRepaintColor
.
withHue
(
debugCurrentRepaintColor
.
h
+
debugRepaintRainboxHueIncrement
);
return
true
;
});
}
finally
{
Timeline
.
finishSync
();
}
...
...
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