Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: trunk/include/core/SkDeviceProperties.h

Issue 12623011: add (temp) SkFontLCDConfig class to hold LCD getters/setters. This will allow (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/include/core/SkFontHost.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef SkDeviceProperties_DEFINED 1 #ifndef SkDeviceProperties_DEFINED
2 #define SkDeviceProperties_DEFINED 2 #define SkDeviceProperties_DEFINED
3 3
4 #ifndef SK_GAMMA_EXPONENT 4 #ifndef SK_GAMMA_EXPONENT
5 #define SK_GAMMA_EXPONENT (2.2f) 5 #define SK_GAMMA_EXPONENT (2.2f)
6 #endif 6 #endif
7 7
8 #ifdef SK_GAMMA_SRGB 8 #ifdef SK_GAMMA_SRGB
9 #undef SK_GAMMA_EXPONENT 9 #undef SK_GAMMA_EXPONENT
10 #define SK_GAMMA_EXPONENT (0.0f) 10 #define SK_GAMMA_EXPONENT (0.0f)
11 #endif 11 #endif
12 12
13 //TODO: get everyone to stop using SkFontHost::SetSubpixel* and remove this impo rt. 13 //TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and remove this import.
14 #include "SkFontHost.h" 14 #include "SkFontLCDConfig.h"
15 15
16 struct SkDeviceProperties { 16 struct SkDeviceProperties {
17 struct Geometry { 17 struct Geometry {
18 /** The orientation of the pixel specifies the interpretation of the 18 /** The orientation of the pixel specifies the interpretation of the
19 * layout. If the orientation is horizontal, the layout is interpreted a s 19 * layout. If the orientation is horizontal, the layout is interpreted a s
20 * left to right. It the orientation is vertical, the layout is 20 * left to right. It the orientation is vertical, the layout is
21 * interpreted top to bottom (rotated 90deg cw from horizontal). 21 * interpreted top to bottom (rotated 90deg cw from horizontal).
22 */ 22 */
23 enum Orientation { 23 enum Orientation {
24 kUnknown_Orientation = 0x0, 24 kUnknown_Orientation = 0x0,
(...skipping 28 matching lines...) Expand all
53 } 53 }
54 54
55 bool isOrientationKnown() { 55 bool isOrientationKnown() {
56 return SkToBool(fGeometry & kKnown_Orientation); 56 return SkToBool(fGeometry & kKnown_Orientation);
57 } 57 }
58 bool isLayoutKnown() { 58 bool isLayoutKnown() {
59 return SkToBool(fGeometry & kKnown_Layout); 59 return SkToBool(fGeometry & kKnown_Layout);
60 } 60 }
61 61
62 private: 62 private:
63 //TODO: get everyone to stop using SkFontHost::SetSubpixel* and replace these calls with constants. 63 //TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and rep lace these calls with constants.
64 static Orientation fromOldOrientation(SkFontHost::LCDOrientation orienta tion) { 64 static Orientation fromOldOrientation(SkFontLCDConfig::LCDOrientation or ientation) {
65 switch (orientation) { 65 switch (orientation) {
66 case SkFontHost::kHorizontal_LCDOrientation: return kHorizontal_Orie ntation; 66 case SkFontLCDConfig::kHorizontal_LCDOrientation: return kHorizontal _Orientation;
67 case SkFontHost::kVertical_LCDOrientation: return kVertical_Orientat ion; 67 case SkFontLCDConfig::kVertical_LCDOrientation: return kVertical_Ori entation;
68 default: return kUnknown_Orientation; 68 default: return kUnknown_Orientation;
69 } 69 }
70 } 70 }
71 static Layout fromOldLayout(SkFontHost::LCDOrder order) { 71 static Layout fromOldLayout(SkFontLCDConfig::LCDOrder order) {
72 switch (order) { 72 switch (order) {
73 case SkFontHost::kRGB_LCDOrder: return kRGB_Layout; 73 case SkFontLCDConfig::kRGB_LCDOrder: return kRGB_Layout;
74 case SkFontHost::kBGR_LCDOrder: return kBGR_Layout; 74 case SkFontLCDConfig::kBGR_LCDOrder: return kBGR_Layout;
75 default: return kUnknown_Layout; 75 default: return kUnknown_Layout;
76 } 76 }
77 } 77 }
78 public: 78 public:
79 static Geometry MakeDefault() { 79 static Geometry MakeDefault() {
80 Orientation orientation = fromOldOrientation(SkFontHost::GetSubpixel Orientation()); //kHorizontal_Orientation 80 Orientation orientation = fromOldOrientation(SkFontLCDConfig::GetSub pixelOrientation()); //kHorizontal_Orientation
81 Layout layout = fromOldLayout(SkFontHost::GetSubpixelOrder()); //kRG B_Layout 81 Layout layout = fromOldLayout(SkFontLCDConfig::GetSubpixelOrder()); //kRGB_Layout
82 Geometry ret = { SkToU8(orientation | layout) }; 82 Geometry ret = { SkToU8(orientation | layout) };
83 return ret; 83 return ret;
84 } 84 }
85 85
86 static Geometry Make(Orientation orientation, Layout layout) { 86 static Geometry Make(Orientation orientation, Layout layout) {
87 Geometry ret = { SkToU8(orientation | layout) }; 87 Geometry ret = { SkToU8(orientation | layout) };
88 return ret; 88 return ret;
89 } 89 }
90 90
91 uint8_t fGeometry; 91 uint8_t fGeometry;
(...skipping 11 matching lines...) Expand all
103 103
104 /** Each pixel of an image will have some number of channels. 104 /** Each pixel of an image will have some number of channels.
105 * Can the layout of those channels be exploited? */ 105 * Can the layout of those channels be exploited? */
106 Geometry fGeometry; 106 Geometry fGeometry;
107 107
108 /** Represents the color space of the image. This is a woefully inadequate b eginning. */ 108 /** Represents the color space of the image. This is a woefully inadequate b eginning. */
109 SkScalar fGamma; 109 SkScalar fGamma;
110 }; 110 };
111 111
112 #endif 112 #endif
OLDNEW
« no previous file with comments | « no previous file | trunk/include/core/SkFontHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698