- add sources.
[platform/framework/web/crosswalk.git] / src / tools / perf / page_sets / tough_canvas_cases / canvas2d_balls_common / bouncing_balls_draw_ball_as_rect.js
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var ballRadius;
6
7 function drawBallInit(diameter) {
8   ballRadius = diameter / 2;
9 }
10
11 function drawBall(x, y, angle) {
12   canvasContext.save();
13   canvasContext.fillStyle = 'blue';
14   canvasContext.translate(x, y);
15   canvasContext.rotate(angle);
16   canvasContext.fillRect(-ballRadius, -ballRadius, ballDiameter, ballDiameter);
17   canvasContext.restore();
18 }