Commit 07f0f8cb authored by malch@chromium.org's avatar malch@chromium.org

Clean up snapshot command log.

Review URL: https://codereview.chromium.org/320423004

Review URL: https://codereview.chromium.org/320423004

git-svn-id: svn://svn.chromium.org/blink/trunk@176428 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 84e8811e
......@@ -34,6 +34,45 @@ Canvas log:
}
}
}
10 : {
method : "drawRect"
params : {
paint : {
color : "#FF000000"
filterLevel : "Low"
flags : "AntiAlias"
hinting : "Normal"
strokeCap : "Butt"
strokeJoin : "Miter"
strokeMiter : 4
strokeWidth : 0
styleName : "Fill"
textAlign : "Left"
textEncoding : "UTF-8"
textScaleX : 1
textSize : 12
textSkewX : 0
}
rect : {
bottom : 10
left : 0
right : 10
top : 0
}
}
}
11 : {
method : "restore"
}
12 : {
method : "restore"
}
13 : {
method : "restore"
}
14 : {
method : "restore"
}
2 : {
method : "drawRect"
params : {
......@@ -108,7 +147,71 @@ Canvas log:
}
}
4 : {
method : "restore"
method : "save"
params : {
saveFlags : "kMatrix_SaveFlag kClip_SaveFlag "
}
}
5 : {
method : "clipRect"
params : {
SkRegion::Op : "kIntersect_Op"
rect : {
bottom : 221
left : 0
right : 300
top : 71
}
softClipEdgeStyle : false
}
}
6 : {
method : "translate"
params : {
dx : 0
dy : 71
}
}
7 : {
method : "save"
params : {
saveFlags : "kMatrix_SaveFlag kClip_SaveFlag "
}
}
8 : {
method : "clipRect"
params : {
SkRegion::Op : "kIntersect_Op"
rect : {
bottom : 10
left : 0
right : 10
top : 0
}
softClipEdgeStyle : false
}
}
9 : {
method : "saveLayer"
params : {
paint : {
color : "#7F000000"
filterLevel : "None"
flags : "none"
hinting : "Normal"
strokeCap : "Butt"
strokeJoin : "Miter"
strokeMiter : 4
strokeWidth : 0
styleName : "Fill"
textAlign : "Left"
textEncoding : "UTF-8"
textScaleX : 1
textSize : 12
textSkewX : 0
}
saveFlags : "kMatrix_SaveFlag kClip_SaveFlag kHasAlphaLayer_SaveFlag kFullColorLayer_SaveFlag kClipToLayer_SaveFlag "
}
}
}
......@@ -33,6 +33,9 @@ function test()
<div id="a" style="-webkit-transform: translateZ(0px); background-color:blue; width:100px; height:100px;">
<div style="width:50px; height:50px; background-color:red;"></div>
<img src="../timeline/resources/test.png">
</div>
<svg>
<rect x="0" y="0" width="10" height="10" style="opacity:0.5"/>
</svg>
</div>
</body>
</html>
......@@ -164,22 +164,9 @@ private:
Vector<double>* m_currentTimings;
};
class LoggingSnapshotPlayer : public SnapshotPlayer {
public:
LoggingSnapshotPlayer(PassRefPtr<SkPicture> picture, SkCanvas* canvas)
: SnapshotPlayer(picture, canvas)
{
}
virtual bool abortDrawing() OVERRIDE
{
return false;
}
};
class LoggingCanvas : public SkCanvas {
public:
LoggingCanvas()
LoggingCanvas(int width, int height) : SkCanvas(width, height)
{
m_log = JSONArray::create();
}
......@@ -428,7 +415,8 @@ public:
SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) OVERRIDE
{
RefPtr<JSONObject> params = addItemWithParams("saveLayer");
params->setObject("bounds", objectForSkRect(*bounds));
if (bounds)
params->setObject("bounds", objectForSkRect(*bounds));
params->setObject("paint", objectForSkPaint(*paint));
params->setString("saveFlags", saveFlagsToString(flags));
this->SkCanvas::willSaveLayer(bounds, paint, flags);
......@@ -1035,7 +1023,7 @@ PassOwnPtr<ImageBuffer> GraphicsContextSnapshot::createImageBuffer() const
PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const
{
LoggingCanvas canvas;
LoggingCanvas canvas(m_picture->width(), m_picture->height());
FragmentSnapshotPlayer player(m_picture, &canvas);
player.play(0, 0);
return canvas.log();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment