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

Unified Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1196683003: remove SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 5 years, 6 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
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 7252d76ca2acb65a1876a2a3ae8cbf8c2d34d108..ce22af51d75cda0f043c37f8c416b8938dcc742f 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -97,8 +97,8 @@ static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) {
GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
GrDrawContext* drawContext,
- const SkDeviceProperties& properties)
- : INHERITED(context, drawContext, properties)
+ const SkSurfaceProps& surfaceProps)
+ : INHERITED(context, drawContext, surfaceProps)
, fDistanceAdjustTable(SkNEW(DistanceAdjustTable)) {
// We overallocate vertices in our textblobs based on the assumption that A8 has the greatest
// vertexStride
@@ -192,8 +192,8 @@ void GrAtlasTextContext::DistanceAdjustTable::buildDistanceAdjustTable() {
GrAtlasTextContext* GrAtlasTextContext::Create(GrContext* context,
GrDrawContext* drawContext,
- const SkDeviceProperties& props) {
- return SkNEW_ARGS(GrAtlasTextContext, (context, drawContext, props));
+ const SkSurfaceProps& surfaceProps) {
+ return SkNEW_ARGS(GrAtlasTextContext, (context, drawContext, surfaceProps));
}
bool GrAtlasTextContext::canDraw(const GrRenderTarget*,
@@ -334,7 +334,7 @@ inline SkGlyphCache* GrAtlasTextContext::setupCache(BitmapTextBlob::Run* run,
const SkPaint& skPaint,
const SkMatrix* viewMatrix,
bool noGamma) {
- skPaint.getScalerContextDescriptor(&run->fDescriptor, &fDeviceProperties, viewMatrix, noGamma);
+ skPaint.getScalerContextDescriptor(&run->fDescriptor, fSurfaceProps, viewMatrix, noGamma);
run->fTypeface.reset(SkSafeRef(skPaint.getTypeface()));
return SkGlyphCache::DetachCache(run->fTypeface, run->fDescriptor.getDesc());
}
@@ -363,7 +363,7 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt,
bool hasLCD = HasLCD(blob);
// We canonicalize all non-lcd draws to use kUnknown_SkPixelGeometry
- SkPixelGeometry pixelGeometry = hasLCD ? fDeviceProperties.pixelGeometry() :
+ SkPixelGeometry pixelGeometry = hasLCD ? fSurfaceProps.pixelGeometry() :
kUnknown_SkPixelGeometry;
// TODO we want to figure out a way to be able to use the canonical color on LCD text,
@@ -442,7 +442,7 @@ inline bool GrAtlasTextContext::canDrawAsDistanceFields(const SkPaint& skPaint,
return false;
}
- bool useDFT = fDeviceProperties.useDFT();
+ bool useDFT = fSurfaceProps.isUseDistanceFieldFonts();
#if SK_FORCE_DISTANCE_FIELD_TEXT
useDFT = true;
#endif
@@ -494,7 +494,7 @@ void GrAtlasTextContext::regenerateTextBlob(BitmapTextBlob* cacheBlob,
continue;
}
- runPaint.setFlags(FilterTextFlags(fDeviceProperties, runPaint));
+ runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint));
// setup vertex / glyphIndex for the new run
if (run > 0) {
@@ -662,7 +662,7 @@ inline void GrAtlasTextContext::fallbackDrawPosText(BitmapTextBlob* blob,
run.push_back();
run.fOverrideDescriptor.reset(SkNEW(SkAutoDescriptor));
skPaint.getScalerContextDescriptor(run.fOverrideDescriptor,
- &fDeviceProperties, &viewMatrix, false);
+ fSurfaceProps, &viewMatrix, false);
SkGlyphCache* cache = SkGlyphCache::DetachCache(run.fTypeface,
run.fOverrideDescriptor->getDesc());
this->internalDrawBMPPosText(blob, runIndex, cache, skPaint, paint.getColor(), viewMatrix,
@@ -1073,7 +1073,7 @@ void GrAtlasTextContext::internalDrawDFText(BitmapTextBlob* blob, int runIndex,
SkDrawCacheProc glyphCacheProc = origPaint.getDrawCacheProc();
SkAutoDescriptor desc;
- origPaint.getScalerContextDescriptor(&desc, &fDeviceProperties, NULL, true);
+ origPaint.getScalerContextDescriptor(&desc, fSurfaceProps, NULL, true);
SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(origPaint.getTypeface(),
desc.getDesc());
@@ -2042,7 +2042,7 @@ void GrAtlasTextContext::flushRunAsPaths(GrRenderTarget* rt, const SkTextBlob::R
return;
}
- runPaint.setFlags(FilterTextFlags(fDeviceProperties, runPaint));
+ runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint));
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning:
@@ -2088,7 +2088,7 @@ GrAtlasTextContext::createBatch(BitmapTextBlob* cacheBlob, const PerSubRunInfo&
} else {
filteredColor = skPaint.getColor();
}
- bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.pixelGeometry());
+ bool useBGR = SkPixelGeometryIsBGR(fSurfaceProps.pixelGeometry());
batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFontCache(),
fDistanceAdjustTable, filteredColor,
info.fUseLCDText, useBGR);
@@ -2210,7 +2210,7 @@ void GrAtlasTextContext::flush(BitmapTextBlob* cacheBlob,
BATCH_TEST_DEFINE(TextBlobBatch) {
static uint32_t gContextID = SK_InvalidGenID;
static GrAtlasTextContext* gTextContext = NULL;
- static SkDeviceProperties gDevProperties;
+ static SkSurfaceProps gSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
if (context->uniqueID() != gContextID) {
gContextID = context->uniqueID();
@@ -2219,9 +2219,9 @@ BATCH_TEST_DEFINE(TextBlobBatch) {
// We don't yet test the fall back to paths in the GrTextContext base class. This is mostly
// because we don't really want to have a gpu device here.
// We enable distance fields by twiddling a knob on the paint
- GrDrawContext* drawContext = context->drawContext(&gDevProperties);
+ GrDrawContext* drawContext = context->drawContext(&gSurfaceProps);
- gTextContext = GrAtlasTextContext::Create(context, drawContext, gDevProperties);
+ gTextContext = GrAtlasTextContext::Create(context, drawContext, gSurfaceProps);
}
// create dummy render target
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | src/gpu/GrContext.cpp » ('j') | src/gpu/SkGpuDevice.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698