Remove drawImageAtCurrentFrame

Unused by flutter
Would need variants for sampling options
Easy for clients to achieve this with other APIs

Change-Id: Ia8b29f5183f5b729b62ef35e87897d5312b38da5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427197
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-07-12 15:11:35 -04:00 committed by Skia Commit-Bot
parent 7f56b41fc0
commit bccbec3147
5 changed files with 11 additions and 25 deletions

View File

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Breaking
- Paint.getBlendMode() has been removed.
- Canvas.drawImageAtCurrentFrame() has been removed.
## [0.28.1] - 2021-06-28

View File

@ -930,13 +930,6 @@ EMSCRIPTEN_BINDINGS(Skia) {
const SkPaint* paint)->void {
self.drawImage(img.get(), left, top, {filter, mipmap}, paint);
}), allow_raw_pointers())
.function("drawImageAtCurrentFrame", optional_override([](SkCanvas& self, sk_sp<SkAnimatedImage> aImg,
SkScalar left, SkScalar top, const SkPaint* paint)->void {
auto img = aImg->getCurrentFrame();
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,
WASMPointerU32 centerPtr, WASMPointerF32 dstPtr,

View File

@ -205,7 +205,6 @@ var CanvasKit = {
drawImage: function() {},
drawImageCubic: function() {},
drawImageOptions: function() {},
drawImageAtCurrentFrame: function() {},
drawLine: function() {},
drawPaint: function() {},
drawParagraph: function() {},

View File

@ -1213,17 +1213,6 @@ export interface Canvas extends EmbindObject<Canvas> {
drawImageOptions(img: Image, left: number, top: number, fm: FilterMode,
mm: MipmapMode, paint: Paint | null): void;
/**
* Draws the current frame of the given animated image with its top-left corner at
* (left, top) using the current clip, the current matrix, and optionally-provided paint.
* @param aImg
* @param left
* @param top
* @param paint
*/
drawImageAtCurrentFrame(aImg: AnimatedImage, left: number, top: number,
paint?: Paint): void;
/**
* Draws the provided image stretched proportionally to fit into dst rectangle.
* The center rectangle divides the image into nine sections: four sides, four corners, and

View File

@ -173,23 +173,27 @@ describe('Core canvas behavior', () => {
expect(aImg.height()).toEqual(240);
expect(aImg.getFrameCount()).toEqual(60);
let img = aImg.makeImageAtCurrentFrame();
canvas.drawImage(img, 0, 0, null);
img.delete(); // This is annoying, so we added drawImageAtCurrentFrame
const drawCurrentFrame = function(x, y) {
let img = aImg.makeImageAtCurrentFrame();
canvas.drawImage(img, x, y, null);
img.delete();
}
drawCurrentFrame(0, 0);
let c = aImg.decodeNextFrame();
expect(c).not.toEqual(-1);
canvas.drawImageAtCurrentFrame(aImg, 300, 0, null);
drawCurrentFrame(300, 0);
for(let i = 0; i < 10; i++) {
c = aImg.decodeNextFrame();
expect(c).not.toEqual(-1);
}
canvas.drawImageAtCurrentFrame(aImg, 0, 300, null);
drawCurrentFrame(0, 300);
for(let i = 0; i < 10; i++) {
c = aImg.decodeNextFrame();
expect(c).not.toEqual(-1);
}
canvas.drawImageAtCurrentFrame(aImg, 300, 300, null);
drawCurrentFrame(300, 300);
aImg.delete();
}, '/assets/flightAnim.gif');