- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / perf / rendering / throughput / canvas2d_balls_common / bouncing_balls_draw_ball_as_image.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 ballImage;
6 var ballRadius;
7
8 function drawBallInit(diameter) {
9   ballRadius = diameter / 2;
10   ballImage = document.getElementById('ballImage');
11 }
12
13 function drawBall(x, y, angle) {
14   canvasContext.save();
15   canvasContext.translate(x, y);
16   canvasContext.rotate(angle);
17   canvasContext.drawImage(ballImage, -ballRadius, -ballRadius, ballDiameter,
18       ballDiameter);
19   canvasContext.restore();
20 }