[canvaskit] Make SkImageShader from SkImage
This removes a few src/ includes as well, to avoid using private
implementations like we did.
Change-Id: Ic9a21d04a131c30e17dfca6d8ea45bdefd362aa7
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206062
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/modules/canvaskit/canvaskit_bindings.cpp b/modules/canvaskit/canvaskit_bindings.cpp
index d926144..4981496 100644
--- a/modules/canvaskit/canvaskit_bindings.cpp
+++ b/modules/canvaskit/canvaskit_bindings.cpp
@@ -22,7 +22,6 @@
#include "SkGradientShader.h"
#include "SkImage.h"
#include "SkImageInfo.h"
-#include "SkImageShader.h"
#include "SkMakeUnique.h"
#include "SkMaskFilter.h"
#include "SkPaint.h"
@@ -632,19 +631,6 @@
return SkImage::MakeRasterData(info, pixelData, rowBytes);
}), allow_raw_pointers());
- // Allow localMatrix to be optional, so we have 2 declarations of these shaders
- function("_MakeImageShader", optional_override([](sk_sp<SkImage> img,
- SkTileMode tx, SkTileMode ty,
- bool clampAsIfUnpremul)->sk_sp<SkShader> {
- return SkImageShader::Make(img, (SkTileMode)tx, (SkTileMode)ty, nullptr, clampAsIfUnpremul);
- }), allow_raw_pointers());
- function("_MakeImageShader", optional_override([](sk_sp<SkImage> img,
- SkTileMode tx, SkTileMode ty,
- bool clampAsIfUnpremul, const SimpleMatrix& lm)->sk_sp<SkShader> {
- SkMatrix localMatrix = toSkMatrix(lm);
-
- return SkImageShader::Make(img, (SkTileMode)tx, (SkTileMode)ty, &localMatrix, clampAsIfUnpremul);
- }), allow_raw_pointers());
function("_MakeLinearGradientShader", optional_override([](SkPoint start, SkPoint end,
uintptr_t /* SkColor* */ cPtr, uintptr_t /* SkScalar* */ pPtr,
int count, SkTileMode mode, uint32_t flags)->sk_sp<SkShader> {
@@ -929,7 +915,19 @@
.function("height", &SkImage::height)
.function("width", &SkImage::width)
.function("_encodeToData", select_overload<sk_sp<SkData>()const>(&SkImage::encodeToData))
- .function("_encodeToDataWithFormat", select_overload<sk_sp<SkData>(SkEncodedImageFormat encodedImageFormat, int quality)const>(&SkImage::encodeToData));
+ .function("_encodeToDataWithFormat", select_overload<sk_sp<SkData>(SkEncodedImageFormat encodedImageFormat, int quality)const>(&SkImage::encodeToData))
+ // Allow localMatrix to be optional, so we have 2 declarations of these shaders
+ .function("_makeShader", optional_override([](sk_sp<SkImage> self,
+ SkTileMode tx, SkTileMode ty)->sk_sp<SkShader> {
+ return self->makeShader(tx, ty, nullptr);
+ }), allow_raw_pointers())
+ .function("_makeShader", optional_override([](sk_sp<SkImage> self,
+ SkTileMode tx, SkTileMode ty,
+ const SimpleMatrix& lm)->sk_sp<SkShader> {
+ SkMatrix localMatrix = toSkMatrix(lm);
+
+ return self->makeShader(tx, ty, &localMatrix);
+ }), allow_raw_pointers());
class_<SkMaskFilter>("SkMaskFilter")
.smart_ptr<sk_sp<SkMaskFilter>>("sk_sp<SkMaskFilter>");
@@ -1198,7 +1196,6 @@
.value("Clamp", SkTileMode::kClamp)
.value("Repeat", SkTileMode::kRepeat)
.value("Mirror", SkTileMode::kMirror)
- // Decal mode only works in the SW backend, not WebGl (yet).
.value("Decal", SkTileMode::kDecal);
enum_<SkVertices::VertexMode>("VertexMode")