mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Update Skia (#2825)
This commit is contained in:
parent
a5c04b0a51
commit
7c87227702
2
DEPS
2
DEPS
@ -21,7 +21,7 @@ vars = {
|
||||
'chromium_git': 'https://chromium.googlesource.com',
|
||||
'mojo_sdk_revision': 'b200aa62c93647a0421b9239804ef5ce1509ab20',
|
||||
'base_revision': '672b04e54b937ec899429a6bd5409c5a6300d151',
|
||||
'skia_revision': '8cc209111876b7c78b5ec577c9221d8ed5e21024',
|
||||
'skia_revision': 'd1bdd1fcbd308afb9903f39d231742f5c951cf07',
|
||||
|
||||
# Note: When updating the Dart revision, ensure that all entries that are
|
||||
# dependencies of dart are also updated
|
||||
|
||||
@ -47,10 +47,7 @@ bool PictureRecorder::isRecording() {
|
||||
}
|
||||
|
||||
SkCanvas* PictureRecorder::BeginRecording(SkRect bounds) {
|
||||
return picture_recorder_.beginRecording(
|
||||
bounds,
|
||||
&rtree_factory_,
|
||||
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
|
||||
return picture_recorder_.beginRecording(bounds, &rtree_factory_);
|
||||
}
|
||||
|
||||
scoped_refptr<Picture> PictureRecorder::endRecording() {
|
||||
|
||||
@ -219,16 +219,7 @@ sk_sp<SkTypeface> FontCache::createTypeface(const FontDescription& fontDescripti
|
||||
if (typeface)
|
||||
return typeface;
|
||||
|
||||
int legacyStyle = SkTypeface::kNormal;
|
||||
if (fontDescription.weight() >= FontWeight600)
|
||||
legacyStyle |= SkTypeface::kBold;
|
||||
if (fontDescription.style())
|
||||
legacyStyle |= SkTypeface::kItalic;
|
||||
|
||||
// FIXME: Use fm, SkFontStyle and matchFamilyStyle instead of this legacy
|
||||
// API. To make this work, we need to understand the extra fallback behavior
|
||||
// in CreateFromName.
|
||||
return SkTypeface::MakeFromName(name.data(), static_cast<SkTypeface::Style>(legacyStyle));
|
||||
return SkTypeface::MakeFromName(name.data(), style);
|
||||
}
|
||||
|
||||
#if !OS(WIN)
|
||||
|
||||
@ -794,39 +794,6 @@ void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const In
|
||||
image->drawTiled(this, dest, srcRect, tileScaleFactor, hRule, vRule, op);
|
||||
}
|
||||
|
||||
void GraphicsContext::writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y)
|
||||
{
|
||||
if (contextDisabled())
|
||||
return;
|
||||
|
||||
m_canvas->writePixels(info, pixels, rowBytes, x, y);
|
||||
|
||||
if (regionTrackingEnabled()) {
|
||||
SkRect rect = SkRect::MakeXYWH(x, y, info.width(), info.height());
|
||||
SkPaint paint;
|
||||
|
||||
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
if (kOpaque_SkAlphaType != info.alphaType())
|
||||
paint.setAlpha(0x80); // signal to m_trackedRegion that we are not fully opaque
|
||||
|
||||
m_trackedRegion.didDrawRect(this, rect, paint, 0);
|
||||
// more efficient would be to call markRectAsOpaque or MarkRectAsNonOpaque directly,
|
||||
// rather than cons-ing up a paint with an xfermode and alpha
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsContext::writePixels(const SkBitmap& bitmap, int x, int y)
|
||||
{
|
||||
if (contextDisabled())
|
||||
return;
|
||||
|
||||
if (!bitmap.getTexture()) {
|
||||
SkAutoLockPixels alp(bitmap);
|
||||
if (bitmap.getPixels())
|
||||
writePixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsContext::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint)
|
||||
{
|
||||
if (contextDisabled())
|
||||
|
||||
@ -267,10 +267,6 @@ public:
|
||||
const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
|
||||
CompositeOperator = CompositeSourceOver);
|
||||
|
||||
// These methods write to the canvas and modify the opaque region, if tracked.
|
||||
// Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRoundedRect
|
||||
void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, int x, int y);
|
||||
void writePixels(const SkBitmap&, int x, int y);
|
||||
void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint* = 0);
|
||||
void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint* = 0);
|
||||
void drawOval(const SkRect&, const SkPaint&);
|
||||
|
||||
@ -85,7 +85,7 @@ SkShader* Pattern::shader()
|
||||
// we explicitly require non-opaquness, since we are going to add a transparent strip.
|
||||
SkImageInfo newInfo = SkImageInfo::Make(
|
||||
info.width() + expandW, info.height() + expandH, info.colorType(),
|
||||
kPremul_SkAlphaType, info.profileType());
|
||||
kPremul_SkAlphaType, sk_ref_sp(info.colorSpace()));
|
||||
|
||||
SkBitmap bm2;
|
||||
bm2.allocPixels(newInfo);
|
||||
|
||||
@ -176,7 +176,7 @@ static SkBitmap createBitmapWithSpace(const SkBitmap& bitmap, int spaceWidth, in
|
||||
SkImageInfo info = bitmap.info();
|
||||
SkImageInfo newInfo = SkImageInfo::Make(
|
||||
info.width() + spaceWidth, info.height() + spaceHeight,
|
||||
info.colorType(), kPremul_SkAlphaType, info.profileType());
|
||||
info.colorType(), kPremul_SkAlphaType, sk_ref_sp(info.colorSpace()));
|
||||
|
||||
SkBitmap result;
|
||||
result.allocPixels(newInfo);
|
||||
|
||||
@ -75,7 +75,7 @@ SkCanvas* GaneshCanvas::GetCanvas(int32_t fbo, const SkISize& size) {
|
||||
skia::RefPtr<GrRenderTarget> target = skia::AdoptRef(
|
||||
gr_context_->textureProvider()->wrapBackendRenderTarget(desc));
|
||||
DCHECK(target);
|
||||
sk_surface_ = SkSurface::MakeRenderTargetDirect(target.get());
|
||||
sk_surface_ = SkSurface::MakeRenderTargetDirect(target.get(), nullptr);
|
||||
DCHECK(sk_surface_);
|
||||
return sk_surface_->getCanvas();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user