aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/core.gypi2
-rw-r--r--include/core/SkDevice.h38
-rw-r--r--include/core/SkDeviceProperties.h112
-rw-r--r--include/core/SkFontHost.h8
-rw-r--r--include/core/SkPaint.h5
-rw-r--r--src/core/SkDevice.cpp36
-rw-r--r--src/core/SkDraw.cpp4
-rw-r--r--src/core/SkGlyphCache.h7
-rw-r--r--src/core/SkPaint.cpp92
-rw-r--r--src/core/SkScalerContext.h3
-rw-r--r--src/pdf/SkPDFDevice.cpp2
-rw-r--r--src/pdf/SkPDFFont.cpp2
-rw-r--r--src/utils/SkDeferredCanvas.cpp6
13 files changed, 261 insertions, 56 deletions
diff --git a/gyp/core.gypi b/gyp/core.gypi
index 483064596a..1dc1392bdc 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -141,6 +141,7 @@
'<(skia_src_path)/core/SkRTree.cpp',
'<(skia_src_path)/core/SkScalar.cpp',
'<(skia_src_path)/core/SkScalerContext.cpp',
+ '<(skia_src_path)/core/SkScalerContext.h',
'<(skia_src_path)/core/SkScan.cpp',
'<(skia_src_path)/core/SkScan.h',
'<(skia_src_path)/core/SkScanPriv.h',
@@ -210,6 +211,7 @@
'<(skia_include_path)/core/SkData.h',
'<(skia_include_path)/core/SkDeque.h',
'<(skia_include_path)/core/SkDevice.h',
+ '<(skia_include_path)/core/SkDeviceProperties.h',
'<(skia_include_path)/core/SkDither.h',
'<(skia_include_path)/core/SkDraw.h',
'<(skia_include_path)/core/SkDrawFilter.h',
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 5c32f768a5..81bbf43cb4 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -14,6 +14,7 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkColor.h"
+#include "SkDeviceProperties.h"
class SkClipStack;
class SkDraw;
@@ -37,6 +38,13 @@ public:
SkDevice(const SkBitmap& bitmap);
/**
+ * Construct a new device with the specified bitmap as its backend. It is
+ * valid for the bitmap to have no pixels associated with it. In that case,
+ * any drawing to this device will have no effect.
+ */
+ SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
+
+ /**
* Create a new raster device and have the pixels be automatically
* allocated. The rowBytes of the device will be computed automatically
* based on the config and the width.
@@ -51,6 +59,23 @@ public:
*/
SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false);
+ /**
+ * Create a new raster device and have the pixels be automatically
+ * allocated. The rowBytes of the device will be computed automatically
+ * based on the config and the width.
+ *
+ * @param config The desired config for the pixels. If the request cannot
+ * be met, the closest matching support config will be used.
+ * @param width width (in pixels) of the device
+ * @param height height (in pixels) of the device
+ * @param isOpaque Set to true if it is known that all of the pixels will
+ * be drawn to opaquely. Used as an accelerator when drawing
+ * these pixels to another device.
+ * @param deviceProperties Properties which affect compositing.
+ */
+ SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties);
+
virtual ~SkDevice();
/**
@@ -84,6 +109,12 @@ public:
*/
virtual int height() const { return fBitmap.height(); }
+ /** Return the image properties of the device. */
+ virtual const SkDeviceProperties& getDeviceProperties() const {
+ //Currently, all the properties are leaky.
+ return fLeakyProperties;
+ }
+
/**
* Return the bounds of the device in the coordinate space of the root
* canvas. The root device will have its top-left at 0,0, but other devices
@@ -418,6 +449,13 @@ private:
SkBitmap fBitmap;
SkIPoint fOrigin;
SkMetaData* fMetaData;
+ /**
+ * Leaky properties are those which the device should be applying but it isn't.
+ * These properties will be applied by the draw, when and as it can.
+ * If the device does handle a property, that property should be set to the identity value
+ * for that property, effectively making it non-leaky.
+ */
+ SkDeviceProperties fLeakyProperties;
#ifdef SK_DEBUG
bool fAttachedToCanvas;
diff --git a/include/core/SkDeviceProperties.h b/include/core/SkDeviceProperties.h
new file mode 100644
index 0000000000..fcab9ad5c8
--- /dev/null
+++ b/include/core/SkDeviceProperties.h
@@ -0,0 +1,112 @@
+#ifndef SkDeviceProperties_DEFINED
+#define SkDeviceProperties_DEFINED
+
+#ifndef SK_GAMMA_EXPONENT
+ #define SK_GAMMA_EXPONENT (2.2f)
+#endif
+
+#ifdef SK_GAMMA_SRGB
+ #undef SK_GAMMA_EXPONENT
+ #define SK_GAMMA_EXPONENT (0.0f)
+#endif
+
+//TODO: get everyone to stop using SkFontHost::SetSubpixel* and remove this import.
+#include "SkFontHost.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 fGeometry & kKnown_Orientation;
+ }
+ bool isLayoutKnown() {
+ return fGeometry & kKnown_Layout;
+ }
+
+ private:
+ //TODO: get everyone to stop using SkFontHost::SetSubpixel* and replace these calls with constants.
+ static Orientation fromOldOrientation(SkFontHost::LCDOrientation orientation) {
+ switch (orientation) {
+ case SkFontHost::kHorizontal_LCDOrientation: return kHorizontal_Orientation;
+ case SkFontHost::kVertical_LCDOrientation: return kVertical_Orientation;
+ default: return kUnknown_Orientation;
+ }
+ }
+ static Layout fromOldLayout(SkFontHost::LCDOrder order) {
+ switch (order) {
+ case SkFontHost::kRGB_LCDOrder: return kRGB_Layout;
+ case SkFontHost::kBGR_LCDOrder: return kBGR_Layout;
+ default: return kUnknown_Layout;
+ }
+ }
+ public:
+ static Geometry MakeDefault() {
+ Orientation orientation = fromOldOrientation(SkFontHost::GetSubpixelOrientation()); //kHorizontal_Orientation
+ Layout layout = fromOldLayout(SkFontHost::GetSubpixelOrder()); //kRGB_Layout
+ Geometry ret = { orientation | layout };
+ return ret;
+ }
+
+ static Geometry Make(Orientation orientation, Layout layout) {
+ Geometry ret = { orientation | layout };
+ return ret;
+ }
+
+ uint8_t fGeometry;
+ };
+
+ 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;
+
+ /** Represents the color space of the image. This is a woefully inadequate beginning. */
+ SkScalar fGamma;
+};
+
+#endif
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index 737b2eb4c4..3c2ed09249 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -236,13 +236,17 @@ public:
Note, if you change this after startup, you'll need to flush the glyph
cache because it'll have the wrong type of masks cached.
+
+ @deprecated use SkPixelGeometry instead.
*/
enum LCDOrientation {
kHorizontal_LCDOrientation = 0, //!< this is the default
kVertical_LCDOrientation = 1
};
+ /** @deprecated set on Device creation. */
static void SetSubpixelOrientation(LCDOrientation orientation);
+ /** @deprecated get from Device. */
static LCDOrientation GetSubpixelOrientation();
/** LCD color elements can vary in order. For subpixel text we need to know
@@ -254,6 +258,8 @@ public:
kNONE_LCDOrder means that the subpixel elements are not spatially
separated in any usable fashion.
+
+ @deprecated use SkPixelGeometry instead.
*/
enum LCDOrder {
kRGB_LCDOrder = 0, //!< this is the default
@@ -261,7 +267,9 @@ public:
kNONE_LCDOrder = 2
};
+ /** @deprecated set on Device creation. */
static void SetSubpixelOrder(LCDOrder order);
+ /** @deprecated get from Device. */
static LCDOrder GetSubpixelOrder();
#ifdef SK_BUILD_FOR_ANDROID
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 16b1b84c90..8c4a7a4ef3 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -19,6 +19,7 @@ class SkAnnotation;
class SkAutoGlyphCache;
class SkColorFilter;
class SkDescriptor;
+struct SkDeviceProperties;
class SkFlattenableReadBuffer;
class SkFlattenableWriteBuffer;
struct SkGlyph;
@@ -962,9 +963,9 @@ private:
SkScalar measure_text(SkGlyphCache*, const char* text, size_t length,
int* count, SkRect* bounds) const;
- SkGlyphCache* detachCache(const SkMatrix*) const;
+ SkGlyphCache* detachCache(const SkDeviceProperties* deviceProperties, const SkMatrix*) const;
- void descriptorProc(const SkMatrix* deviceMatrix,
+ void descriptorProc(const SkDeviceProperties* deviceProperties, const SkMatrix* deviceMatrix,
void (*proc)(const SkDescriptor*, void*),
void* context, bool ignoreGamma = false) const;
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index b3209b37b7..c79b4f8aa3 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -6,6 +6,7 @@
* found in the LICENSE file.
*/
#include "SkDevice.h"
+#include "SkDeviceProperties.h"
#include "SkDraw.h"
#include "SkImageFilter.h"
#include "SkMetaData.h"
@@ -23,7 +24,17 @@ SK_DEFINE_INST_COUNT(SkDevice)
///////////////////////////////////////////////////////////////////////////////
SkDevice::SkDevice(const SkBitmap& bitmap)
- : fBitmap(bitmap)
+ : fBitmap(bitmap), fLeakyProperties(SkDeviceProperties::MakeDefault())
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
+}
+
+SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
+ : fBitmap(bitmap), fLeakyProperties(deviceProperties)
#ifdef SK_DEBUG
, fAttachedToCanvas(false)
#endif
@@ -33,8 +44,27 @@ SkDevice::SkDevice(const SkBitmap& bitmap)
}
SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque)
+ : fLeakyProperties(SkDeviceProperties::MakeDefault())
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
+
+ fBitmap.setConfig(config, width, height);
+ fBitmap.allocPixels();
+ fBitmap.setIsOpaque(isOpaque);
+ if (!isOpaque) {
+ fBitmap.eraseColor(SK_ColorTRANSPARENT);
+ }
+}
+
+SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties)
+ : fLeakyProperties(deviceProperties)
#ifdef SK_DEBUG
- : fAttachedToCanvas(false)
+ , fAttachedToCanvas(false)
#endif
{
fOrigin.setZero();
@@ -77,7 +107,7 @@ SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque,
Usage usage) {
- return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque));
+ return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque, fLeakyProperties));
}
SkMetaData& SkDevice::getMetaData() {
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index cf638e9b4c..ad8a0be8c0 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1658,7 +1658,7 @@ void SkDraw::drawText(const char text[], size_t byteLength,
const SkMatrix* matrix = fMatrix;
- SkAutoGlyphCache autoCache(paint, matrix);
+ SkAutoGlyphCache autoCache(paint, &fDevice->fLeakyProperties, matrix);
SkGlyphCache* cache = autoCache.getCache();
// transform our starting point
@@ -1852,7 +1852,7 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
const SkMatrix* matrix = fMatrix;
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
- SkAutoGlyphCache autoCache(paint, matrix);
+ SkAutoGlyphCache autoCache(paint, &fDevice->fLeakyProperties, matrix);
SkGlyphCache* cache = autoCache.getCache();
SkAAClipBlitterWrapper wrapper;
diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h
index 472bcde522..8509011f0a 100644
--- a/src/core/SkGlyphCache.h
+++ b/src/core/SkGlyphCache.h
@@ -18,6 +18,7 @@
#include "SkTemplates.h"
#include "SkTDArray.h"
+struct SkDeviceProperties;
class SkPaint;
class SkGlyphCache_Globals;
@@ -275,8 +276,10 @@ public:
SkAutoGlyphCache(const SkDescriptor* desc) {
fCache = SkGlyphCache::DetachCache(desc);
}
- SkAutoGlyphCache(const SkPaint& paint, const SkMatrix* matrix) {
- fCache = paint.detachCache(matrix);
+ SkAutoGlyphCache(const SkPaint& paint,
+ const SkDeviceProperties* deviceProperties,
+ const SkMatrix* matrix) {
+ fCache = paint.detachCache(deviceProperties, matrix);
}
~SkAutoGlyphCache() {
if (fCache) {
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 8270e3b4dd..754098cca5 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -9,6 +9,7 @@
#include "SkPaint.h"
#include "SkAnnotation.h"
#include "SkColorFilter.h"
+#include "SkDeviceProperties.h"
#include "SkFontHost.h"
#include "SkImageFilter.h"
#include "SkMaskFilter.h"
@@ -476,7 +477,7 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
return byteLength >> 1;
}
- SkAutoGlyphCache autoCache(*this, NULL);
+ SkAutoGlyphCache autoCache(*this, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
const char* text = (const char*)textData;
@@ -530,7 +531,7 @@ bool SkPaint::containsText(const void* textData, size_t byteLength) const {
return true;
}
- SkAutoGlyphCache autoCache(*this, NULL);
+ SkAutoGlyphCache autoCache(*this, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
switch (this->getTextEncoding()) {
@@ -580,7 +581,7 @@ void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count,
SkASSERT(glyphs != NULL);
SkASSERT(textData != NULL);
- SkAutoGlyphCache autoCache(*this, NULL);
+ SkAutoGlyphCache autoCache(*this, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
for (int index = 0; index < count; index++) {
@@ -1048,7 +1049,7 @@ SkScalar SkPaint::measureText(const void* textData, size_t length,
zoomPtr = &zoomMatrix;
}
- SkAutoGlyphCache autoCache(*this, zoomPtr);
+ SkAutoGlyphCache autoCache(*this, NULL, zoomPtr);
SkGlyphCache* cache = autoCache.getCache();
SkScalar width = 0;
@@ -1124,7 +1125,7 @@ size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
((SkPaint*)this)->setTextSize(SkIntToScalar(kCanonicalTextSizeForPaths));
}
- SkAutoGlyphCache autoCache(*this, NULL);
+ SkAutoGlyphCache autoCache(*this, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc = this->getMeasureCacheProc(tbd, false);
@@ -1212,7 +1213,7 @@ SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const {
metrics = &storage;
}
- this->descriptorProc(zoomPtr, FontMetricsDescProc, metrics, true);
+ this->descriptorProc(NULL, zoomPtr, FontMetricsDescProc, metrics, true);
if (scale) {
metrics->fTop = SkScalarMul(metrics->fTop, scale);
@@ -1254,7 +1255,7 @@ int SkPaint::getTextWidths(const void* textData, size_t byteLength,
((SkPaint*)this)->setTextSize(SkIntToScalar(kCanonicalTextSizeForPaths));
}
- SkAutoGlyphCache autoCache(*this, NULL);
+ SkAutoGlyphCache autoCache(*this, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
SkMeasureCacheProc glyphCacheProc;
glyphCacheProc = this->getMeasureCacheProc(kForward_TextBufferDirection,
@@ -1487,22 +1488,10 @@ static SkScalar sk_relax(SkScalar x) {
#endif
}
-//#define SK_GAMMA_SRGB
-#ifndef SK_GAMMA_CONTRAST
- /**
- * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise.
- * With lower values small text appears washed out (though correctly so).
- * With higher values lcd fringing is worse and the smoothing effect of
- * partial coverage is diminished.
- */
- #define SK_GAMMA_CONTRAST (0.5f)
-#endif
-#ifndef SK_GAMMA_EXPONENT
- #define SK_GAMMA_EXPONENT (2.2f)
-#endif
-
void SkScalerContext::MakeRec(const SkPaint& paint,
- const SkMatrix* deviceMatrix, Rec* rec) {
+ const SkDeviceProperties* deviceProperties,
+ const SkMatrix* deviceMatrix,
+ Rec* rec) {
SkASSERT(deviceMatrix == NULL || !deviceMatrix->hasPerspective());
SkTypeface* typeface = paint.getTypeface();
@@ -1572,19 +1561,18 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
- if (SkMask::kLCD16_Format == rec->fMaskFormat ||
- SkMask::kLCD32_Format == rec->fMaskFormat)
- {
- SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder();
- SkFontHost::LCDOrientation orient = SkFontHost::GetSubpixelOrientation();
- if (SkFontHost::kNONE_LCDOrder == order || tooBigForLCD(*rec)) {
+ 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
rec->fMaskFormat = SkMask::kA8_Format;
} else {
- if (SkFontHost::kVertical_LCDOrientation == orient) {
+ if (SkDeviceProperties::Geometry::kVertical_Orientation == geometry.getOrientation()) {
flags |= SkScalerContext::kLCD_Vertical_Flag;
}
- if (SkFontHost::kBGR_LCDOrder == order) {
+ if (SkDeviceProperties::Geometry::kBGR_Layout == geometry.getLayout()) {
flags |= SkScalerContext::kLCD_BGROrder_Flag;
}
}
@@ -1611,14 +1599,32 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
rec->setHinting(computeHinting(paint));
rec->setLuminanceColor(computeLuminanceColor(paint));
-#ifdef SK_GAMMA_SRGB
- rec->setDeviceGamma(0);
- rec->setPaintGamma(0);
+
+ if (NULL == deviceProperties) {
+ rec->setDeviceGamma(SK_GAMMA_EXPONENT);
+ rec->setPaintGamma(SK_GAMMA_EXPONENT);
+ } else {
+ rec->setDeviceGamma(deviceProperties->fGamma);
+
+ //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);
+ }
+
+#ifdef SK_GAMMA_CONTRAST
+ rec->setContrast(SK_GAMMA_CONTRAST);
#else
- rec->setDeviceGamma(SkFloatToScalar(SK_GAMMA_EXPONENT));
- rec->setPaintGamma(SkFloatToScalar(SK_GAMMA_EXPONENT));
+ /**
+ * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise.
+ * With lower values small text appears washed out (though correctly so).
+ * With higher values lcd fringing is worse and the smoothing effect of
+ * partial coverage is diminished.
+ */
+ rec->setContrast(SkFloatToScalar(0.5f));
#endif
- rec->setContrast(SkFloatToScalar(SK_GAMMA_CONTRAST));
+
rec->fReservedAlign = 0;
/* Allow the fonthost to modify our rec before we use it as a key into the
@@ -1712,7 +1718,7 @@ void SkScalerContext::PostMakeRec(const SkPaint& paint, SkScalerContext::Rec* re
}
case SkMask::kBW_Format:
// No need to differentiate gamma if we're BW
- rec->setLuminanceColor(0);
+ rec->ignorePreBlend();
break;
}
}
@@ -1730,12 +1736,13 @@ void SkScalerContext::PostMakeRec(const SkPaint& paint, SkScalerContext::Rec* re
* would be for the fontcache lookup to know to ignore the luminance field
* entirely, but not sure how to do that and keep it fast.
*/
-void SkPaint::descriptorProc(const SkMatrix* deviceMatrix,
+void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties,
+ const SkMatrix* deviceMatrix,
void (*proc)(const SkDescriptor*, void*),
void* context, bool ignoreGamma) const {
SkScalerContext::Rec rec;
- SkScalerContext::MakeRec(*this, deviceMatrix, &rec);
+ SkScalerContext::MakeRec(*this, deviceProperties, deviceMatrix, &rec);
if (ignoreGamma) {
rec.setLuminanceColor(0);
}
@@ -1846,9 +1853,10 @@ void SkPaint::descriptorProc(const SkMatrix* deviceMatrix,
proc(desc, context);
}
-SkGlyphCache* SkPaint::detachCache(const SkMatrix* deviceMatrix) const {
+SkGlyphCache* SkPaint::detachCache(const SkDeviceProperties* deviceProperties,
+ const SkMatrix* deviceMatrix) const {
SkGlyphCache* cache;
- this->descriptorProc(deviceMatrix, DetachDescProc, &cache);
+ this->descriptorProc(deviceProperties, deviceMatrix, DetachDescProc, &cache, false);
return cache;
}
@@ -2241,7 +2249,7 @@ SkTextToPathIter::SkTextToPathIter( const char text[], size_t length,
fPaint.setPathEffect(NULL);
}
- fCache = fPaint.detachCache(NULL);
+ fCache = fPaint.detachCache(NULL, NULL);
SkPaint::Style style = SkPaint::kFill_Style;
SkPathEffect* pe = NULL;
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 05d5bc013d..f30bbd3eb6 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -202,7 +202,8 @@ public:
}
#endif
- static inline void MakeRec(const SkPaint&, const SkMatrix*, Rec* rec);
+ static inline void MakeRec(const SkPaint&, const SkDeviceProperties* deviceProperties,
+ const SkMatrix*, Rec* rec);
static inline void PostMakeRec(const SkPaint&, Rec*);
static SkScalerContext* Create(const SkDescriptor*);
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 7f189aad5f..63cc8c4ec9 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -75,7 +75,7 @@ static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint,
SkMatrix ident;
ident.reset();
- SkAutoGlyphCache autoCache(paint, &ident);
+ SkAutoGlyphCache autoCache(paint, NULL, &ident);
SkGlyphCache* cache = autoCache.getCache();
const char* start = reinterpret_cast<const char*>(glyphs);
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index f2b3f53162..89b4fc9ac7 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -1341,7 +1341,7 @@ bool SkPDFType3Font::populate(int16_t glyphID) {
SkPaint paint;
paint.setTypeface(typeface());
paint.setTextSize(1000);
- SkAutoGlyphCache autoCache(paint, NULL);
+ SkAutoGlyphCache autoCache(paint, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
// If fLastGlyphID isn't set (because there is not fFontInfo), look it up.
if (lastGlyphID() == 0) {
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 26ac088809..3c6dc2c7ef 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -320,8 +320,10 @@ private:
DeferredDevice::DeferredDevice(
SkDevice* immediateDevice, SkDeferredCanvas::NotificationClient* notificationClient) :
- SkDevice(SkBitmap::kNo_Config, immediateDevice->width(),
- immediateDevice->height(), immediateDevice->isOpaque())
+ SkDevice(SkBitmap::kNo_Config,
+ immediateDevice->width(), immediateDevice->height(),
+ immediateDevice->isOpaque(),
+ immediateDevice->getDeviceProperties())
, fRecordingCanvas(NULL)
, fFreshFrame(true)
, fPreviousStorageAllocated(0)