зеркало из https://github.com/mozilla/gecko-dev.git
[PATCH 3/6] Bug 985217 - Minor changes to gfx/2d for API changes in Skia r=snorp
This commit is contained in:
Родитель
d72760e960
Коммит
e7aad60492
|
@ -218,7 +218,7 @@ SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, TempBitmap& aTmpBitmap
|
|||
shader->setLocalMatrix(mat);
|
||||
SkSafeUnref(aPaint.setShader(shader));
|
||||
if (pat.mFilter == Filter::POINT) {
|
||||
aPaint.setFilterBitmap(false);
|
||||
aPaint.setFilterLevel(SkPaint::kNone_FilterLevel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ struct AutoPaintSetup {
|
|||
mPaint.setAlpha(U8CPU(aOptions.mAlpha*255.0));
|
||||
mAlpha = aOptions.mAlpha;
|
||||
}
|
||||
mPaint.setFilterBitmap(true);
|
||||
mPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
|
||||
}
|
||||
|
||||
// TODO: Maybe add an operator overload to access this easier?
|
||||
|
@ -314,7 +314,7 @@ DrawTargetSkia::DrawSurface(SourceSurface *aSurface,
|
|||
|
||||
AutoPaintSetup paint(mCanvas.get(), aOptions);
|
||||
if (aSurfOptions.mFilter == Filter::POINT) {
|
||||
paint.mPaint.setFilterBitmap(false);
|
||||
paint.mPaint.setFilterLevel(SkPaint::kNone_FilterLevel);
|
||||
}
|
||||
|
||||
mCanvas->drawBitmapRectToRect(bitmap.mBitmap, &sourceRect, destRect, &paint.mPaint);
|
||||
|
@ -351,8 +351,8 @@ DrawTargetSkia::DrawSurfaceWithShadow(SourceSurface *aSurface,
|
|||
|
||||
SkPaint paint;
|
||||
|
||||
SkImageFilter* filter = new SkDropShadowImageFilter(aOffset.x, aOffset.y,
|
||||
aSigma, ColorToSkColor(aColor, 1.0));
|
||||
SkImageFilter* filter = SkDropShadowImageFilter::Create(aOffset.x, aOffset.y,
|
||||
aSigma, ColorToSkColor(aColor, 1.0));
|
||||
|
||||
paint.setImageFilter(filter);
|
||||
paint.setXfermodeMode(GfxOpToSkiaOp(aOperator));
|
||||
|
|
|
@ -38,6 +38,25 @@ GfxFormatToSkiaConfig(SurfaceFormat format)
|
|||
}
|
||||
}
|
||||
|
||||
static inline SkColorType
|
||||
GfxFormatToSkiaColorType(SurfaceFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case SurfaceFormat::B8G8R8A8:
|
||||
return kBGRA_8888_SkColorType;
|
||||
case SurfaceFormat::B8G8R8X8:
|
||||
// We probably need to do something here.
|
||||
return kBGRA_8888_SkColorType;
|
||||
case SurfaceFormat::R5G6B5:
|
||||
return kRGB_565_SkColorType;
|
||||
case SurfaceFormat::A8:
|
||||
return kAlpha_8_SkColorType;
|
||||
default:
|
||||
return kRGBA_8888_SkColorType;
|
||||
}
|
||||
}
|
||||
|
||||
static inline SurfaceFormat
|
||||
SkiaConfigToGfxFormat(SkBitmap::Config config)
|
||||
{
|
||||
|
@ -144,9 +163,9 @@ StrokeOptionsToPaint(SkPaint& aPaint, const StrokeOptions &aOptions)
|
|||
pattern[i] = SkFloatToScalar(aOptions.mDashPattern[i % aOptions.mDashLength]);
|
||||
}
|
||||
|
||||
SkDashPathEffect* dash = new SkDashPathEffect(&pattern.front(),
|
||||
dashCount,
|
||||
SkFloatToScalar(aOptions.mDashOffset));
|
||||
SkDashPathEffect* dash = SkDashPathEffect::Create(&pattern.front(),
|
||||
dashCount,
|
||||
SkFloatToScalar(aOptions.mDashOffset));
|
||||
SkSafeUnref(aPaint.setPathEffect(dash));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ bool Scale(uint8_t* srcData, int32_t srcWidth, int32_t srcHeight, int32_t srcStr
|
|||
|
||||
// Rescaler is compatible with 32 bpp only. Convert to RGB32 if needed.
|
||||
if (config != SkBitmap::kARGB_8888_Config) {
|
||||
imgSrc.copyTo(&imgSrc, SkBitmap::kARGB_8888_Config);
|
||||
imgSrc.copyTo(&imgSrc, kRGBA_8888_SkColorType);
|
||||
}
|
||||
|
||||
// This returns an SkBitmap backed by dstData; since it also wrote to dstData,
|
||||
|
|
|
@ -68,7 +68,7 @@ SourceSurfaceSkia::InitFromData(unsigned char* aData,
|
|||
temp.setConfig(GfxFormatToSkiaConfig(aFormat), aSize.width, aSize.height, aStride);
|
||||
temp.setPixels(aData);
|
||||
|
||||
if (!temp.copyTo(&mBitmap, GfxFormatToSkiaConfig(aFormat))) {
|
||||
if (!temp.copyTo(&mBitmap, GfxFormatToSkiaColorType(aFormat))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ SourceSurfaceSkia::DrawTargetWillChange()
|
|||
mDrawTarget = nullptr;
|
||||
SkBitmap temp = mBitmap;
|
||||
mBitmap.reset();
|
||||
temp.copyTo(&mBitmap, temp.getConfig());
|
||||
temp.copyTo(&mBitmap, temp.colorType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче