summaryrefslogtreecommitdiff
path: root/chromium/skia
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-05 17:15:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-11 07:47:18 +0000
commit7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch)
treea3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/skia
parent6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff)
downloadqtwebengine-chromium-7324afb043a0b1e623d8e8eb906cdc53bdeb4685.tar.gz
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/skia')
-rw-r--r--chromium/skia/BUILD.gn76
-rw-r--r--chromium/skia/OWNERS2
-rw-r--r--chromium/skia/config/SkUserConfig.h18
-rw-r--r--chromium/skia/ext/analysis_canvas.cc9
-rw-r--r--chromium/skia/ext/benchmarking_canvas.cc19
-rw-r--r--chromium/skia/ext/google_logging.cc8
-rw-r--r--chromium/skia/ext/platform_canvas.cc35
-rw-r--r--chromium/skia/ext/platform_canvas.h9
-rw-r--r--chromium/skia/ext/skia_commit_hash.h2
-rw-r--r--chromium/skia/ext/skia_utils_base.cc31
-rw-r--r--chromium/skia/ext/skia_utils_base.h11
-rw-r--r--chromium/skia/ext/skia_utils_mac.h43
-rw-r--r--chromium/skia/ext/skia_utils_mac.mm122
-rw-r--r--chromium/skia/ext/skia_utils_mac_unittest.mm64
-rw-r--r--chromium/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc2
15 files changed, 65 insertions, 386 deletions
diff --git a/chromium/skia/BUILD.gn b/chromium/skia/BUILD.gn
index 8e14ac18738..35dc6e2fb57 100644
--- a/chromium/skia/BUILD.gn
+++ b/chromium/skia/BUILD.gn
@@ -41,7 +41,10 @@ config("skia_config") {
"//third_party/skia/include/utils",
]
- defines = [ "SK_IGNORE_DW_GRAY_FIX" ]
+ defines = [
+ "SK_IGNORE_DW_GRAY_FIX",
+ "SK_IGNORE_DIRECTWRITE_GASP_FIX",
+ ]
defines += skia_for_chromium_defines
defines += []
@@ -226,7 +229,7 @@ component("skia") {
sources += [ "ext/convolver_mips_dspr2.cc" ]
}
- # The skia gypi values are relative to the skia_dir, so we need to rebase.
+ # The imported Skia gni source paths are made absolute by gn.
sources += skia_core_sources
sources += skia_effects_sources
sources += skia_utils_sources
@@ -234,35 +237,13 @@ component("skia") {
sources += [
"//third_party/skia/src/fonts/SkFontMgr_indirect.cpp",
"//third_party/skia/src/fonts/SkRemotableFontMgr.cpp",
- "//third_party/skia/src/ports/SkFontConfigInterface.cpp",
- "//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
- "//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp",
- "//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
- "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
- "//third_party/skia/src/ports/SkFontHost_mac.cpp",
- "//third_party/skia/src/ports/SkFontHost_win.cpp",
- "//third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp",
- "//third_party/skia/src/ports/SkFontMgr_android.cpp",
- "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp",
- "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
"//third_party/skia/src/ports/SkGlobalInitialization_default.cpp",
"//third_party/skia/src/ports/SkImageGenerator_none.cpp",
- "//third_party/skia/src/ports/SkOSFile_posix.cpp",
"//third_party/skia/src/ports/SkOSFile_stdio.cpp",
- "//third_party/skia/src/ports/SkOSFile_win.cpp",
- "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
- "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
- "//third_party/skia/src/ports/SkTLS_pthread.cpp",
- "//third_party/skia/src/ports/SkTLS_win.cpp",
- "//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
"//third_party/skia/src/sfnt/SkOTTable_name.cpp",
"//third_party/skia/src/sfnt/SkOTUtils.cpp",
]
- if (is_mac) {
- sources += [ "//third_party/skia/src/utils/mac/SkStream_mac.cpp" ]
- }
-
# This and skia_opts are really the same conceptual target so share headers.
allow_circular_includes_from = [ ":skia_opts" ]
@@ -277,14 +258,13 @@ component("skia") {
sources += skia_sksl_sources
}
- # Remove unused util files include in utils.gypi
+ # Remove unused util sources.
sources -= [
"//third_party/skia/src/utils/SkBoundaryPatch.cpp",
"//third_party/skia/src/utils/SkCamera.cpp",
"//third_party/skia/src/utils/SkDumpCanvas.cpp",
"//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
"//third_party/skia/src/utils/SkInterpolator.cpp",
- "//third_party/skia/src/utils/SkLayer.cpp",
"//third_party/skia/src/utils/SkMeshUtils.cpp",
"//third_party/skia/src/utils/SkOSPath.cpp",
"//third_party/skia/src/utils/SkParsePath.cpp",
@@ -319,14 +299,9 @@ component("skia") {
sources -= [ "ext/skia_utils_base.cc" ]
}
- # Fixup skia library sources.
+ # Select Skia ports.
if (is_win) {
- sources -= [
- "//third_party/skia/src/ports/SkOSFile_posix.cpp",
- "//third_party/skia/src/ports/SkTLS_pthread.cpp",
- ]
- } else {
- sources -= [
+ sources += [
"//third_party/skia/src/ports/SkFontHost_win.cpp",
"//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
"//third_party/skia/src/ports/SkOSFile_win.cpp",
@@ -335,13 +310,24 @@ component("skia") {
"//third_party/skia/src/ports/SkTLS_win.cpp",
"//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
]
+ } else {
+ sources += [
+ "//third_party/skia/src/ports/SkOSFile_posix.cpp",
+ "//third_party/skia/src/ports/SkTLS_pthread.cpp",
+ ]
}
- if (!is_mac) {
- sources -= [ "//third_party/skia/src/ports/SkFontHost_mac.cpp" ]
+
+ if (is_mac || is_ios) {
+ set_sources_assignment_filter([])
+ sources += [
+ "//third_party/skia/src/ports/SkFontHost_mac.cpp",
+ "//third_party/skia/src/utils/mac/SkStream_mac.cpp",
+ ]
+ set_sources_assignment_filter(sources_assignment_filter)
}
- if (!is_linux) {
- sources -= [
+ if (is_linux) {
+ sources += [
"//third_party/skia/src/ports/SkFontConfigInterface.cpp",
"//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
"//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp",
@@ -349,13 +335,14 @@ component("skia") {
]
}
- if (!is_linux && !is_android) {
- sources -= [
+ if (is_linux || is_android) {
+ sources += [
"//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
"//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
# Retain the files for the SkFontMgr_Android on linux to emulate android
# fonts. See content/zygote/zygote_main_linux.cc
+ # Note that this requires expat.
"//third_party/skia/src/ports/SkFontMgr_android.cpp",
"//third_party/skia/src/ports/SkFontMgr_android_parser.cpp",
]
@@ -400,8 +387,6 @@ component("skia") {
}
if (is_android) {
- set_sources_assignment_filter([])
- set_sources_assignment_filter(sources_assignment_filter)
deps += [
"//third_party/android_tools:cpu_features",
"//third_party/expat",
@@ -437,15 +422,8 @@ component("skia") {
if (is_ios) {
libs = [ "ImageIO.framework" ]
set_sources_assignment_filter([])
- sources += [
- "//third_party/skia/src/ports/SkFontHost_mac.cpp",
- "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp",
- "//third_party/skia/src/utils/mac/SkStream_mac.cpp",
- ]
+ sources += [ "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp" ]
set_sources_assignment_filter(sources_assignment_filter)
-
- # SkFontHost_mac.cpp uses API deprecated in iOS 7, crbug.com/408571
- cflags = [ "-Wno-deprecated-declarations" ]
}
}
diff --git a/chromium/skia/OWNERS b/chromium/skia/OWNERS
index 136438609f1..8a43f213490 100644
--- a/chromium/skia/OWNERS
+++ b/chromium/skia/OWNERS
@@ -14,3 +14,5 @@ scroggo@google.com
senorblanco@chromium.org
sugoi@google.com
thakis@chromium.org
+
+# COMPONENT: Internals>Skia
diff --git a/chromium/skia/config/SkUserConfig.h b/chromium/skia/config/SkUserConfig.h
index b6faeb9f32c..644644ac71e 100644
--- a/chromium/skia/config/SkUserConfig.h
+++ b/chromium/skia/config/SkUserConfig.h
@@ -124,9 +124,6 @@
#define SK_REF_CNT_MIXIN_INCLUDE "sk_ref_cnt_ext_release.h"
#endif
-#define SK_SCALAR_IS_FLOAT
-#undef SK_SCALAR_IS_FIXED
-
#define SK_MSCALAR_IS_FLOAT
#undef SK_MSCALAR_IS_DOUBLE
@@ -227,6 +224,14 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal,
# define SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES
#endif
+#ifndef SK_SUPPORT_LEGACY_PATHEFFECT_SUBCLASSES
+#define SK_SUPPORT_LEGACY_PATHEFFECT_SUBCLASSES
+#endif
+
+#ifndef SK_DISABLE_DEFERRED_PROXIES
+#define SK_DISABLE_DEFERRED_PROXIES
+#endif
+
///////////////////////// Imported from BUILD.gn and skia_common.gypi
/* In some places Skia can use static initializers for global initialization,
@@ -257,13 +262,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal,
// Updating to a correct SkPMColor lerp will require layout test rebaselines.
#define SK_SUPPORT_LEGACY_BROKEN_LERP
-// Enabling the screenspace AA tessellating path renderer needs rebaselines.
-#define SK_DISABLE_SCREENSPACE_TESS_AA_PATH_RENDERER
-
-#ifndef SK_SUPPORT_LEGACY_AAA
-# define SK_SUPPORT_LEGACY_AAA
-#endif
-
// ===== End Chrome-specific definitions =====
#endif
diff --git a/chromium/skia/ext/analysis_canvas.cc b/chromium/skia/ext/analysis_canvas.cc
index 6175354de38..cb2e14a7ca7 100644
--- a/chromium/skia/ext/analysis_canvas.cc
+++ b/chromium/skia/ext/analysis_canvas.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "skia/ext/analysis_canvas.h"
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
-#include "skia/ext/analysis_canvas.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkRRect.h"
+#include "third_party/skia/include/core/SkRegion.h"
#include "third_party/skia/include/core/SkShader.h"
namespace {
@@ -51,7 +52,7 @@ bool IsFullQuad(SkCanvas* canvas, const SkRect& drawn_rect) {
return false;
SkIRect clip_irect;
- if (!canvas->getClipDeviceBounds(&clip_irect))
+ if (!canvas->getDeviceClipBounds(&clip_irect))
return false;
// if the clip is smaller than the canvas, we're partly clipped, so abort.
@@ -90,7 +91,7 @@ void AnalysisCanvas::SetForceNotTransparent(bool flag) {
void AnalysisCanvas::onDrawPaint(const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "AnalysisCanvas::onDrawPaint");
SkRect rect;
- if (getClipBounds(&rect))
+ if (getLocalClipBounds(&rect))
drawRect(rect, paint);
}
@@ -426,7 +427,7 @@ void AnalysisCanvas::onClipRRect(const SkRRect& rrect,
SkClipOp op,
ClipEdgeStyle edge_style) {
SkIRect clip_device_bounds;
- if (getClipDeviceBounds(&clip_device_bounds) &&
+ if (getDeviceClipBounds(&clip_device_bounds) &&
doesCoverCanvas(rrect, getTotalMatrix(), clip_device_bounds)) {
// If the canvas is fully contained within the clip, it is as if we weren't
// clipped at all, so bail early.
diff --git a/chromium/skia/ext/benchmarking_canvas.cc b/chromium/skia/ext/benchmarking_canvas.cc
index 32e4df0c148..60a47a8d8ac 100644
--- a/chromium/skia/ext/benchmarking_canvas.cc
+++ b/chromium/skia/ext/benchmarking_canvas.cc
@@ -47,16 +47,15 @@ private:
};
std::unique_ptr<base::Value> AsValue(bool b) {
- std::unique_ptr<base::FundamentalValue> val(new base::FundamentalValue(b));
+ std::unique_ptr<base::Value> val(new base::Value(b));
- return std::move(val);
+ return val;
}
std::unique_ptr<base::Value> AsValue(SkScalar scalar) {
- std::unique_ptr<base::FundamentalValue> val(
- new base::FundamentalValue(scalar));
+ std::unique_ptr<base::Value> val(new base::Value(scalar));
- return std::move(val);
+ return val;
}
std::unique_ptr<base::Value> AsValue(const SkSize& size) {
@@ -121,7 +120,7 @@ std::unique_ptr<base::Value> AsValue(SkBlendMode mode) {
std::unique_ptr<base::StringValue> val(
new base::StringValue(SkBlendMode_Name(mode)));
- return std::move(val);
+ return val;
}
std::unique_ptr<base::Value> AsValue(SkCanvas::PointMode mode) {
@@ -131,7 +130,7 @@ std::unique_ptr<base::Value> AsValue(SkCanvas::PointMode mode) {
std::unique_ptr<base::StringValue> val(
new base::StringValue(gModeStrings[mode]));
- return std::move(val);
+ return val;
}
std::unique_ptr<base::Value> AsValue(const SkColorFilter& filter) {
@@ -210,8 +209,6 @@ std::unique_ptr<base::Value> AsValue(const SkPaint& paint) {
FlagsBuilder builder('|');
builder.addFlag(paint.isAntiAlias(), "AntiAlias");
builder.addFlag(paint.isDither(), "Dither");
- builder.addFlag(paint.isUnderlineText(), "UnderlineText");
- builder.addFlag(paint.isStrikeThruText(), "StrikeThruText");
builder.addFlag(paint.isFakeBoldText(), "FakeBoldText");
builder.addFlag(paint.isLinearText(), "LinearText");
builder.addFlag(paint.isSubpixelText(), "SubpixelText");
@@ -261,7 +258,7 @@ std::unique_ptr<base::Value> SaveLayerFlagsAsValue(
std::unique_ptr<base::StringValue> val(new base::StringValue(builder.str()));
- return std::move(val);
+ return val;
}
std::unique_ptr<base::Value> AsValue(SkClipOp op) {
@@ -276,7 +273,7 @@ std::unique_ptr<base::Value> AsValue(SkClipOp op) {
DCHECK_LT(index, SK_ARRAY_COUNT(gOpStrings));
std::unique_ptr<base::StringValue> val(
new base::StringValue(gOpStrings[index]));
- return std::move(val);
+ return val;
}
std::unique_ptr<base::Value> AsValue(const SkRegion& region) {
diff --git a/chromium/skia/ext/google_logging.cc b/chromium/skia/ext/google_logging.cc
index 673e23ad00c..52add884112 100644
--- a/chromium/skia/ext/google_logging.cc
+++ b/chromium/skia/ext/google_logging.cc
@@ -12,6 +12,10 @@
void SkDebugf_FileLine(const char* file, int line, bool fatal,
const char* format, ...) {
+ int severity = fatal ? logging::LOG_FATAL : logging::LOG_INFO;
+ if (severity < logging::GetMinLogLevel())
+ return;
+
va_list ap;
va_start(ap, format);
@@ -19,7 +23,5 @@ void SkDebugf_FileLine(const char* file, int line, bool fatal,
base::StringAppendV(&msg, format, ap);
va_end(ap);
- logging::LogMessage(file, line,
- fatal ? logging::LOG_FATAL : logging::LOG_INFO).stream()
- << msg;
+ logging::LogMessage(file, line, severity).stream() << msg;
}
diff --git a/chromium/skia/ext/platform_canvas.cc b/chromium/skia/ext/platform_canvas.cc
index e1b63099e64..288e391dc5e 100644
--- a/chromium/skia/ext/platform_canvas.cc
+++ b/chromium/skia/ext/platform_canvas.cc
@@ -10,27 +10,6 @@
#include "third_party/skia/include/core/SkMetaData.h"
#include "third_party/skia/include/core/SkTypes.h"
-namespace {
-
-#if defined(OS_MACOSX)
-const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile";
-
-void SetBoolMetaData(const SkCanvas& canvas, const char* key, bool value) {
- SkMetaData& meta = skia::GetMetaData(canvas);
- meta.setBool(key, value);
-}
-
-bool GetBoolMetaData(const SkCanvas& canvas, const char* key) {
- bool value;
- SkMetaData& meta = skia::GetMetaData(canvas);
- if (!meta.findBool(key, &value))
- value = false;
- return value;
-}
-#endif
-
-} // namespace
-
namespace skia {
SkBitmap ReadPixels(SkCanvas* canvas) {
@@ -61,20 +40,6 @@ size_t PlatformCanvasStrideForWidth(unsigned width) {
return 4 * width;
}
-SkMetaData& GetMetaData(const SkCanvas& canvas) {
- return const_cast<SkCanvas&>(canvas).getMetaData();
-}
-
-#if defined(OS_MACOSX)
-void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview) {
- SetBoolMetaData(canvas, kIsPreviewMetafileKey, is_preview);
-}
-
-bool IsPreviewMetafile(const SkCanvas& canvas) {
- return GetBoolMetaData(canvas, kIsPreviewMetafileKey);
-}
-#endif
-
#if !defined(WIN32)
std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels(
diff --git a/chromium/skia/ext/platform_canvas.h b/chromium/skia/ext/platform_canvas.h
index 11bc398a92d..3946c2f54cd 100644
--- a/chromium/skia/ext/platform_canvas.h
+++ b/chromium/skia/ext/platform_canvas.h
@@ -111,15 +111,6 @@ SK_API SkBitmap ReadPixels(SkCanvas* canvas);
// the pixmap to empty.
SK_API bool GetWritablePixels(SkCanvas* canvas, SkPixmap* pixmap);
-// Following routines are used in print preview workflow to mark the
-// preview metafile.
-SK_API SkMetaData& GetMetaData(const SkCanvas& canvas);
-
-#if defined(OS_MACOSX)
-SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview);
-SK_API bool IsPreviewMetafile(const SkCanvas& canvas);
-#endif
-
} // namespace skia
#endif // SKIA_EXT_PLATFORM_CANVAS_H_
diff --git a/chromium/skia/ext/skia_commit_hash.h b/chromium/skia/ext/skia_commit_hash.h
index 41dda8db61f..f29b9cb28c6 100644
--- a/chromium/skia/ext/skia_commit_hash.h
+++ b/chromium/skia/ext/skia_commit_hash.h
@@ -3,6 +3,6 @@
#ifndef SKIA_EXT_SKIA_COMMIT_HASH_H_
#define SKIA_EXT_SKIA_COMMIT_HASH_H_
-#define SKIA_COMMIT_HASH "dc1e08813c83370fa59fd34322b8b24fe160dafa"
+#define SKIA_COMMIT_HASH "954a6986d5f0136775ea469c3522dda3251af4e9"
#endif // SKIA_EXT_SKIA_COMMIT_HASH_H_
diff --git a/chromium/skia/ext/skia_utils_base.cc b/chromium/skia/ext/skia_utils_base.cc
index c56730bd9bc..041c4c76415 100644
--- a/chromium/skia/ext/skia_utils_base.cc
+++ b/chromium/skia/ext/skia_utils_base.cc
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "skia/ext/skia_utils_base.h"
+
#include <stdint.h>
-#include "skia/ext/skia_utils_base.h"
-#include "third_party/skia/include/core/SkFontLCDConfig.h"
+#include "base/pickle.h"
namespace skia {
@@ -76,30 +77,4 @@ bool WriteSkFontStyle(base::Pickle* pickle, SkFontStyle style) {
pickle->WriteUInt16(style.slant());
}
-SkPixelGeometry ComputeDefaultPixelGeometry() {
- SkFontLCDConfig::LCDOrder order = SkFontLCDConfig::GetSubpixelOrder();
- if (SkFontLCDConfig::kNONE_LCDOrder == order) {
- return kUnknown_SkPixelGeometry;
- }
-
- // Bit0 is RGB(0), BGR(1)
- // Bit1 is H(0), V(1)
- const SkPixelGeometry gGeo[] = {
- kRGB_H_SkPixelGeometry,
- kBGR_H_SkPixelGeometry,
- kRGB_V_SkPixelGeometry,
- kBGR_V_SkPixelGeometry,
- };
- int index = 0;
- if (SkFontLCDConfig::kBGR_LCDOrder == order) {
- index |= 1;
- }
- if (SkFontLCDConfig::kVertical_LCDOrientation ==
- SkFontLCDConfig::GetSubpixelOrientation()) {
- index |= 2;
- }
- return gGeo[index];
-}
-
} // namespace skia
-
diff --git a/chromium/skia/ext/skia_utils_base.h b/chromium/skia/ext/skia_utils_base.h
index 6af5cf7451d..82da02b2b12 100644
--- a/chromium/skia/ext/skia_utils_base.h
+++ b/chromium/skia/ext/skia_utils_base.h
@@ -5,9 +5,12 @@
#ifndef SKIA_EXT_SKIA_UTILS_BASE_H_
#define SKIA_EXT_SKIA_UTILS_BASE_H_
-#include "base/pickle.h"
#include "third_party/skia/include/ports/SkFontConfigInterface.h"
-#include "third_party/skia/include/core/SkSurfaceProps.h"
+
+namespace base {
+class Pickle;
+class PickleIterator;
+}
namespace skia {
@@ -35,10 +38,6 @@ SK_API bool WriteSkFontIdentity(
// Return true if str can be written into the request pickle.
SK_API bool WriteSkFontStyle(base::Pickle* pickle, SkFontStyle style);
-// Determine the default pixel geometry (for LCD) by querying the font host
-SK_API SkPixelGeometry ComputeDefaultPixelGeometry();
-
} // namespace skia
#endif // SKIA_EXT_SKIA_UTILS_BASE_H_
-
diff --git a/chromium/skia/ext/skia_utils_mac.h b/chromium/skia/ext/skia_utils_mac.h
index 8519cba1989..fda4ee98ae7 100644
--- a/chromium/skia/ext/skia_utils_mac.h
+++ b/chromium/skia/ext/skia_utils_mac.h
@@ -14,7 +14,6 @@
struct SkIRect;
struct SkRect;
-class SkCanvas;
class SkMatrix;
#ifdef __LP64__
typedef CGSize NSSize;
@@ -93,48 +92,6 @@ SK_API NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& icon,
// TODO(thakis): Remove this -- http://crbug.com/69432
SK_API NSImage* SkBitmapToNSImage(const SkBitmap& icon);
-// Converts a SkCanvas temporarily to a CGContext
-class SK_API SkiaBitLocker {
- public:
- /**
- User clip rect is an *additional* clip to be applied in addition to the
- current state of the canvas, in *local* rather than device coordinates.
- If no additional clipping is desired, pass in
- SkIRect::MakeSize(canvas->getBaseLayerSize()) transformed by the inverse
- CTM.
- */
- SkiaBitLocker(SkCanvas* canvas,
- const SkIRect& userClipRect,
- SkScalar bitmapScaleFactor = 1);
- ~SkiaBitLocker();
- CGContextRef cgContext();
- bool hasEmptyClipRegion() const;
-
- private:
- void releaseIfNeeded();
- SkIRect computeDirtyRect();
-
- SkCanvas* canvas_;
-
- CGContextRef cgContext_;
- // offscreen_ is only valid if useDeviceBits_ is false
- SkBitmap offscreen_;
- SkIPoint bitmapOffset_;
- SkScalar bitmapScaleFactor_;
-
- // True if we are drawing to |canvas_|'s backing store directly.
- // Otherwise, the bits in |bitmap_| are our allocation and need to
- // be copied over to |canvas_|.
- bool useDeviceBits_;
-
- // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating
- // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not
- // be copied to |canvas_|. This will happen if |canvas_|'s clip region is
- // empty.
- bool bitmapIsDummy_;
-};
-
-
} // namespace skia
#endif // SKIA_EXT_SKIA_UTILS_MAC_H_
diff --git a/chromium/skia/ext/skia_utils_mac.mm b/chromium/skia/ext/skia_utils_mac.mm
index a8102cb8af6..a851888523b 100644
--- a/chromium/skia/ext/skia_utils_mac.mm
+++ b/chromium/skia/ext/skia_utils_mac.mm
@@ -241,126 +241,4 @@ NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) {
return SkBitmapToNSImageWithColorSpace(skiaBitmap, colorSpace.get());
}
-SkiaBitLocker::SkiaBitLocker(SkCanvas* canvas,
- const SkIRect& userClipRect,
- SkScalar bitmapScaleFactor)
- : canvas_(canvas),
- cgContext_(0),
- bitmapScaleFactor_(bitmapScaleFactor),
- useDeviceBits_(false),
- bitmapIsDummy_(false) {
- canvas_->save();
- canvas_->clipRect(SkRect::MakeFromIRect(userClipRect));
-}
-
-SkiaBitLocker::~SkiaBitLocker() {
- releaseIfNeeded();
- canvas_->restore();
-}
-
-SkIRect SkiaBitLocker::computeDirtyRect() {
- // If the user specified a clip region, assume that it was tight and that the
- // dirty rect is approximately the whole bitmap.
- return SkIRect::MakeWH(offscreen_.width(), offscreen_.height());
-}
-
-// This must be called to balance calls to cgContext
-void SkiaBitLocker::releaseIfNeeded() {
- if (!cgContext_)
- return;
- if (!useDeviceBits_ && !bitmapIsDummy_) {
- // Find the bits that were drawn to.
- SkIRect bounds = computeDirtyRect();
- SkBitmap subset;
- if (!offscreen_.extractSubset(&subset, bounds)) {
- return;
- }
- subset.setImmutable(); // Prevents a defensive copy inside Skia.
- canvas_->save();
- canvas_->setMatrix(SkMatrix::I()); // Reset back to device space.
- canvas_->translate(bounds.x() + bitmapOffset_.x(),
- bounds.y() + bitmapOffset_.y());
- canvas_->scale(1.f / bitmapScaleFactor_, 1.f / bitmapScaleFactor_);
- canvas_->drawBitmap(subset, 0, 0);
- canvas_->restore();
- }
- CGContextRelease(cgContext_);
- cgContext_ = 0;
- useDeviceBits_ = false;
- bitmapIsDummy_ = false;
-}
-
-CGContextRef SkiaBitLocker::cgContext() {
- releaseIfNeeded(); // This flushes any prior bitmap use
-
- SkIRect clip_bounds;
- if (!canvas_->getClipDeviceBounds(&clip_bounds)) {
- // If the clip is empty, then there is nothing to draw. The caller may
- // attempt to draw (to-be-clipped) results, so ensure there is a dummy
- // non-NULL CGContext to use.
- bitmapIsDummy_ = true;
- clip_bounds = SkIRect::MakeXYWH(0, 0, 1, 1);
- }
-
- // remember the top/left, in case we need to compose this later
- bitmapOffset_.set(clip_bounds.x(), clip_bounds.y());
-
- // Now make clip_bounds be relative to the current layer/device
- if (!bitmapIsDummy_) {
- canvas_->temporary_internal_describeTopLayer(nullptr, &clip_bounds);
- }
-
- SkPixmap devicePixels;
- skia::GetWritablePixels(canvas_, &devicePixels);
-
- // Only draw directly if we have pixels, and we're only rect-clipped.
- // If not, we allocate an offscreen and draw into that, relying on the
- // compositing step to apply skia's clip.
- useDeviceBits_ = devicePixels.addr() &&
- canvas_->isClipRect() &&
- !bitmapIsDummy_;
- base::ScopedCFTypeRef<CGColorSpaceRef> colorSpace(
- CGColorSpaceCreateDeviceRGB());
-
- int displayHeight;
- if (useDeviceBits_) {
- SkPixmap subset;
- bool result = devicePixels.extractSubset(&subset, clip_bounds);
- DCHECK(result);
- if (!result)
- return 0;
- displayHeight = subset.height();
- cgContext_ = CGBitmapContextCreate(subset.writable_addr(), subset.width(),
- subset.height(), 8, subset.rowBytes(), colorSpace,
- kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
- } else {
- bool result = offscreen_.tryAllocN32Pixels(
- SkScalarCeilToInt(bitmapScaleFactor_ * clip_bounds.width()),
- SkScalarCeilToInt(bitmapScaleFactor_ * clip_bounds.height()));
- DCHECK(result);
- if (!result)
- return 0;
- offscreen_.eraseColor(0);
- displayHeight = offscreen_.height();
- cgContext_ = CGBitmapContextCreate(offscreen_.getPixels(),
- offscreen_.width(), offscreen_.height(), 8, offscreen_.rowBytes(),
- colorSpace, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
- }
- DCHECK(cgContext_);
-
- SkMatrix matrix = canvas_->getTotalMatrix();
- matrix.postTranslate(-SkIntToScalar(bitmapOffset_.x()),
- -SkIntToScalar(bitmapOffset_.y()));
- matrix.postScale(bitmapScaleFactor_, -bitmapScaleFactor_);
- matrix.postTranslate(0, SkIntToScalar(displayHeight));
-
- CGContextConcatCTM(cgContext_, SkMatrixToCGAffineTransform(matrix));
-
- return cgContext_;
-}
-
-bool SkiaBitLocker::hasEmptyClipRegion() const {
- return canvas_->isClipEmpty();
-}
-
} // namespace skia
diff --git a/chromium/skia/ext/skia_utils_mac_unittest.mm b/chromium/skia/ext/skia_utils_mac_unittest.mm
index 64f20491303..f5906be9ef5 100644
--- a/chromium/skia/ext/skia_utils_mac_unittest.mm
+++ b/chromium/skia/ext/skia_utils_mac_unittest.mm
@@ -9,7 +9,6 @@
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
namespace {
@@ -28,14 +27,6 @@ class SkiaUtilsMacTest : public testing::Test {
// Checks that the given bitmap is red.
void TestSkBitmap(const SkBitmap& bitmap);
- enum BitLockerTest {
- TestIdentity = 0,
- TestTranslate = 1,
- TestClip = 2,
- TestXClip = TestTranslate | TestClip,
- };
- void RunBitLockerTest(BitLockerTest test);
-
// If not red, is blue.
// If not tfbit (twenty-four-bit), is 444.
void ShapeHelper(int width, int height, bool isred, bool tfbit);
@@ -130,45 +121,6 @@ void SkiaUtilsMacTest::TestSkBitmap(const SkBitmap& bitmap) {
EXPECT_EQ(255u, SkColorGetA(color));
}
-void SkiaUtilsMacTest::RunBitLockerTest(BitLockerTest test) {
- const unsigned width = 2;
- const unsigned height = 2;
- const unsigned storageSize = width * height;
- const unsigned original[] = {0xFF333333, 0xFF666666, 0xFF999999, 0xFFCCCCCC};
- EXPECT_EQ(storageSize, sizeof(original) / sizeof(original[0]));
- unsigned bits[storageSize];
- memcpy(bits, original, sizeof(original));
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- SkBitmap bitmap;
- bitmap.installPixels(info, bits, info.minRowBytes());
-
- SkCanvas canvas(bitmap);
- if (test & TestTranslate)
- canvas.translate(width / 2, 0);
- if (test & TestClip) {
- SkRect clipRect = {0, height / 2, width, height};
- canvas.clipRect(clipRect);
- }
- {
- SkIRect clip = SkIRect::MakeSize(canvas.getBaseLayerSize()).
- makeOffset((test & TestTranslate) ? - (static_cast<int>(width)) / 2 : 0, 0);
- skia::SkiaBitLocker bitLocker(&canvas, clip);
- CGContextRef cgContext = bitLocker.cgContext();
- CGColorRef testColor = CGColorGetConstantColor(kCGColorWhite);
- CGContextSetFillColorWithColor(cgContext, testColor);
- CGRect cgRect = {{0, 0}, {width, height}};
- CGContextFillRect(cgContext, cgRect);
- }
- const unsigned results[][storageSize] = {
- {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}, // identity
- {0xFF333333, 0xFFFFFFFF, 0xFF999999, 0xFFFFFFFF}, // translate
- {0xFF333333, 0xFF666666, 0xFFFFFFFF, 0xFFFFFFFF}, // clip
- {0xFF333333, 0xFF666666, 0xFF999999, 0xFFFFFFFF} // translate | clip
- };
- for (unsigned index = 0; index < storageSize; index++)
- EXPECT_EQ(results[test][index], bits[index]);
-}
-
void SkiaUtilsMacTest::ShapeHelper(int width, int height,
bool isred, bool tfbit) {
SkBitmap thing(CreateSkBitmap(width, height, isred, tfbit));
@@ -224,21 +176,5 @@ TEST_F(SkiaUtilsMacTest, NSImageRepToSkBitmap) {
TestSkBitmap(bitmap);
}
-TEST_F(SkiaUtilsMacTest, BitLocker_Identity) {
- RunBitLockerTest(SkiaUtilsMacTest::TestIdentity);
-}
-
-TEST_F(SkiaUtilsMacTest, BitLocker_Translate) {
- RunBitLockerTest(SkiaUtilsMacTest::TestTranslate);
-}
-
-TEST_F(SkiaUtilsMacTest, BitLocker_Clip) {
- RunBitLockerTest(SkiaUtilsMacTest::TestClip);
-}
-
-TEST_F(SkiaUtilsMacTest, BitLocker_XClip) {
- RunBitLockerTest(SkiaUtilsMacTest::TestXClip);
-}
-
} // namespace
diff --git a/chromium/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc b/chromium/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc
index 27961faed84..35f18be16bc 100644
--- a/chromium/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc
+++ b/chromium/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc
@@ -51,7 +51,7 @@ sk_sp<SkColorSpace> MojoProfileTypeToSk(skia::mojom::ColorProfileType type) {
case skia::mojom::ColorProfileType::LINEAR:
return nullptr;
case skia::mojom::ColorProfileType::SRGB:
- return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
+ return SkColorSpace::MakeSRGB();
}
NOTREACHED();
return nullptr;