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

Unified Diff: src/core/SkDeviceProperties.h

Issue 588143004: Introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove RenderTargetFlags from legacy mode Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDeviceProperties.h
diff --git a/src/core/SkDeviceProperties.h b/src/core/SkDeviceProperties.h
index 80e0177650baea7d114e9bc099dfc76e6db6e1f1..11ecd651570dcb4c9cfc5994b2be83a93a98f4eb 100644
--- a/src/core/SkDeviceProperties.h
+++ b/src/core/SkDeviceProperties.h
@@ -1,103 +1,26 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#ifndef SkDeviceProperties_DEFINED
#define SkDeviceProperties_DEFINED
-//TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and remove this import.
-#include "SkFontLCDConfig.h"
+#include "SkSurfacePriv.h"
struct SkDeviceProperties {
- struct Geometry {
- /** The orientation of the pixel specifies the interpretation of the
- * layout. If the orientation is horizontal, the layout is interpreted as
- * left to right. It the orientation is vertical, the layout is
- * interpreted top to bottom (rotated 90deg cw from horizontal).
- */
- enum Orientation {
- kUnknown_Orientation = 0x0,
- kKnown_Orientation = 0x2,
-
- kHorizontal_Orientation = 0x2, //!< this is the default
- kVertical_Orientation = 0x3,
-
- kOrientationMask = 0x3,
- };
-
- /** The layout of the pixel specifies its subpixel geometry.
- *
- * kUnknown_Layout means that the subpixel elements are not spatially
- * separated in any known or usable fashion.
- */
- enum Layout {
- kUnknown_Layout = 0x0,
- kKnown_Layout = 0x8,
-
- kRGB_Layout = 0x8, //!< this is the default
- kBGR_Layout = 0xC,
-
- kLayoutMask = 0xC,
- };
-
- Orientation getOrientation() {
- return static_cast<Orientation>(fGeometry & kOrientationMask);
- }
- Layout getLayout() {
- return static_cast<Layout>(fGeometry & kLayoutMask);
- }
-
- bool isOrientationKnown() {
- return SkToBool(fGeometry & kKnown_Orientation);
- }
- bool isLayoutKnown() {
- return SkToBool(fGeometry & kKnown_Layout);
- }
-
- private:
- //TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and replace these calls with constants.
- static Orientation fromOldOrientation(SkFontLCDConfig::LCDOrientation orientation) {
- switch (orientation) {
- case SkFontLCDConfig::kHorizontal_LCDOrientation: return kHorizontal_Orientation;
- case SkFontLCDConfig::kVertical_LCDOrientation: return kVertical_Orientation;
- default: return kUnknown_Orientation;
- }
- }
- static Layout fromOldLayout(SkFontLCDConfig::LCDOrder order) {
- switch (order) {
- 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(SkFontLCDConfig::GetSubpixelOrientation()); //kHorizontal_Orientation
- Layout layout = fromOldLayout(SkFontLCDConfig::GetSubpixelOrder()); //kRGB_Layout
- Geometry ret = { SkToU8(orientation | layout) };
- return ret;
- }
-
- static Geometry Make(Orientation orientation, Layout layout) {
- Geometry ret = { SkToU8(orientation | layout) };
- return ret;
- }
-
- uint8_t fGeometry;
+ enum InitType {
+ kLegacyLCD_InitType
};
+ SkDeviceProperties(InitType) : fPixelGeometry(SkSurfacePropsDefaultPixelGeometry()) {}
+ SkDeviceProperties(SkPixelGeometry geo) : fPixelGeometry(geo) {}
- static SkDeviceProperties MakeDefault() {
- SkDeviceProperties ret = { Geometry::MakeDefault(), SK_GAMMA_EXPONENT };
- return ret;
- }
-
- static SkDeviceProperties Make(Geometry geometry, SkScalar gamma) {
- SkDeviceProperties ret = { geometry, gamma };
- return ret;
- }
-
- /** Each pixel of an image will have some number of channels.
- * Can the layout of those channels be exploited? */
- Geometry fGeometry;
+ SkPixelGeometry fPixelGeometry;
- /** Represents the color space of the image. This is a woefully inadequate beginning. */
- SkScalar fGamma;
+ // read-only attribute -- until we actually store a value (future CL)
+ float getGamma() const { return SK_GAMMA_EXPONENT; }
};
#endif
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698