blob: 4e5123e038a726c46ebc924e839fd2d02c1f5591 [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
Romain Guy4aa90572010-09-26 18:40:37 -070074void OpenGLDebugRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
75 uint32_t width, uint32_t height, float left, float top, float right, float bottom,
76 const SkPaint* paint) {
Romain Guye2d345e2010-09-24 18:39:22 -070077 mPrimitivesCount++;
78 StopWatch w("drawPatch");
Romain Guy4aa90572010-09-26 18:40:37 -070079 OpenGLRenderer::drawPatch(bitmap, xDivs, yDivs, width, height,
80 left, top, right, bottom, paint);
Romain Guye2d345e2010-09-24 18:39:22 -070081}
82
83void OpenGLDebugRenderer::drawColor(int color, SkXfermode::Mode mode) {
84 mPrimitivesCount++;
85 StopWatch w("drawColor");
86 OpenGLRenderer::drawColor(color, mode);
87}
88
89void OpenGLDebugRenderer::drawRect(float left, float top, float right, float bottom,
90 const SkPaint* paint) {
91 mPrimitivesCount++;
92 StopWatch w("drawRect");
93 OpenGLRenderer::drawRect(left, top, right, bottom, paint);
94}
95
96void OpenGLDebugRenderer::drawPath(SkPath* path, SkPaint* paint) {
97 mPrimitivesCount++;
98 StopWatch w("drawPath");
99 OpenGLRenderer::drawPath(path, paint);
100}
101
102void OpenGLDebugRenderer::drawLines(float* points, int count, const SkPaint* paint) {
103 mPrimitivesCount++;
104 StopWatch w("drawLines");
105 OpenGLRenderer::drawLines(points, count, paint);
106}
107
108void OpenGLDebugRenderer::drawText(const char* text, int bytesCount, int count, float x, float y,
109 SkPaint* paint) {
110 mPrimitivesCount++;
111 StopWatch w("drawText");
112 OpenGLRenderer::drawText(text, bytesCount, count, x, y, paint);
113}
114
115}; // namespace uirenderer
116}; // namespace android