From 31f7fa8ddd695ac5f016feaf0dd54ce09720482d Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 26 Aug 2015 15:28:05 -0700 Subject: [PATCH] Update skia to latest revision --- DEPS | 2 +- skia/BUILD.gn | 4 ++-- skia/ext/analysis_canvas.cc | 1 + skia/ext/benchmarking_canvas.cc | 13 +++---------- skia/ext/bitmap_platform_device_mac.cc | 1 + skia/ext/pixel_ref_utils.cc | 3 ++- skia/skia_gn_files.gypi | 2 -- skia/skia_library.gypi | 3 --- sky/engine/core/painting/Canvas.cpp | 2 +- sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp | 2 +- .../platform/fonts/skia/FontPlatformDataSkia.cpp | 2 +- sky/engine/platform/graphics/GraphicsContext.cpp | 2 +- .../platform/graphics/ImageFrameGenerator.cpp | 4 ++-- sky/engine/platform/graphics/Pattern.cpp | 8 ++++---- sky/engine/platform/graphics/filters/FELighting.cpp | 13 +++++++------ .../platform/graphics/skia/NativeImageSkia.cpp | 8 ++++---- 16 files changed, 31 insertions(+), 39 deletions(-) diff --git a/DEPS b/DEPS index d85d3abaa..4c0b210f6 100644 --- a/DEPS +++ b/DEPS @@ -21,7 +21,7 @@ vars = { 'chromium_git': 'https://chromium.googlesource.com', 'mojo_sdk_revision': 'eb7dac2f90187db12c0d29792a0bd999bc96cbe5', 'mojo_devtools_revision': '2feda37728d3e551ef543b8f6c4f4b20eaa2d81f', - 'skia_revision': '29ccdf86ab0a1649fd775c9431891bacb1391e99', + 'skia_revision': '5015176adf046ef906a2313b6e6b64b72cc84898', 'dart_revision': 'cab003366785773ace16b5305ac1f33c228cac54', 'dart_observatory_packages_revision': 'cdc4b3d4c15b9c0c8e7702dff127b440afbb7485', diff --git a/skia/BUILD.gn b/skia/BUILD.gn index 633cd533e..0c58c74e1 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn @@ -109,7 +109,7 @@ config("skia_config") { defines = gypi_skia_defines.skia_for_chromium_defines - defines += [] + defines += [ "SK_SUPPORT_LEGACY_SHADERBITMAPTYPE" ] if (component_mode == "shared_library") { defines += [ @@ -146,6 +146,7 @@ config("skia_library_config") { # exported to dependents. It's not clear if this is on purpose, but this # matches the GYP build. include_dirs = [ + "//third_party/skia/include/private", "//third_party/skia/src/core", "//third_party/skia/src/image", "//third_party/skia/src/opts", @@ -357,7 +358,6 @@ component("skia") { "//third_party/skia/src/utils/SkSHA1.cpp", "//third_party/skia/src/utils/SkSHA1.h", "//third_party/skia/src/utils/SkTFitsIn.h", - "//third_party/skia/src/utils/SkTLogic.h", # We don't currently need to change thread affinity, so leave out this complexity for now. "//third_party/skia/src/utils/SkThreadUtils_pthread_linux.cpp", diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc index 31163ed0e..cb2d82be2 100644 --- a/skia/ext/analysis_canvas.cc +++ b/skia/ext/analysis_canvas.cc @@ -6,6 +6,7 @@ #include "base/trace_event/trace_event.h" #include "skia/ext/analysis_canvas.h" #include "third_party/skia/include/core/SkDraw.h" +#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkShader.h" #include "third_party/skia/src/core/SkRasterClip.h" diff --git a/skia/ext/benchmarking_canvas.cc b/skia/ext/benchmarking_canvas.cc index 1c08a0627..6e10ff043 100644 --- a/skia/ext/benchmarking_canvas.cc +++ b/skia/ext/benchmarking_canvas.cc @@ -8,11 +8,13 @@ #include "skia/ext/benchmarking_canvas.h" #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkImageFilter.h" -#include "third_party/skia/include/core/SkTLazy.h" +#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkRegion.h" +#include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkString.h" #include "third_party/skia/include/core/SkTextBlob.h" +#include "third_party/skia/include/core/SkTLazy.h" #include "third_party/skia/include/core/SkXfermode.h" namespace { @@ -360,15 +362,6 @@ scoped_ptr AsValue(const SkPath& path) { { "move", "line", "quad", "conic", "cubic", "close", "done" }; static const int gPtsPerVerb[] = { 1, 1, 2, 2, 3, 0, 0 }; static const int gPtOffsetPerVerb[] = { 0, 1, 1, 1, 1, 0, 0 }; - SK_COMPILE_ASSERT( - SK_ARRAY_COUNT(gVerbStrings) == static_cast(SkPath::kDone_Verb + 1), - gVerbStrings_size_mismatch); - SK_COMPILE_ASSERT( - SK_ARRAY_COUNT(gVerbStrings) == SK_ARRAY_COUNT(gPtsPerVerb), - gPtsPerVerb_size_mismatch); - SK_COMPILE_ASSERT( - SK_ARRAY_COUNT(gVerbStrings) == SK_ARRAY_COUNT(gPtOffsetPerVerb), - gPtOffsetPerVerb_size_mismatch); scoped_ptr verbs_val(new base::ListValue()); SkPath::Iter iter(const_cast(path), false); diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index 066e93ff1..087cf39d7 100644 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -13,6 +13,7 @@ #include "skia/ext/platform_canvas.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/skia/include/core/SkMatrix.h" +#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkRegion.h" #include "third_party/skia/include/core/SkTypes.h" #include "third_party/skia/include/core/SkUtils.h" diff --git a/skia/ext/pixel_ref_utils.cc b/skia/ext/pixel_ref_utils.cc index 78d256df7..e2cb83c94 100644 --- a/skia/ext/pixel_ref_utils.cc +++ b/skia/ext/pixel_ref_utils.cc @@ -10,9 +10,10 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkDraw.h" +#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkPixelRef.h" -#include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkRect.h" +#include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkShader.h" #include "third_party/skia/include/utils/SkNoSaveLayerCanvas.h" #include "third_party/skia/src/core/SkRasterClip.h" diff --git a/skia/skia_gn_files.gypi b/skia/skia_gn_files.gypi index 4aa9121b7..36a9dbb0a 100644 --- a/skia/skia_gn_files.gypi +++ b/skia/skia_gn_files.gypi @@ -3,8 +3,6 @@ # Files are relative to third_party/skia. { 'skia_library_sources': [ - '<(skia_src_path)/core/SkFlate.cpp', # this should likely be moved into src/utils in skia - '<(skia_src_path)/ports/SkImageGenerator_none.cpp', '<(skia_include_path)/images/SkMovie.h', diff --git a/skia/skia_library.gypi b/skia/skia_library.gypi index 14214ea2c..9fc63d05a 100644 --- a/skia/skia_library.gypi +++ b/skia/skia_library.gypi @@ -25,9 +25,6 @@ ], 'sources': [ - # this should likely be moved into src/utils in skia - '../third_party/skia/src/core/SkFlate.cpp', - '../third_party/skia/src/ports/SkImageDecoder_empty.cpp', '../third_party/skia/src/images/SkScaledBitmapSampler.cpp', '../third_party/skia/src/images/SkScaledBitmapSampler.h', diff --git a/sky/engine/core/painting/Canvas.cpp b/sky/engine/core/painting/Canvas.cpp index 29ea72c5d..be82330db 100644 --- a/sky/engine/core/painting/Canvas.cpp +++ b/sky/engine/core/painting/Canvas.cpp @@ -213,7 +213,7 @@ void Canvas::drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, const if (!m_canvas) return; ASSERT(image); - m_canvas->drawImageRect(image->image(), &src.sk_rect, dst.sk_rect, paint.paint()); + m_canvas->drawImageRect(image->image(), src.sk_rect, dst.sk_rect, paint.paint()); } void Canvas::drawPicture(Picture* picture) diff --git a/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp b/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp index 7a4f27874..8042ec4a4 100644 --- a/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp +++ b/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp @@ -39,7 +39,7 @@ #include "sky/engine/platform/graphics/GraphicsContext.h" #include "third_party/skia/include/core/SkPaint.h" -#include "third_party/skia/include/core/SkTemplates.h" +#include "third_party/skia/include/private/SkTemplates.h" #include "sky/engine/wtf/unicode/Unicode.h" diff --git a/sky/engine/platform/fonts/skia/FontPlatformDataSkia.cpp b/sky/engine/platform/fonts/skia/FontPlatformDataSkia.cpp index edc4b4301..c8542d9e6 100644 --- a/sky/engine/platform/fonts/skia/FontPlatformDataSkia.cpp +++ b/sky/engine/platform/fonts/skia/FontPlatformDataSkia.cpp @@ -31,7 +31,7 @@ #include "sky/engine/platform/fonts/FontPlatformData.h" #include "sky/engine/platform/fonts/FontCache.h" -#include "third_party/skia/include/core/SkEndian.h" +#include "third_party/skia/src/core/SkEndian.h" #include "third_party/skia/include/core/SkTypeface.h" namespace blink { diff --git a/sky/engine/platform/graphics/GraphicsContext.cpp b/sky/engine/platform/graphics/GraphicsContext.cpp index 7ef82048d..342ecf291 100644 --- a/sky/engine/platform/graphics/GraphicsContext.cpp +++ b/sky/engine/platform/graphics/GraphicsContext.cpp @@ -970,7 +970,7 @@ void GraphicsContext::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, SkCanvas::SrcRectConstraint flags = immutableState()->shouldClampToSourceRect() ? SkCanvas::kStrict_SrcRectConstraint : SkCanvas::kFast_SrcRectConstraint; - m_canvas->drawBitmapRect(bitmap, src, dst, paint, flags); + m_canvas->drawBitmapRect(bitmap, *src, dst, paint, flags); if (regionTrackingEnabled()) m_trackedRegion.didDrawRect(this, dst, *paint, &bitmap); diff --git a/sky/engine/platform/graphics/ImageFrameGenerator.cpp b/sky/engine/platform/graphics/ImageFrameGenerator.cpp index 085a8870d..10aebf516 100644 --- a/sky/engine/platform/graphics/ImageFrameGenerator.cpp +++ b/sky/engine/platform/graphics/ImageFrameGenerator.cpp @@ -103,7 +103,7 @@ bool ImageFrameGenerator::decodeAndScale(const SkImageInfo& info, size_t index, MutexLocker lock(m_decodeMutex); // This implementation does not support scaling so check the requested size. - SkISize scaledSize = SkISize::Make(info.fWidth, info.fHeight); + SkISize scaledSize = SkISize::Make(info.width(), info.height()); ASSERT(m_fullSize == scaledSize); if (m_decodeFailedAndEmpty) @@ -128,7 +128,7 @@ bool ImageFrameGenerator::decodeAndScale(const SkImageInfo& info, size_t index, // Check to see if decoder has written directly to the memory provided // by Skia. If not make a copy. if (bitmap.getPixels() != pixels) - result = bitmap.copyPixelsTo(pixels, rowBytes * info.fHeight, rowBytes); + result = bitmap.copyPixelsTo(pixels, rowBytes * info.height(), rowBytes); return result; } diff --git a/sky/engine/platform/graphics/Pattern.cpp b/sky/engine/platform/graphics/Pattern.cpp index 1f89f1784..acc578d79 100644 --- a/sky/engine/platform/graphics/Pattern.cpp +++ b/sky/engine/platform/graphics/Pattern.cpp @@ -82,13 +82,13 @@ SkShader* Pattern::shader() // original, then copy the orignal into it. // FIXME: Is there a better way to pad (not scale) an image in skia? SkImageInfo info = m_tileImage->bitmap().info(); - info.fWidth += expandW; - info.fHeight += expandH; // we explicitly require non-opaquness, since we are going to add a transparent strip. - info.fAlphaType = kPremul_SkAlphaType; + SkImageInfo newInfo = SkImageInfo::Make( + info.width() + expandW, info.height() + expandH, info.colorType(), + kPremul_SkAlphaType, info.profileType()); SkBitmap bm2; - bm2.allocPixels(info); + bm2.allocPixels(newInfo); bm2.eraseARGB(0x00, 0x00, 0x00, 0x00); SkCanvas canvas(bm2); canvas.drawBitmap(m_tileImage->bitmap(), 0, 0); diff --git a/sky/engine/platform/graphics/filters/FELighting.cpp b/sky/engine/platform/graphics/filters/FELighting.cpp index 75c03a686..cb584a00b 100644 --- a/sky/engine/platform/graphics/filters/FELighting.cpp +++ b/sky/engine/platform/graphics/filters/FELighting.cpp @@ -31,6 +31,7 @@ #include "sky/engine/platform/graphics/filters/ParallelJobs.h" #include "sky/engine/platform/graphics/filters/SkiaImageFilterBuilder.h" #include "sky/engine/platform/graphics/skia/NativeImageSkia.h" +#include "third_party/skia/include/core/SkPoint3.h" #include "third_party/skia/include/effects/SkLightingImageFilter.h" namespace blink { @@ -441,9 +442,9 @@ PassRefPtr FELighting::createImageFilter(SkiaImageFilterBuilder* DistantLightSource* distantLightSource = static_cast(m_lightSource.get()); float azimuthRad = deg2rad(distantLightSource->azimuth()); float elevationRad = deg2rad(distantLightSource->elevation()); - SkPoint3 direction(cosf(azimuthRad) * cosf(elevationRad), - sinf(azimuthRad) * cosf(elevationRad), - sinf(elevationRad)); + SkPoint3 direction = SkPoint3::Make(cosf(azimuthRad) * cosf(elevationRad), + sinf(azimuthRad) * cosf(elevationRad), + sinf(elevationRad)); if (m_specularConstant > 0) return adoptRef(SkLightingImageFilter::CreateDistantLitSpecular(direction, lightColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent, input.get(), &rect)); return adoptRef(SkLightingImageFilter::CreateDistantLitDiffuse(direction, lightColor.rgb(), m_surfaceScale, m_diffuseConstant, input.get(), &rect)); @@ -451,15 +452,15 @@ PassRefPtr FELighting::createImageFilter(SkiaImageFilterBuilder* case LS_POINT: { PointLightSource* pointLightSource = static_cast(m_lightSource.get()); FloatPoint3D position = pointLightSource->position(); - SkPoint3 skPosition(position.x(), position.y(), position.z()); + SkPoint3 skPosition = SkPoint3::Make(position.x(), position.y(), position.z()); if (m_specularConstant > 0) return adoptRef(SkLightingImageFilter::CreatePointLitSpecular(skPosition, lightColor.rgb(), m_surfaceScale, m_specularConstant, m_specularExponent, input.get(), &rect)); return adoptRef(SkLightingImageFilter::CreatePointLitDiffuse(skPosition, lightColor.rgb(), m_surfaceScale, m_diffuseConstant, input.get(), &rect)); } case LS_SPOT: { SpotLightSource* spotLightSource = static_cast(m_lightSource.get()); - SkPoint3 location(spotLightSource->position().x(), spotLightSource->position().y(), spotLightSource->position().z()); - SkPoint3 target(spotLightSource->direction().x(), spotLightSource->direction().y(), spotLightSource->direction().z()); + SkPoint3 location = SkPoint3::Make(spotLightSource->position().x(), spotLightSource->position().y(), spotLightSource->position().z()); + SkPoint3 target = SkPoint3::Make(spotLightSource->direction().x(), spotLightSource->direction().y(), spotLightSource->direction().z()); float specularExponent = spotLightSource->specularExponent(); float limitingConeAngle = spotLightSource->limitingConeAngle(); if (!limitingConeAngle || limitingConeAngle > 90 || limitingConeAngle < -90) diff --git a/sky/engine/platform/graphics/skia/NativeImageSkia.cpp b/sky/engine/platform/graphics/skia/NativeImageSkia.cpp index 91ea4b406..4bf9e6244 100644 --- a/sky/engine/platform/graphics/skia/NativeImageSkia.cpp +++ b/sky/engine/platform/graphics/skia/NativeImageSkia.cpp @@ -174,12 +174,12 @@ void NativeImageSkia::draw( static SkBitmap createBitmapWithSpace(const SkBitmap& bitmap, int spaceWidth, int spaceHeight) { SkImageInfo info = bitmap.info(); - info.fWidth += spaceWidth; - info.fHeight += spaceHeight; - info.fAlphaType = kPremul_SkAlphaType; + SkImageInfo newInfo = SkImageInfo::Make( + info.width() + spaceWidth, info.height() + spaceHeight, + info.colorType(), kPremul_SkAlphaType, info.profileType()); SkBitmap result; - result.allocPixels(info); + result.allocPixels(newInfo); result.eraseColor(SK_ColorTRANSPARENT); bitmap.copyPixelsTo(reinterpret_cast(result.getPixels()), result.rowBytes() * result.height(), result.rowBytes());