aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/android
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-06-18 15:11:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-19 02:06:31 +0000
commitf08d1d0ce19c72bb911f059dcf916cf99a0a2467 (patch)
tree65fed059b8bd2b730c86e202cc8475fb60b76455 /src/android
parent93724202640b1f5ae9ccf7646151c9c3bb5afa5c (diff)
Stop using SkTSwap.
Use std::swap instead. It does not appear that any external user specializes SkTSwap, but some may still use it. This removes all use in Skia so that SkTSwap can later be removed in a smaller CL. After that the <utility> include can be removed from SkTypes.h. Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753 Reviewed-on: https://skia-review.googlesource.com/135578 Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/android')
-rw-r--r--src/android/SkAnimatedImage.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/android/SkAnimatedImage.cpp b/src/android/SkAnimatedImage.cpp
index 4885ada117..6bbea6b2e4 100644
--- a/src/android/SkAnimatedImage.cpp
+++ b/src/android/SkAnimatedImage.cpp
@@ -15,6 +15,8 @@
#include "SkPictureRecorder.h"
#include "SkPixelRef.h"
+#include <utility>
+
sk_sp<SkAnimatedImage> SkAnimatedImage::Make(std::unique_ptr<SkAndroidCodec> codec,
SkISize scaledSize, SkIRect cropRect, sk_sp<SkPicture> postProcess) {
if (!codec) {
@@ -114,7 +116,8 @@ bool SkAnimatedImage::Frame::init(const SkImageInfo& info, OnInit onInit) {
}
memcpy(tmp.getPixels(), fBitmap.getPixels(), fBitmap.computeByteSize());
- SkTSwap(tmp, fBitmap);
+ using std::swap;
+ swap(tmp, fBitmap);
return true;
}
}
@@ -213,7 +216,8 @@ int SkAnimatedImage::decodeNextFrame() {
for (Frame* frame : { &fRestoreFrame, &fDecodingFrame }) {
if (frameToDecode == frame->fIndex) {
- SkTSwap(fDisplayFrame, *frame);
+ using std::swap;
+ swap(fDisplayFrame, *frame);
if (animationEnded) {
return this->finish();
}
@@ -236,7 +240,8 @@ int SkAnimatedImage::decodeNextFrame() {
// future.
if (fDecodingFrame.fIndex != SkCodec::kNone &&
!is_restore_previous(fDecodingFrame.fDisposalMethod)) {
- SkTSwap(fDecodingFrame, fRestoreFrame);
+ using std::swap;
+ swap(fDecodingFrame, fRestoreFrame);
}
}
} else {
@@ -262,7 +267,8 @@ int SkAnimatedImage::decodeNextFrame() {
options.fPriorFrame = fDecodingFrame.fIndex;
} else if (validPriorFrame(fRestoreFrame)) {
if (!is_restore_previous(frameInfo.fDisposalMethod)) {
- SkTSwap(fDecodingFrame, fRestoreFrame);
+ using std::swap;
+ swap(fDecodingFrame, fRestoreFrame);
} else if (!fRestoreFrame.copyTo(&fDecodingFrame)) {
SkCodecPrintf("Failed to restore frame\n");
return this->finish();
@@ -289,7 +295,8 @@ int SkAnimatedImage::decodeNextFrame() {
fDecodingFrame.fIndex = frameToDecode;
fDecodingFrame.fDisposalMethod = frameInfo.fDisposalMethod;
- SkTSwap(fDecodingFrame, fDisplayFrame);
+ using std::swap;
+ swap(fDecodingFrame, fDisplayFrame);
fDisplayFrame.fBitmap.notifyPixelsChanged();
if (animationEnded) {