Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag
Bug: skia:7650 Change-Id: I7924efdbbb957c0453c5444796dc31f0b0f7459b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361437 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
fadf91cbd3
commit
5817fe1069
@ -41,10 +41,6 @@
|
||||
#define SK_SUPPORT_LEGACY_DRAWBITMAP
|
||||
#endif
|
||||
|
||||
#ifndef SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING
|
||||
#define SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING
|
||||
#endif
|
||||
|
||||
class GrBackendRenderTarget;
|
||||
class GrRecordingContext;
|
||||
class GrSurfaceDrawContext;
|
||||
|
@ -18,6 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- 4x4 matrices are "downsampled" properly if necessary to 3x3 matrices by removing the third
|
||||
column and the third row.
|
||||
|
||||
## [0.23.0] - 2021-1-29
|
||||
|
||||
### Deprecated
|
||||
- `Canvas.drawImageRect`, `Canvas.drawImage`, `Canvas.drawAtlas`,
|
||||
These rely on the Paint's FilterQuality, which is going away. Pass sampling options explicitly.
|
||||
|
||||
## [0.22.0] - 2020-12-17
|
||||
|
||||
### Added
|
||||
|
@ -874,6 +874,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
||||
self.drawArc(*oval, startAngle, sweepAngle, useCenter, paint);
|
||||
}))
|
||||
// _drawAtlas takes an array of SkColor. There is no SkColor4f override.
|
||||
// TODO: take sampling as an explicit parameter from the caller
|
||||
.function("_drawAtlas", optional_override([](SkCanvas& self,
|
||||
const sk_sp<SkImage>& atlas, uintptr_t /* SkRSXform* */ xptr,
|
||||
uintptr_t /* SkRect* */ rptr, uintptr_t /* SkColor* */ cptr, int count,
|
||||
@ -884,7 +885,6 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
||||
if (cptr) {
|
||||
colors = reinterpret_cast<const SkColor*>(cptr);
|
||||
}
|
||||
// TODO: take sampling as an explicit parameter from the caller
|
||||
SkSamplingOptions sampling(SkFilterMode::kLinear);
|
||||
self.drawAtlas(atlas.get(), dstXforms, srcRects, colors, count, mode, sampling,
|
||||
nullptr, paint);
|
||||
@ -906,7 +906,13 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
||||
uintptr_t /* float* */ innerPtr, const SkPaint& paint) {
|
||||
self.drawDRRect(ptrToSkRRect(outerPtr), ptrToSkRRect(innerPtr), paint);
|
||||
}))
|
||||
.function("drawImage", select_overload<void (const sk_sp<SkImage>&, SkScalar, SkScalar, const SkPaint*)>(&SkCanvas::drawImage), allow_raw_pointers())
|
||||
// TODO: deprecate this version, and require sampling
|
||||
.function("drawImage", optional_override([](SkCanvas& self, const sk_sp<SkImage>& image,
|
||||
SkScalar x, SkScalar y, const SkPaint* paint) {
|
||||
SkSamplingOptions sampling(paint ? paint->getFilterQuality()
|
||||
: kNone_SkFilterQuality);
|
||||
self.drawImage(image.get(), x, y, sampling, paint);
|
||||
}), allow_raw_pointers())
|
||||
.function("drawImageCubic", optional_override([](SkCanvas& self, const sk_sp<SkImage>& img,
|
||||
SkScalar left, SkScalar top,
|
||||
float B, float C, // See SkSamplingOptions.h for docs.
|
||||
@ -922,7 +928,9 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
||||
.function("drawImageAtCurrentFrame", optional_override([](SkCanvas& self, sk_sp<SkAnimatedImage> aImg,
|
||||
SkScalar left, SkScalar top, const SkPaint* paint)->void {
|
||||
auto img = aImg->getCurrentFrame();
|
||||
self.drawImage(img, left, top, paint);
|
||||
SkSamplingOptions sampling(paint ? paint->getFilterQuality()
|
||||
: kNone_SkFilterQuality);
|
||||
self.drawImage(img, left, top, sampling, paint);
|
||||
}), allow_raw_pointers())
|
||||
|
||||
.function("_drawImageNine", optional_override([](SkCanvas& self, const sk_sp<SkImage>& image,
|
||||
@ -933,12 +941,15 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
||||
|
||||
self.drawImageNine(image.get(), *center, *dst, filter, paint);
|
||||
}), allow_raw_pointers())
|
||||
// TODO: deprecate this version, and require sampling
|
||||
.function("_drawImageRect", optional_override([](SkCanvas& self, const sk_sp<SkImage>& image,
|
||||
uintptr_t /* float* */ srcPtr, uintptr_t /* float* */ dstPtr,
|
||||
const SkPaint* paint, bool fastSample)->void {
|
||||
const SkRect* src = reinterpret_cast<const SkRect*>(srcPtr);
|
||||
const SkRect* dst = reinterpret_cast<const SkRect*>(dstPtr);
|
||||
self.drawImageRect(image, *src, *dst, paint,
|
||||
SkSamplingOptions sampling(paint ? paint->getFilterQuality()
|
||||
: kNone_SkFilterQuality);
|
||||
self.drawImageRect(image, *src, *dst, sampling, paint,
|
||||
fastSample ? SkCanvas::kFast_SrcRectConstraint:
|
||||
SkCanvas::kStrict_SrcRectConstraint);
|
||||
}), allow_raw_pointers())
|
||||
|
@ -158,8 +158,9 @@ public:
|
||||
surf->getCanvas()->clear(SK_ColorRED);
|
||||
|
||||
SkRect dstRect = SkRect::MakeXYWH(3*td->fWidth/4, 0, td->fWidth/4, td->fHeight);
|
||||
SkIRect srcRect = SkIRect::MakeWH(td->fWidth/4, td->fHeight);
|
||||
canvas->drawImageRect(surf->makeImageSnapshot(), srcRect, dstRect, &paint);
|
||||
SkRect srcRect = SkRect::MakeIWH(td->fWidth/4, td->fHeight);
|
||||
canvas->drawImageRect(surf->makeImageSnapshot(), srcRect, dstRect, SkSamplingOptions(),
|
||||
&paint, SkCanvas::kStrict_SrcRectConstraint);
|
||||
|
||||
td->fDrawContext->flush();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user