blob: 7787ff1c428027bee4589e586194b93910c092a5 [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
Romain Guy5b3b3522010-10-27 18:57:51 -070017#ifndef ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H
18#define ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H
Romain Guye2d345e2010-09-24 18:39:22 -070019
20#include "OpenGLRenderer.h"
21
22namespace android {
23namespace uirenderer {
24
25///////////////////////////////////////////////////////////////////////////////
26// Renderer
27///////////////////////////////////////////////////////////////////////////////
28
29class OpenGLDebugRenderer: public OpenGLRenderer {
30public:
31 OpenGLDebugRenderer(): mPrimitivesCount(0) {
32 }
33
34 ~OpenGLDebugRenderer() {
35 }
36
Romain Guy6b7bd242010-10-06 19:49:23 -070037 void prepare(bool opaque);
Romain Guye2d345e2010-09-24 18:39:22 -070038 void finish();
39
40 int saveLayer(float left, float top, float right, float bottom,
Chet Haase5c13d892010-10-08 08:37:55 -070041 SkPaint* p, int flags);
Romain Guye2d345e2010-09-24 18:39:22 -070042
Chet Haase5c13d892010-10-08 08:37:55 -070043 void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
44 void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070045 void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
46 float srcRight, float srcBottom, float dstLeft, float dstTop,
Chet Haase5c13d892010-10-08 08:37:55 -070047 float dstRight, float dstBottom, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -070048 void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
Romain Guy4bb94202010-10-12 15:59:26 -070049 const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors,
Chet Haase5c13d892010-10-08 08:37:55 -070050 float left, float top, float right, float bottom, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070051 void drawColor(int color, SkXfermode::Mode mode);
Chet Haase5c13d892010-10-08 08:37:55 -070052 void drawRect(float left, float top, float right, float bottom, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070053 void drawPath(SkPath* path, SkPaint* paint);
Chet Haase5c13d892010-10-08 08:37:55 -070054 void drawLines(float* points, int count, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070055 void drawText(const char* text, int bytesCount, int count, float x, float y,
56 SkPaint* paint);
57
58protected:
59 void composeLayer(sp<Snapshot> current, sp<Snapshot> previous);
60
61private:
62 uint32_t mPrimitivesCount;
63
64}; // class OpenGLDebugRenderer
65
66}; // namespace uirenderer
67}; // namespace android
68
Romain Guy5b3b3522010-10-27 18:57:51 -070069#endif // ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H