Chromium Code Reviews| OLD | NEW |
|---|---|
| (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, | |
|
bungeman-skia
2014/09/19 18:59:12
I'd like this one (Unknown) to come last, simply b
reed1
2014/09/19 19:16:34
I'd rather add helpers to answer those predicates.
| |
| 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 | |
| 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 }; | |
| 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 | |
|
bungeman-skia
2014/09/19 18:59:11
kLegacyLCD_SkPixelGeometry doesn't exist anymore?
reed1
2014/09/19 19:16:34
Done.
| |
| 48 SkSurfaceProps(uint32_t flags, SkPixelGeometry); | |
| 49 | |
| 50 uint32_t flags() const { return fFlags; } | |
| 51 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; } | |
| 52 | |
| 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); } | |
|
bungeman-skia
2014/09/19 18:59:12
It seems like these should be named 'disallowsX' a
reed1
2014/09/19 19:16:34
isDisallowAA -- to match the pattern we use in SkP
| |
| 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 | |
| OLD | NEW |