Revert of introduce Props to surface (patchset #27 id:520001 of https://codereview.chromium.org/551463004/)
Reason for revert:
Broke call site in WebKit
Original issue's description:
> introduce Props to surface (work in progress)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3716fd067a5621bb94a6cb08d72afec8bf3aceda
R=robertphillips@google.com, bsalomon@google.com, jvanverth@google.com, bungeman@google.com, fmalita@google.com, vangelis@chromium.org, reed@google.com
TBR=bsalomon@google.com, bungeman@google.com, fmalita@google.com, jvanverth@google.com, reed@google.com, robertphillips@google.com, vangelis@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/583773004
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index df07204..313c02a 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -131,7 +131,8 @@
flags |= fUseLCDText ? kUseLCD_DistanceFieldEffectFlag : 0;
flags |= fUseLCDText && fTextMatrix.rectStaysRect() ?
kRectToRect_DistanceFieldEffectFlag : 0;
- bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.fPixelGeometry);
+ bool useBGR = SkDeviceProperties::Geometry::kBGR_Layout ==
+ fDeviceProperties.fGeometry.getLayout();
flags |= fUseLCDText && useBGR ? kBGR_DistanceFieldEffectFlag : 0;
// see if we need to create a new effect
@@ -148,7 +149,7 @@
flags));
} else {
#ifdef SK_GAMMA_APPLY_TO_A8
- U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDeviceProperties.getGamma(),
+ U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDeviceProperties.fGamma,
filteredColor);
fCachedEffect.reset(GrDistanceFieldTextureEffect::Create(fCurrTexture,
params,
@@ -501,8 +502,8 @@
#else
SkScalar contrast = 0.5f;
#endif
- SkScalar paintGamma = deviceProperties.getGamma();
- SkScalar deviceGamma = deviceProperties.getGamma();
+ SkScalar paintGamma = deviceProperties.fGamma;
+ SkScalar deviceGamma = deviceProperties.fGamma;
size = SkScalerContext::GetGammaLUTSize(contrast, paintGamma, deviceGamma,
&width, &height);
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 165716f..ba431d3 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -142,7 +142,8 @@
if (atlased.count() > 0) {
// All the atlased layers are rendered into the same GrTexture
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
- atlased[0]->texture()->asRenderTarget(), NULL));
+ atlased[0]->texture()->asRenderTarget(),
+ SkSurface::kStandard_TextRenderMode));
SkCanvas* atlasCanvas = surface->getCanvas();
@@ -195,7 +196,8 @@
// Each non-atlased layer has its own GrTexture
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
- layer->texture()->asRenderTarget(), NULL));
+ layer->texture()->asRenderTarget(),
+ SkSurface::kStandard_TextRenderMode));
SkCanvas* layerCanvas = surface->getCanvas();
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7ce3446..02dca83 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -133,15 +133,15 @@
///////////////////////////////////////////////////////////////////////////////
-SkGpuDevice* SkGpuDevice::Create(GrSurface* surface, const SkSurfaceProps& props, unsigned flags) {
+SkGpuDevice* SkGpuDevice::Create(GrSurface* surface, unsigned flags) {
SkASSERT(surface);
if (NULL == surface->asRenderTarget() || surface->wasDestroyed()) {
return NULL;
}
- return SkNEW_ARGS(SkGpuDevice, (surface, props, flags));
+ return SkNEW_ARGS(SkGpuDevice, (surface, flags));
}
-SkGpuDevice::SkGpuDevice(GrSurface* surface, const SkSurfaceProps& props, unsigned flags) {
+SkGpuDevice::SkGpuDevice(GrSurface* surface, unsigned flags) {
fDrawProcs = NULL;
@@ -156,15 +156,13 @@
fLegacyBitmap.setInfo(surface->info());
fLegacyBitmap.setPixelRef(pr)->unref();
- this->setPixelGeometry(props.pixelGeometry());
-
bool useDFFonts = !!(flags & kDFFonts_Flag);
fMainTextContext = fContext->createTextContext(fRenderTarget, this->getLeakyProperties(), useDFFonts);
fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, this->getLeakyProperties()));
}
SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo,
- const SkSurfaceProps& props, int sampleCount) {
+ int sampleCount) {
if (kUnknown_SkColorType == origInfo.colorType() ||
origInfo.width() < 0 || origInfo.height() < 0) {
return NULL;
@@ -196,7 +194,7 @@
return NULL;
}
- return SkNEW_ARGS(SkGpuDevice, (texture.get(), props));
+ return SkNEW_ARGS(SkGpuDevice, (texture.get()));
}
SkGpuDevice::~SkGpuDevice() {
@@ -1807,7 +1805,7 @@
texture.reset(fContext->createUncachedTexture(desc, NULL, 0));
#endif
if (texture.get()) {
- return SkGpuDevice::Create(texture, SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType), flags);
+ return SkGpuDevice::Create(texture, flags);
} else {
GrPrintf("---- failed to create compatible device texture [%d %d]\n",
info.width(), info.height());
@@ -1815,8 +1813,8 @@
}
}
-SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
- return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples(), &props);
+SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) {
+ return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples());
}
void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 41b53b1..dc59009 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -43,7 +43,7 @@
* the kCached_Flag should be specified to make the device responsible for unlocking
* the surface when it is released.
*/
- static SkGpuDevice* Create(GrSurface* surface, const SkSurfaceProps&, unsigned flags = 0);
+ static SkGpuDevice* Create(GrSurface* surface, unsigned flags = 0);
/**
* New device that will create an offscreen renderTarget based on the
@@ -51,8 +51,7 @@
* count against the GrContext's texture cache budget. The device's pixels
* will be uninitialized. On failure, returns NULL.
*/
- static SkGpuDevice* Create(GrContext*, const SkImageInfo&, const SkSurfaceProps&,
- int sampleCount);
+ static SkGpuDevice* Create(GrContext*, const SkImageInfo&, int sampleCount);
virtual ~SkGpuDevice();
@@ -146,11 +145,11 @@
// remove when our clients don't rely on accessBitmap()
SkBitmap fLegacyBitmap;
- SkGpuDevice(GrSurface*, const SkSurfaceProps&, unsigned flags = 0);
+ SkGpuDevice(GrSurface*, unsigned flags = 0);
virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
- virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE;
+ virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE;
virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE;