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 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 17 | #ifndef ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H |
| 18 | #define ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 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 | 885153e | 2011-01-27 18:34:41 -0800 | [diff] [blame] | 37 | void prepareDirty(float left, float top, float right, float bottom, 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, |
Chet Haase | 5c13d89 | 2010-10-08 08:37:55 -0700 | [diff] [blame] | 41 | SkPaint* p, int flags); |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 42 | |
Chet Haase | daf98e9 | 2011-01-10 14:10:36 -0800 | [diff] [blame] | 43 | bool drawDisplayList(DisplayList* displayList, uint32_t level = 0); |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 44 | void drawLayer(Layer* layer, float x, float y, SkPaint* paint); |
Chet Haase | 5c13d89 | 2010-10-08 08:37:55 -0700 | [diff] [blame] | 45 | void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); |
| 46 | void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint); |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 47 | void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop, |
| 48 | float srcRight, float srcBottom, float dstLeft, float dstTop, |
Chet Haase | 5c13d89 | 2010-10-08 08:37:55 -0700 | [diff] [blame] | 49 | float dstRight, float dstBottom, SkPaint* paint); |
Romain Guy | 4aa9057 | 2010-09-26 18:40:37 -0700 | [diff] [blame] | 50 | void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs, |
Romain Guy | 4bb9420 | 2010-10-12 15:59:26 -0700 | [diff] [blame] | 51 | const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors, |
Chet Haase | 5c13d89 | 2010-10-08 08:37:55 -0700 | [diff] [blame] | 52 | float left, float top, float right, float bottom, SkPaint* paint); |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 53 | void drawColor(int color, SkXfermode::Mode mode); |
Chet Haase | 5c13d89 | 2010-10-08 08:37:55 -0700 | [diff] [blame] | 54 | void drawRect(float left, float top, float right, float bottom, SkPaint* paint); |
Romain Guy | 885153e | 2011-01-27 18:34:41 -0800 | [diff] [blame] | 55 | void drawRoundRect(float left, float top, float right, float bottom, |
| 56 | float rx, float ry, SkPaint* paint); |
| 57 | void drawCircle(float x, float y, float radius, SkPaint* paint); |
| 58 | void drawOval(float left, float top, float right, float bottom, SkPaint* paint); |
| 59 | void drawArc(float left, float top, float right, float bottom, |
| 60 | float startAngle, float sweepAngle, bool useCenter, SkPaint* paint); |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 61 | void drawPath(SkPath* path, SkPaint* paint); |
Chet Haase | 5c13d89 | 2010-10-08 08:37:55 -0700 | [diff] [blame] | 62 | void drawLines(float* points, int count, SkPaint* paint); |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 63 | void drawText(const char* text, int bytesCount, int count, float x, float y, |
| 64 | SkPaint* paint); |
| 65 | |
| 66 | protected: |
| 67 | void composeLayer(sp<Snapshot> current, sp<Snapshot> previous); |
| 68 | |
| 69 | private: |
| 70 | uint32_t mPrimitivesCount; |
| 71 | |
| 72 | }; // class OpenGLDebugRenderer |
| 73 | |
| 74 | }; // namespace uirenderer |
| 75 | }; // namespace android |
| 76 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 77 | #endif // ANDROID_HWUI_OPENGL_DEBUG_RENDERER_H |