Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -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_GAMMA_FONT_RENDERER_H |
| 18 | #define ANDROID_HWUI_GAMMA_FONT_RENDERER_H |
Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 19 | |
| 20 | #include <SkPaint.h> |
| 21 | |
| 22 | #include "FontRenderer.h" |
| 23 | |
| 24 | namespace android { |
| 25 | namespace uirenderer { |
| 26 | |
| 27 | struct GammaFontRenderer { |
| 28 | GammaFontRenderer(); |
| 29 | |
| 30 | FontRenderer& getFontRenderer(const SkPaint* paint); |
| 31 | |
Romain Guy | c15008e | 2010-11-10 11:59:15 -0800 | [diff] [blame] | 32 | uint32_t getFontRendererCount() const { |
| 33 | return 3; |
| 34 | } |
| 35 | |
| 36 | uint32_t getFontRendererSize(uint32_t fontRenderer) const { |
| 37 | switch (fontRenderer) { |
| 38 | case 0: |
| 39 | return mDefaultRenderer.getCacheHeight() * mDefaultRenderer.getCacheWidth(); |
| 40 | case 1: |
| 41 | return mBlackGammaRenderer.getCacheHeight() * mBlackGammaRenderer.getCacheWidth(); |
| 42 | case 2: |
| 43 | return mWhiteGammaRenderer.getCacheHeight() * mWhiteGammaRenderer.getCacheWidth(); |
| 44 | } |
| 45 | return 0; |
| 46 | } |
| 47 | |
Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 48 | private: |
| 49 | FontRenderer mDefaultRenderer; |
| 50 | FontRenderer mBlackGammaRenderer; |
| 51 | FontRenderer mWhiteGammaRenderer; |
| 52 | |
| 53 | int mBlackThreshold; |
| 54 | int mWhiteThreshold; |
| 55 | |
| 56 | uint8_t mDefault[256]; |
| 57 | uint8_t mBlackGamma[256]; |
| 58 | uint8_t mWhiteGamma[256]; |
| 59 | }; |
| 60 | |
| 61 | }; // namespace uirenderer |
| 62 | }; // namespace android |
| 63 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 64 | #endif // ANDROID_HWUI_GAMMA_FONT_RENDERER_H |