aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-autoroll <android-autoroll@skia-corp.google.com.iam.gserviceaccount.com>2023-12-12 18:49:25 +0000
committerandroid-autoroll <android-autoroll@skia-corp.google.com.iam.gserviceaccount.com>2023-12-12 18:49:25 +0000
commit1b8a7d00279eadd9a35dd57d477f4088e213c726 (patch)
treea045898e36a52d1ad46a4dededcdd690bfe3ab1f
parent6f8a379116900fbc809d8c905df0163e2f4b7fd3 (diff)
parent251c89d49a5c97fe8da09eae940676c836ffbf36 (diff)
downloadskia-1b8a7d00279eadd9a35dd57d477f4088e213c726.tar.gz
Roll Skia from 16298087c277 to 251c89d49a5c (3 revisions)
https://skia.googlesource.com/skia.git/+log/16298087c277..251c89d49a5c 2023-12-12 drott@chromium.org [Fontations] Roll Fontations libraries & CXX 2023-12-12 michaelludwig@google.com [skif] Remove subset parameter from SkSpecialImage::asImage() 2023-12-12 michaelludwig@google.com [skif] SkSpecialImage::draw() no longer virtual, can use fast constraint If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://skia-autoroll.corp.goog/r/android-master-autoroll Please CC djsollen@google.com,rmistry@google.com,scroggo@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Test: Presubmit checks will test this change. Exempt-From-Owner-Approval: The autoroll bot does not require owner approval. Bug: b/299474380 Bug: b/315351386 Bug: b/40045335 Bug: b/186777432 Change-Id: I8be2bb824d55e4f094f000f9a1181b92a9a302a6
-rw-r--r--METADATA2
-rw-r--r--bazel/external/fontations/Cargo.lock24
-rw-r--r--bazel/external/fontations/Cargo.toml6
-rw-r--r--src/core/SkSpecialImage.cpp39
-rw-r--r--src/core/SkSpecialImage.h32
-rw-r--r--src/gpu/ganesh/image/SkSpecialImage_Ganesh.cpp71
-rw-r--r--src/gpu/graphite/SpecialImage_Graphite.cpp22
7 files changed, 40 insertions, 156 deletions
diff --git a/METADATA b/METADATA
index c7c1c991ad..8e44a7f85a 100644
--- a/METADATA
+++ b/METADATA
@@ -9,7 +9,7 @@ third_party {
type: GIT
value: "https://skia.googlesource.com/skia"
}
- version: "16298087c2772faf97e4ee0198bb9532288d5445"
+ version: "251c89d49a5c97fe8da09eae940676c836ffbf36"
license_type: RECIPROCAL
last_upgrade_date {
year: 2023
diff --git a/bazel/external/fontations/Cargo.lock b/bazel/external/fontations/Cargo.lock
index 984b8e07c3..5f3707f460 100644
--- a/bazel/external/fontations/Cargo.lock
+++ b/bazel/external/fontations/Cargo.lock
@@ -13,9 +13,9 @@ dependencies = [
[[package]]
name = "cxx"
-version = "1.0.107"
+version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbe98ba1789d56fb3db3bee5e032774d4f421b685de7ba703643584ba24effbe"
+checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8"
dependencies = [
"cc",
"cxxbridge-flags",
@@ -25,15 +25,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
-version = "1.0.107"
+version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20888d9e1d2298e2ff473cee30efe7d5036e437857ab68bbfea84c74dba91da2"
+checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44"
[[package]]
name = "cxxbridge-macro"
-version = "1.0.107"
+version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fa16a70dd58129e4dfffdff535fb1bce66673f7bbeec4a5a1765a504e1ccd84"
+checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f"
dependencies = [
"proc-macro2",
"quote",
@@ -42,9 +42,9 @@ dependencies = [
[[package]]
name = "font-types"
-version = "0.4.0"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02186306cae98ae594620ea5fb50db3706f54525a35ee9acf61dcac2978b3cba"
+checksum = "0bd7f3ea17572640b606b35df42cfb6ecdf003704b062580e59918692190b73d"
[[package]]
name = "fontations_bridge"
@@ -91,18 +91,18 @@ dependencies = [
[[package]]
name = "read-fonts"
-version = "0.13.0"
+version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1281bfb309996f8057f0b008d313e7330ae14c038c0410ae0cc299a3a5e0e985"
+checksum = "be8b75ea775f573fad01d71eb8c266730f1e0760571fcf63aac3506b53cbec68"
dependencies = [
"font-types",
]
[[package]]
name = "skrifa"
-version = "0.12.0"
+version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc3378514db0b5044d163f8920059e55553e881529d545a2d0fc4eacf153bafa"
+checksum = "16693462e908d7e35ba7644d4a176468eb393b5554643bf3f1aabcbfbcfa4b15"
dependencies = [
"read-fonts",
]
diff --git a/bazel/external/fontations/Cargo.toml b/bazel/external/fontations/Cargo.toml
index a2e1a09926..779a0fe557 100644
--- a/bazel/external/fontations/Cargo.toml
+++ b/bazel/external/fontations/Cargo.toml
@@ -7,10 +7,10 @@ edition = "2021"
version = "0.1.0"
[dependencies]
-read-fonts = "0.13"
+read-fonts = "0.15"
font-types = "0.4"
-skrifa = "0.12"
-cxx = "1.0.107"
+skrifa = "0.15"
+cxx = "1.0.110"
[lib]
name = "fontations_ffi"
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 10e2e9edcf..bedb563d83 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -35,13 +35,15 @@ SkSpecialImage::SkSpecialImage(const SkIRect& subset,
, fProps(props) {
}
-sk_sp<SkImage> SkSpecialImage::asImage(const SkIRect* subset) const {
- if (subset) {
- SkIRect absolute = subset->makeOffset(this->subset().topLeft());
- return this->onAsImage(&absolute);
- } else {
- return this->onAsImage(nullptr);
- }
+void SkSpecialImage::draw(SkCanvas* canvas,
+ SkScalar x, SkScalar y,
+ const SkSamplingOptions& sampling,
+ const SkPaint* paint, bool strict) const {
+ SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset().height());
+
+ canvas->drawImageRect(this->asImage(), SkRect::Make(this->subset()), dst,
+ sampling, paint, strict ? SkCanvas::kStrict_SrcRectConstraint
+ : SkCanvas::kFast_SrcRectConstraint);
}
sk_sp<SkShader> SkSpecialImage::asShader(SkTileMode tileMode,
@@ -74,34 +76,13 @@ public:
size_t getSize() const override { return fBitmap.computeByteSize(); }
- void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkSamplingOptions& sampling,
- const SkPaint* paint) const override {
- SkRect dst = SkRect::MakeXYWH(x, y,
- this->subset().width(), this->subset().height());
-
- canvas->drawImageRect(fBitmap.asImage(), SkRect::Make(this->subset()), dst,
- sampling, paint, SkCanvas::kStrict_SrcRectConstraint);
- }
+ sk_sp<SkImage> asImage() const override { return fBitmap.asImage(); }
sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
// No need to extract subset, onGetROPixels handles that when needed
return SkSpecialImages::MakeFromRaster(subset, fBitmap, this->props());
}
- sk_sp<SkImage> onAsImage(const SkIRect* subset) const override {
- if (subset) {
- SkBitmap subsetBM;
-
- if (!fBitmap.extractSubset(&subsetBM, *subset)) {
- return nullptr;
- }
-
- return subsetBM.asImage();
- }
-
- return fBitmap.asImage();
- }
-
sk_sp<SkShader> onAsShader(SkTileMode tileMode,
const SkSamplingOptions& sampling,
const SkMatrix& lm) const override {
diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h
index 1e63c69e48..89c82bbb91 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -73,9 +73,8 @@ public:
void draw(SkCanvas* canvas,
SkScalar x, SkScalar y,
const SkSamplingOptions& sampling,
- const SkPaint* paint) const {
- return this->onDraw(canvas, x, y, sampling, paint);
- }
+ const SkPaint* paint,
+ bool strict = true) const;
void draw(SkCanvas* canvas, SkScalar x, SkScalar y) const {
this->draw(canvas, x, y, SkSamplingOptions(), nullptr);
}
@@ -91,18 +90,14 @@ public:
}
/**
- * Create an SkImage from the contents of this special image optionally extracting a subset.
- * It may or may not point to the same backing memory.
- * Note: when no 'subset' parameter is specified the the entire SkSpecialImage will be
- * returned - including whatever extra padding may have resulted from a loose fit!
- * When the 'subset' parameter is specified the returned image will be tight even if that
- * entails a copy! The 'subset' is relative to this special image's content rect.
+ * Create an SkImage view of the contents of this special image, pointing to the same
+ * underlying memory.
+ *
+ * TODO: If SkImages::MakeFiltered were to return an SkShader that accounted for the subset
+ * constraint and offset, then this could move to a private virtual for use in draw() and
+ * asShader().
*/
- // TODO: The only version that uses the subset is the tile image filter, and that doesn't need
- // to if it can be rewritten to use asShader() and SkTileModes. Similarly, the only use case of
- // asImage() w/o a subset is SkImage::makeFiltered() and that could/should return an SkShader so
- // that users don't need to worry about correctly applying the subset, etc.
- sk_sp<SkImage> asImage(const SkIRect* subset = nullptr) const;
+ virtual sk_sp<SkImage> asImage() const = 0;
/**
* Create an SkShader that samples the contents of this special image, applying tile mode for
@@ -129,19 +124,10 @@ protected:
const SkColorInfo&,
const SkSurfaceProps&);
- virtual void onDraw(SkCanvas*,
- SkScalar x, SkScalar y,
- const SkSamplingOptions&,
- const SkPaint*) const = 0;
-
// This subset is relative to the backing store's coordinate frame, it has already been mapped
// from the content rect by the non-virtual makeSubset().
virtual sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const = 0;
- // This subset (when not null) is relative to the backing store's coordinate frame, it has
- // already been mapped from the content rect by the non-virtual asImage().
- virtual sk_sp<SkImage> onAsImage(const SkIRect* subset) const = 0;
-
virtual sk_sp<SkShader> onAsShader(SkTileMode,
const SkSamplingOptions&,
const SkMatrix&) const = 0;
diff --git a/src/gpu/ganesh/image/SkSpecialImage_Ganesh.cpp b/src/gpu/ganesh/image/SkSpecialImage_Ganesh.cpp
index 5ad28fab58..2b61fe2510 100644
--- a/src/gpu/ganesh/image/SkSpecialImage_Ganesh.cpp
+++ b/src/gpu/ganesh/image/SkSpecialImage_Ganesh.cpp
@@ -7,45 +7,32 @@
#include "src/gpu/ganesh/image/SkSpecialImage_Ganesh.h"
-#include "include/core/SkCanvas.h"
#include "include/core/SkColorSpace.h" // IWYU pragma: keep
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
-#include "include/core/SkScalar.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkPoint_impl.h"
-#include "include/private/gpu/ganesh/GrImageContext.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/core/SkSpecialImage.h"
-#include "src/gpu/SkBackingFit.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrSurfaceProxyPriv.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/image/GrImageUtils.h"
#include "src/gpu/ganesh/image/SkImage_Ganesh.h"
-#include "src/image/SkImage_Base.h"
#include "src/shaders/SkImageShader.h"
#include <cstddef>
#include <utility>
-class SkPaint;
class SkShader;
struct SkSamplingOptions;
enum SkColorType : int;
enum class SkTileMode;
-static sk_sp<SkImage> wrap_proxy_in_image(GrRecordingContext* context,
- GrSurfaceProxyView view,
- const SkColorInfo& colorInfo) {
- return sk_make_sp<SkImage_Ganesh>(
- sk_ref_sp(context), kNeedNewImageUniqueID, std::move(view), colorInfo);
-}
-
class SkSpecialImage_Gpu final : public SkSpecialImage {
public:
SkSpecialImage_Gpu(GrRecordingContext* context,
@@ -62,30 +49,6 @@ public:
bool isGaneshBacked() const override { return true; }
- void onDraw(SkCanvas* canvas,
- SkScalar x,
- SkScalar y,
- const SkSamplingOptions& sampling,
- const SkPaint* paint) const override {
- SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset().height());
-
- // TODO: In this instance we know we're going to draw a sub-portion of the backing
- // texture into the canvas so it is okay to wrap it in an SkImage. This poses
- // some problems for full deferral however in that when the deferred SkImage_Ganesh
- // instantiates itself it is going to have to either be okay with having a larger
- // than expected backing texture (unlikely) or the 'fit' of the SurfaceProxy needs
- // to be tightened (if it is deferred).
- sk_sp<SkImage> img = sk_sp<SkImage>(new SkImage_Ganesh(
- sk_ref_sp(canvas->recordingContext()), this->uniqueID(), fView, this->colorInfo()));
-
- canvas->drawImageRect(img,
- SkRect::Make(this->subset()),
- dst,
- sampling,
- paint,
- SkCanvas::kStrict_SrcRectConstraint);
- }
-
GrRecordingContext* getContext() const override { return fContext; }
GrSurfaceProxyView view(GrRecordingContext*) const { return fView; }
@@ -95,36 +58,10 @@ public:
fContext, subset, this->uniqueID(), fView, this->colorInfo(), this->props());
}
- sk_sp<SkImage> onAsImage(const SkIRect* subset) const override {
- GrSurfaceProxy* proxy = fView.proxy();
- if (subset) {
- if (proxy->isFunctionallyExact() && *subset == SkIRect::MakeSize(proxy->dimensions())) {
- proxy->priv().exactify(false);
- // The existing GrTexture is already tight so reuse it in the SkImage
- return wrap_proxy_in_image(fContext, fView, this->colorInfo());
- }
-
- auto subsetView = GrSurfaceProxyView::Copy(fContext,
- fView,
- skgpu::Mipmapped::kNo,
- *subset,
- SkBackingFit::kExact,
- skgpu::Budgeted::kYes,
- /*label=*/"SkSpecialImage_AsImage");
- if (!subsetView) {
- return nullptr;
- }
- SkASSERT(subsetView.asTextureProxy());
- SkASSERT(subsetView.proxy()->priv().isExact());
-
- // MDB: this is acceptable (wrapping subsetProxy in an SkImage) bc Copy will
- // return a kExact-backed proxy
- return wrap_proxy_in_image(fContext, std::move(subsetView), this->colorInfo());
- }
-
- proxy->priv().exactify(true);
-
- return wrap_proxy_in_image(fContext, fView, this->colorInfo());
+ sk_sp<SkImage> asImage() const override {
+ fView.proxy()->priv().exactify(true);
+ return sk_make_sp<SkImage_Ganesh>(
+ sk_ref_sp(fContext), this->uniqueID(), fView, this->colorInfo());
}
sk_sp<SkShader> onAsShader(SkTileMode tileMode,
diff --git a/src/gpu/graphite/SpecialImage_Graphite.cpp b/src/gpu/graphite/SpecialImage_Graphite.cpp
index ba9e57dde4..c44438e3b8 100644
--- a/src/gpu/graphite/SpecialImage_Graphite.cpp
+++ b/src/gpu/graphite/SpecialImage_Graphite.cpp
@@ -38,21 +38,6 @@ public:
TextureProxyView textureProxyView() const { return fTextureProxyView; }
- void onDraw(SkCanvas* canvas,
- SkScalar x, SkScalar y,
- const SkSamplingOptions& sampling,
- const SkPaint* paint) const override {
- SkRect dst = SkRect::MakeXYWH(x, y,
- this->subset().width(), this->subset().height());
-
- sk_sp<SkImage> img = sk_sp<SkImage>(new skgpu::graphite::Image(this->uniqueID(),
- fTextureProxyView,
- this->colorInfo()));
-
- canvas->drawImageRect(img, SkRect::Make(this->subset()), dst,
- sampling, paint, SkCanvas::kStrict_SrcRectConstraint);
- }
-
sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
return SkSpecialImages::MakeGraphite(subset,
this->uniqueID(),
@@ -61,12 +46,7 @@ public:
this->props());
}
- sk_sp<SkImage> onAsImage(const SkIRect* subset) const override {
- if (subset) {
- // TODO: fill this in
- return nullptr;
- }
-
+ sk_sp<SkImage> asImage() const override {
return sk_make_sp<Image>(this->uniqueID(), fTextureProxyView, this->colorInfo());
}