aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-12 15:41:18 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-12 15:41:18 +0000
commit1a64a54b278c07b33a3b5e8883b1fdf3173c840e (patch)
tree1def9b2c2f27395d9daeae8c81d4db23a559de70 /include/core
parentb8f9610ac6efb5426cb799ab9b1ab5d985b7b05a (diff)
add (temp) SkFontLCDConfig class to hold LCD getters/setters. This will allow
us to make SkFontHost.h private (once webkit switches to the SkFontLCDConfig api) Stage 2 is to either move this code into chrome/webkit, or change the callers to perform their own globals management. Review URL: https://codereview.chromium.org/12623011 git-svn-id: http://skia.googlecode.com/svn/trunk@8107 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkDeviceProperties.h22
-rw-r--r--include/core/SkFontLCDConfig.h59
2 files changed, 70 insertions, 11 deletions
diff --git a/include/core/SkDeviceProperties.h b/include/core/SkDeviceProperties.h
index 2c2e952f5d..4382f53958 100644
--- a/include/core/SkDeviceProperties.h
+++ b/include/core/SkDeviceProperties.h
@@ -10,8 +10,8 @@
#define SK_GAMMA_EXPONENT (0.0f)
#endif
-//TODO: get everyone to stop using SkFontHost::SetSubpixel* and remove this import.
-#include "SkFontHost.h"
+//TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and remove this import.
+#include "SkFontLCDConfig.h"
struct SkDeviceProperties {
struct Geometry {
@@ -60,25 +60,25 @@ struct SkDeviceProperties {
}
private:
- //TODO: get everyone to stop using SkFontHost::SetSubpixel* and replace these calls with constants.
- static Orientation fromOldOrientation(SkFontHost::LCDOrientation orientation) {
+ //TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and replace these calls with constants.
+ static Orientation fromOldOrientation(SkFontLCDConfig::LCDOrientation orientation) {
switch (orientation) {
- case SkFontHost::kHorizontal_LCDOrientation: return kHorizontal_Orientation;
- case SkFontHost::kVertical_LCDOrientation: return kVertical_Orientation;
+ case SkFontLCDConfig::kHorizontal_LCDOrientation: return kHorizontal_Orientation;
+ case SkFontLCDConfig::kVertical_LCDOrientation: return kVertical_Orientation;
default: return kUnknown_Orientation;
}
}
- static Layout fromOldLayout(SkFontHost::LCDOrder order) {
+ static Layout fromOldLayout(SkFontLCDConfig::LCDOrder order) {
switch (order) {
- case SkFontHost::kRGB_LCDOrder: return kRGB_Layout;
- case SkFontHost::kBGR_LCDOrder: return kBGR_Layout;
+ case SkFontLCDConfig::kRGB_LCDOrder: return kRGB_Layout;
+ case SkFontLCDConfig::kBGR_LCDOrder: return kBGR_Layout;
default: return kUnknown_Layout;
}
}
public:
static Geometry MakeDefault() {
- Orientation orientation = fromOldOrientation(SkFontHost::GetSubpixelOrientation()); //kHorizontal_Orientation
- Layout layout = fromOldLayout(SkFontHost::GetSubpixelOrder()); //kRGB_Layout
+ Orientation orientation = fromOldOrientation(SkFontLCDConfig::GetSubpixelOrientation()); //kHorizontal_Orientation
+ Layout layout = fromOldLayout(SkFontLCDConfig::GetSubpixelOrder()); //kRGB_Layout
Geometry ret = { SkToU8(orientation | layout) };
return ret;
}
diff --git a/include/core/SkFontLCDConfig.h b/include/core/SkFontLCDConfig.h
new file mode 100644
index 0000000000..009e7cde0b
--- /dev/null
+++ b/include/core/SkFontLCDConfig.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFontLCDConfig_DEFINED
+#define SkFontLCDConfig_DEFINED
+
+#include "SkTypes.h"
+
+class SkFontLCDConfig {
+public:
+ /** LCDs either have their color elements arranged horizontally or
+ vertically. When rendering subpixel glyphs we need to know which way
+ round they are.
+
+ Note, if you change this after startup, you'll need to flush the glyph
+ cache because it'll have the wrong type of masks cached.
+
+ @deprecated use SkPixelGeometry instead.
+ */
+ enum LCDOrientation {
+ kHorizontal_LCDOrientation = 0, //!< this is the default
+ kVertical_LCDOrientation = 1
+ };
+
+ /** @deprecated set on Device creation. */
+ static void SetSubpixelOrientation(LCDOrientation orientation);
+ /** @deprecated get from Device. */
+ static LCDOrientation GetSubpixelOrientation();
+
+ /** LCD color elements can vary in order. For subpixel text we need to know
+ the order which the LCDs uses so that the color fringes are in the
+ correct place.
+
+ Note, if you change this after startup, you'll need to flush the glyph
+ cache because it'll have the wrong type of masks cached.
+
+ kNONE_LCDOrder means that the subpixel elements are not spatially
+ separated in any usable fashion.
+
+ @deprecated use SkPixelGeometry instead.
+ */
+ enum LCDOrder {
+ kRGB_LCDOrder = 0, //!< this is the default
+ kBGR_LCDOrder = 1,
+ kNONE_LCDOrder = 2
+ };
+
+ /** @deprecated set on Device creation. */
+ static void SetSubpixelOrder(LCDOrder order);
+ /** @deprecated get from Device. */
+ static LCDOrder GetSubpixelOrder();
+};
+
+#endif
+