Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 22 | namespace android { |
| 23 | namespace uirenderer { |
| 24 | |
| 25 | /////////////////////////////////////////////////////////////////////////////// |
| 26 | // Renderer |
| 27 | /////////////////////////////////////////////////////////////////////////////// |
| 28 | |
| 29 | class OpenGLDebugRenderer: public OpenGLRenderer { |
| 30 | public: |
| 31 | OpenGLDebugRenderer(): mPrimitivesCount(0) { |
| 32 | } |
| 33 | |
| 34 | ~OpenGLDebugRenderer() { |
| 35 | } |
| 36 | |
Romain Guy | 6b7bd24 | 2010-10-06 19:49:23 -0700 | [diff] [blame^] | 37 | void prepare(bool opaque); |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 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); |
Romain Guy | 4aa9057 | 2010-09-26 18:40:37 -0700 | [diff] [blame] | 48 | 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 Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 51 | 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 | |
| 58 | protected: |
| 59 | void composeLayer(sp<Snapshot> current, sp<Snapshot> previous); |
| 60 | |
| 61 | private: |
| 62 | uint32_t mPrimitivesCount; |
| 63 | |
| 64 | }; // class OpenGLDebugRenderer |
| 65 | |
| 66 | }; // namespace uirenderer |
| 67 | }; // namespace android |
| 68 | |
| 69 | #endif // ANDROID_UI_OPENGL_DEBUG_RENDERER_H |