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

Unified Diff: src/core/SkPaint.cpp

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/SkDeviceProperties.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 88bde227044a76b702a7a6be0f010b48b0b33928..42144c102992e779fe0b7d883a1f43ab7c18aaaf 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1607,19 +1607,33 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
- SkDeviceProperties::Geometry geometry = deviceProperties
- ? deviceProperties->fGeometry
- : SkDeviceProperties::Geometry::MakeDefault();
if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == rec->fMaskFormat) {
- if (!geometry.isOrientationKnown() || !geometry.isLayoutKnown() || tooBigForLCD(*rec)) {
- // eeek, can't support LCD
+ if (tooBigForLCD(*rec)) {
rec->fMaskFormat = SkMask::kA8_Format;
+ flags |= SkScalerContext::kGenA8FromLCD_Flag;
} else {
- if (SkDeviceProperties::Geometry::kVertical_Orientation == geometry.getOrientation()) {
- flags |= SkScalerContext::kLCD_Vertical_Flag;
- }
- if (SkDeviceProperties::Geometry::kBGR_Layout == geometry.getLayout()) {
- flags |= SkScalerContext::kLCD_BGROrder_Flag;
+ SkPixelGeometry geometry = deviceProperties
+ ? deviceProperties->fPixelGeometry
+ : SkSurfacePropsDefaultPixelGeometry();
+ switch (geometry) {
+ case kUnknown_SkPixelGeometry:
+ // eeek, can't support LCD
+ rec->fMaskFormat = SkMask::kA8_Format;
+ flags |= SkScalerContext::kGenA8FromLCD_Flag;
+ break;
+ case kRGB_H_SkPixelGeometry:
+ // our default, do nothing.
+ break;
+ case kBGR_H_SkPixelGeometry:
+ flags |= SkScalerContext::kLCD_BGROrder_Flag;
+ break;
+ case kRGB_V_SkPixelGeometry:
+ flags |= SkScalerContext::kLCD_Vertical_Flag;
+ break;
+ case kBGR_V_SkPixelGeometry:
+ flags |= SkScalerContext::kLCD_Vertical_Flag;
+ flags |= SkScalerContext::kLCD_BGROrder_Flag;
+ break;
}
}
}
@@ -1650,13 +1664,13 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->setDeviceGamma(SK_GAMMA_EXPONENT);
rec->setPaintGamma(SK_GAMMA_EXPONENT);
} else {
- rec->setDeviceGamma(deviceProperties->fGamma);
+ rec->setDeviceGamma(deviceProperties->getGamma());
//For now always set the paint gamma equal to the device gamma.
//The math in SkMaskGamma can handle them being different,
//but it requires superluminous masks when
//Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large.
- rec->setPaintGamma(deviceProperties->fGamma);
+ rec->setPaintGamma(deviceProperties->getGamma());
}
#ifdef SK_GAMMA_CONTRAST
« no previous file with comments | « src/core/SkDeviceProperties.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698