blob: 37fac93f033d2a94502bfa1c0595236a53ceffa5 [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#ifndef ANDROID_UI_OPENGL_DEBUG_RENDERER_H
18#define ANDROID_UI_OPENGL_DEBUG_RENDERER_H
19
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
37 void prepare();
38 void finish();
39
40 int saveLayer(float left, float top, float right, float bottom,
41 const SkPaint* p, int flags);
42
43 void drawBitmap(SkBitmap* bitmap, float left, float top, const SkPaint* paint);
44 void drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix, const SkPaint* paint);
45 void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
46 float srcRight, float srcBottom, float dstLeft, float dstTop,
47 float dstRight, float dstBottom, const SkPaint* paint);
48 void drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, float left, float top,
49 float right, float bottom, const SkPaint* paint);
50 void drawColor(int color, SkXfermode::Mode mode);
51 void drawRect(float left, float top, float right, float bottom, const SkPaint* paint);
52 void drawPath(SkPath* path, SkPaint* paint);
53 void drawLines(float* points, int count, const SkPaint* paint);
54 void drawText(const char* text, int bytesCount, int count, float x, float y,
55 SkPaint* paint);
56
57protected:
58 void composeLayer(sp<Snapshot> current, sp<Snapshot> previous);
59
60private:
61 uint32_t mPrimitivesCount;
62
63}; // class OpenGLDebugRenderer
64
65}; // namespace uirenderer
66}; // namespace android
67
68#endif // ANDROID_UI_OPENGL_DEBUG_RENDERER_H