blob: 1cef267fcbdb87f70d9c2e2774a05a01510b3681 [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
Romain Guy0fe478e2010-11-08 12:08:41 -080043 void drawDisplayList(DisplayList* displayList);
Romain Guyada830f2011-01-13 12:13:20 -080044 void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
Chet Haase5c13d892010-10-08 08:37:55 -070045 void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
46 void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070047 void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
48 float srcRight, float srcBottom, float dstLeft, float dstTop,
Chet Haase5c13d892010-10-08 08:37:55 -070049 float dstRight, float dstBottom, SkPaint* paint);
Romain Guy4aa90572010-09-26 18:40:37 -070050 void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
Romain Guy4bb94202010-10-12 15:59:26 -070051 const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors,
Chet Haase5c13d892010-10-08 08:37:55 -070052 float left, float top, float right, float bottom, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070053 void drawColor(int color, SkXfermode::Mode mode);
Chet Haase5c13d892010-10-08 08:37:55 -070054 void drawRect(float left, float top, float right, float bottom, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070055 void drawPath(SkPath* path, SkPaint* paint);
Chet Haase5c13d892010-10-08 08:37:55 -070056 void drawLines(float* points, int count, SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070057 void drawText(const char* text, int bytesCount, int count, float x, float y,
58 SkPaint* paint);
59
60protected:
61 void composeLayer(sp<Snapshot> current, sp<Snapshot> previous);
62
63private:
64 uint32_t mPrimitivesCount;
65
66}; // class OpenGLDebugRenderer
67
68}; // namespace uirenderer
69}; // namespace android
70
Romain Guy5b3b3522010-10-27 18:57:51 -070071#endif // ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H