blob: 96d960cf22968b00d49e164714d7e897aaf25bb4 [file] [log] [blame]
Romain Guyb45c0c92010-08-26 20:35:23 -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
Romain Guy5b3b3522010-10-27 18:57:51 -070017#ifndef ANDROID_HWUI_GAMMA_FONT_RENDERER_H
18#define ANDROID_HWUI_GAMMA_FONT_RENDERER_H
Romain Guyb45c0c92010-08-26 20:35:23 -070019
20#include <SkPaint.h>
21
22#include "FontRenderer.h"
23
24namespace android {
25namespace uirenderer {
26
27struct GammaFontRenderer {
28 GammaFontRenderer();
29
30 FontRenderer& getFontRenderer(const SkPaint* paint);
31
Romain Guyc15008e2010-11-10 11:59:15 -080032 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 Guyb45c0c92010-08-26 20:35:23 -070048private:
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 Guy5b3b3522010-10-27 18:57:51 -070064#endif // ANDROID_HWUI_GAMMA_FONT_RENDERER_H