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

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: rebase (nasty) 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
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 "SkPoint.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 /**
27 * Describes properties and constraints of a given SkSurface. The rendering eng ine can parse these
robertphillips 2014/09/19 18:25:36 optimize.
reed1 2014/09/19 19:16:33 Done.
28 * during drawing, and can sometimes optimized its performance (e.g. disabling an expensive
29 * feature).
30 */
31 class SkSurfaceProps {
32 public:
33 enum Flags {
34 kDisallowAntiAlias_Flag = 1 << 0,
35 kDisallowDither_Flag = 1 << 1,
36 kUseDistanceFieldFonts_Flag = 1 << 2,
37 };
robertphillips 2014/09/19 18:25:37 Just one each public/private block ?
reed1 2014/09/19 19:16:33 Done.
38 private:
39 SkSurfaceProps();
40 public:
41 enum InitType {
42 kLegacyFontHost_InitType
43 };
44 SkSurfaceProps(InitType);
45 SkSurfaceProps(uint32_t flags, InitType);
46
47 // pixel geometry cannot be kLegacyLCD_SkPixelGeometry
48 SkSurfaceProps(uint32_t flags, SkPixelGeometry);
49
50 uint32_t flags() const { return fFlags; }
51 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; }
52
robertphillips 2014/09/19 18:25:36 aaDisallowed? ditherDisallowed?
reed1 2014/09/19 19:16:34 when we don't "name" the field for the getter, we
53 bool disallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag); }
54 bool disallowDither() const { return SkToBool(fFlags & kDisallowDither_Flag) ; }
55 bool useDistanceFieldFonts() const { return SkToBool(fFlags & kUseDistanceFi eldFonts_Flag); }
56
57 // Returns a copy of the specified props, or the legacy version if props is NULL.
58 static SkSurfaceProps CopyOrLegacy(const SkSurfaceProps* props) {
59 return props ? *props : SkSurfaceProps(kLegacyFontHost_InitType);
60 }
61
62 private:
63 uint32_t fFlags;
64 SkPixelGeometry fPixelGeometry;
65 };
66
67 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698