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

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

Issue 14884010: Mask orientation and layout correctly. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add comment about CoreGraphics 'normal' hinting. Created 7 years, 7 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 | « gyp/gmslides.gypi ('k') | src/ports/SkFontHost_mac.cpp » ('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 SkFontLCDConfig::SetSubpixel* and remove this import. 13 //TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and remove this import.
14 #include "SkFontLCDConfig.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,
25 kKnown_Orientation = 0x2, 25 kKnown_Orientation = 0x2,
26 26
27 kHorizontal_Orientation = 0x2, //!< this is the default 27 kHorizontal_Orientation = 0x2, //!< this is the default
clefru 2013/05/07 14:07:57 How is this "default", when we don't default to it
bungeman-skia 2013/05/07 14:24:31 When you 'MakeDefault' this is the value you get.
28 kVertical_Orientation = 0x3, 28 kVertical_Orientation = 0x3,
29 29
30 kOrientationMask = 0x3, 30 kOrientationMask = 0x3,
31 }; 31 };
32 32
33 /** The layout of the pixel specifies its subpixel geometry. 33 /** The layout of the pixel specifies its subpixel geometry.
34 * 34 *
35 * kUnknown_Layout means that the subpixel elements are not spatially 35 * kUnknown_Layout means that the subpixel elements are not spatially
36 * separated in any known or usable fashion. 36 * separated in any known or usable fashion.
37 */ 37 */
38 enum Layout { 38 enum Layout {
39 kUnknown_Layout = 0x0, 39 kUnknown_Layout = 0x0,
40 kKnown_Layout = 0x8, 40 kKnown_Layout = 0x8,
41 41
42 kRGB_Layout = 0x8, //!< this is the default 42 kRGB_Layout = 0x8, //!< this is the default
clefru 2013/05/07 14:07:57 Same
43 kBGR_Layout = 0xC, 43 kBGR_Layout = 0xC,
44 44
45 kLayoutMask = 0xC, 45 kLayoutMask = 0xC,
46 }; 46 };
47 47
48 Orientation getOrientation() { 48 Orientation getOrientation() {
49 return static_cast<Orientation>(fGeometry | kOrientationMask); 49 return static_cast<Orientation>(fGeometry & kOrientationMask);
50 } 50 }
51 Layout getLayout() { 51 Layout getLayout() {
52 return static_cast<Layout>(fGeometry | kLayoutMask); 52 return static_cast<Layout>(fGeometry & kLayoutMask);
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:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 | « gyp/gmslides.gypi ('k') | src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698