blob: f5a428608ab9f9a9af1a92f1c3ff5136b5532149 [file] [log] [blame]
Romain Guye2d345e2010-09-24 18:39:22 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "OpenGLRenderer"
18
19#include <utils/StopWatch.h>
20
21#include "OpenGLDebugRenderer.h"
22
23namespace android {
24namespace uirenderer {
25
26void OpenGLDebugRenderer::prepare() {
27 mPrimitivesCount = 0;
28 LOGD("========= Frame start =========");
29 OpenGLRenderer::prepare();
30}
31
32void OpenGLDebugRenderer::finish() {
33 LOGD("========= Frame end =========");
34 LOGD("Primitives draw count = %d", mPrimitivesCount);
35 OpenGLRenderer::finish();
36}
37
38void OpenGLDebugRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) {
39 mPrimitivesCount++;
40 StopWatch w("composeLayer");
41 return OpenGLRenderer::composeLayer(current, previous);
42}
43
44int OpenGLDebugRenderer::saveLayer(float left, float top, float right, float bottom,
45 const SkPaint* p, int flags) {
46 mPrimitivesCount++;
47 StopWatch w("saveLayer");
48 return OpenGLRenderer::saveLayer(left, top, right, bottom, p, flags);
49}
50
51void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, float left, float top,
52 const SkPaint* paint) {
53 mPrimitivesCount++;
54 StopWatch w("drawBitmap");
55 OpenGLRenderer::drawBitmap(bitmap, left, top, paint);
56}
57
58void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix,
59 const SkPaint* paint) {
60 mPrimitivesCount++;
61 StopWatch w("drawBitmapMatrix");
62 OpenGLRenderer::drawBitmap(bitmap, matrix, paint);
63}
64
65void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
66 float srcRight, float srcBottom, float dstLeft, float dstTop,
67 float dstRight, float dstBottom, const SkPaint* paint) {
68 mPrimitivesCount++;
69 StopWatch w("drawBitmapRect");
70 OpenGLRenderer::drawBitmap(bitmap, srcLeft, srcTop, srcRight, srcBottom,
71 dstLeft, dstTop, dstRight, dstBottom, paint);
72}
73
74void OpenGLDebugRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch,
75 float left, float top, float right, float bottom, const SkPaint* paint) {
76 mPrimitivesCount++;
77 StopWatch w("drawPatch");
78 OpenGLRenderer::drawPatch(bitmap, patch, left, top, right, bottom, paint);
79}
80
81void OpenGLDebugRenderer::drawColor(int color, SkXfermode::Mode mode) {
82 mPrimitivesCount++;
83 StopWatch w("drawColor");
84 OpenGLRenderer::drawColor(color, mode);
85}
86
87void OpenGLDebugRenderer::drawRect(float left, float top, float right, float bottom,
88 const SkPaint* paint) {
89 mPrimitivesCount++;
90 StopWatch w("drawRect");
91 OpenGLRenderer::drawRect(left, top, right, bottom, paint);
92}
93
94void OpenGLDebugRenderer::drawPath(SkPath* path, SkPaint* paint) {
95 mPrimitivesCount++;
96 StopWatch w("drawPath");
97 OpenGLRenderer::drawPath(path, paint);
98}
99
100void OpenGLDebugRenderer::drawLines(float* points, int count, const SkPaint* paint) {
101 mPrimitivesCount++;
102 StopWatch w("drawLines");
103 OpenGLRenderer::drawLines(points, count, paint);
104}
105
106void OpenGLDebugRenderer::drawText(const char* text, int bytesCount, int count, float x, float y,
107 SkPaint* paint) {
108 mPrimitivesCount++;
109 StopWatch w("drawText");
110 OpenGLRenderer::drawText(text, bytesCount, count, x, y, paint);
111}
112
113}; // namespace uirenderer
114}; // namespace android