blob: 2ac19aee759ccc685f98e52486f22a026c73fa9b [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
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,
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);
Romain Guy4aa90572010-09-26 18:40:37 -070048 void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
49 uint32_t width, uint32_t height, float left, float top, float right, float bottom,
50 const SkPaint* paint);
Romain Guye2d345e2010-09-24 18:39:22 -070051 void drawColor(int color, SkXfermode::Mode mode);
52 void drawRect(float left, float top, float right, float bottom, const SkPaint* paint);
53 void drawPath(SkPath* path, SkPaint* paint);
54 void drawLines(float* points, int count, const SkPaint* paint);
55 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
69#endif // ANDROID_UI_OPENGL_DEBUG_RENDERER_H