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

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

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add new file 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 unified diff | Download patch
« no previous file with comments | « include/core/SkSurface.h ('k') | include/pdf/SkPDFDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkSurfaceProps_DEFINED
9 #define SkSurfaceProps_DEFINED
10
11 #include "SkTypes.h"
12
13 /**
14 * Description of how the LCD strips are arranged for each pixel. If this is un known, or the
15 * pixels are meant to be "portable" and/or transformed before showing (e.g. ro tated, scaled)
16 * then use kUnknown_SkPixelGeometry.
17 */
18 enum SkPixelGeometry {
19 kUnknown_SkPixelGeometry,
20 kRGB_H_SkPixelGeometry,
21 kBGR_H_SkPixelGeometry,
22 kRGB_V_SkPixelGeometry,
23 kBGR_V_SkPixelGeometry,
24 };
25
26 // Returns true iff geo is a known geometry and is RGB.
27 static inline bool SkPixelGeometryIsRGB(SkPixelGeometry geo) {
28 return kRGB_H_SkPixelGeometry == geo || kRGB_V_SkPixelGeometry == geo;
29 }
30
31 // Returns true iff geo is a known geometry and is BGR.
32 static inline bool SkPixelGeometryIsBGR(SkPixelGeometry geo) {
33 return kBGR_H_SkPixelGeometry == geo || kBGR_V_SkPixelGeometry == geo;
34 }
35
36 // Returns true iff geo is a known geometry and is horizontal.
37 static inline bool SkPixelGeometryIsH(SkPixelGeometry geo) {
38 return kRGB_H_SkPixelGeometry == geo || kBGR_H_SkPixelGeometry == geo;
39 }
40
41 // Returns true iff geo is a known geometry and is vertical.
42 static inline bool SkPixelGeometryIsV(SkPixelGeometry geo) {
43 return kRGB_V_SkPixelGeometry == geo || kBGR_V_SkPixelGeometry == geo;
44 }
45
46 /**
47 * Describes properties and constraints of a given SkSurface. The rendering eng ine can parse these
48 * during drawing, and can sometimes optimize its performance (e.g. disabling a n expensive
49 * feature).
50 */
51 class SkSurfaceProps {
52 public:
53 enum Flags {
54 kDisallowAntiAlias_Flag = 1 << 0,
55 kDisallowDither_Flag = 1 << 1,
56 kUseDistanceFieldFonts_Flag = 1 << 2,
57 };
58 SkSurfaceProps(uint32_t flags, SkPixelGeometry);
59
60 enum InitType {
61 kLegacyFontHost_InitType
62 };
63 SkSurfaceProps(InitType);
64 SkSurfaceProps(uint32_t flags, InitType);
65
66 uint32_t flags() const { return fFlags; }
67 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; }
68
69 bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag ); }
70 bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Fla g); }
71 bool isUseDistanceFieldFonts() const { return SkToBool(fFlags & kUseDistance FieldFonts_Flag); }
72
73 private:
74 SkSurfaceProps();
75
76 uint32_t fFlags;
77 SkPixelGeometry fPixelGeometry;
78 };
79
80 #endif
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | include/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698