aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-04-27 12:45:45 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-27 17:18:03 +0000
commitd4a338f4d0a0cdc08d7d3668931c60997f0fa971 (patch)
tree676fe5dcd3d19c14c5bf091243cadea35ebef205 /tests
parent9fa99614ec4e695f6e7e9fe19508758757543b8c (diff)
Delete copyTo(Allocator), hide copyTo() behind flag
Replace uses of copyTo() in Skia. Bug: skia:6464 Change-Id: I921dc53a1c29a5176d18f05741f7c0b5a008e548 Reviewed-on: https://skia-review.googlesource.com/14502 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/BitmapCopyTest.cpp20
-rw-r--r--tests/BitmapTest.cpp3
-rw-r--r--tests/CodecAnimTest.cpp4
-rw-r--r--tests/CodecTest.cpp2
4 files changed, 8 insertions, 21 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index aadf192285..dd5bf1afde 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -9,6 +9,7 @@
#include "SkRect.h"
#include "SkTemplates.h"
#include "Test.h"
+#include "sk_tool_utils.h"
static void init_src(const SkBitmap& bitmap) {
if (bitmap.getPixels()) {
@@ -112,7 +113,7 @@ DEF_TEST(BitmapCopy_extractSubset, reporter) {
// Test copying an extracted subset.
for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
SkBitmap copy;
- bool success = subset.copyTo(&copy, gPairs[j].fColorType);
+ bool success = sk_tool_utils::copy_to(&copy, gPairs[j].fColorType, subset);
if (!success) {
// Skip checking that success matches fValid, which is redundant
// with the code below.
@@ -236,20 +237,3 @@ DEF_TEST(BitmapReadPixels, reporter) {
}
}
}
-
-DEF_TEST(BitmapCopy_ColorSpaceMatch, r) {
- // We should support matching color spaces, even if they are parametric.
- SkColorSpaceTransferFn fn;
- fn.fA = 1.f; fn.fB = 0.f; fn.fC = 0.f; fn.fD = 0.f; fn.fE = 0.f; fn.fF = 0.f; fn.fG = 1.8f;
- sk_sp<SkColorSpace> cs = SkColorSpace::MakeRGB(fn, SkColorSpace::kRec2020_Gamut);
-
- SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1, cs);
- SkBitmap bitmap;
- bitmap.allocPixels(info);
- bitmap.eraseColor(0);
-
- SkBitmap copy;
- bool success = bitmap.copyTo(&copy, kN32_SkColorType);
- REPORTER_ASSERT(r, success);
- REPORTER_ASSERT(r, cs.get() == copy.colorSpace());
-}
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index 0d4b785231..e0a7f78d8b 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -9,6 +9,7 @@
#include "SkMallocPixelRef.h"
#include "SkRandom.h"
#include "Test.h"
+#include "sk_tool_utils.h"
static void test_peekpixels(skiatest::Reporter* reporter) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
@@ -137,7 +138,7 @@ DEF_TEST(Bitmap_getColor_Swizzle, r) {
};
for (SkColorType ct : colorTypes) {
SkBitmap copy;
- if (!source.copyTo(&copy, ct)) {
+ if (!sk_tool_utils::copy_to(&copy, ct, source)) {
ERRORF(r, "SkBitmap::copy failed %d", (int)ct);
continue;
}
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
index 79e03bdef8..24b9c13ae9 100644
--- a/tests/CodecAnimTest.cpp
+++ b/tests/CodecAnimTest.cpp
@@ -14,6 +14,7 @@
#include "Resources.h"
#include "Test.h"
+#include "sk_tool_utils.h"
#include <initializer_list>
#include <vector>
@@ -239,7 +240,8 @@ DEF_TEST(Codec_frames, r) {
// First copy the pixels from the cached frame
const int requiredFrame = frameInfos[index].fRequiredFrame;
if (requiredFrame != SkCodec::kNone) {
- const bool success = cachedFrames[requiredFrame].copyTo(bm);
+ const bool success = sk_tool_utils::copy_to(bm, kN32_SkColorType,
+ cachedFrames[requiredFrame]);
REPORTER_ASSERT(r, success);
}
}
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index 7944877702..4a135337a7 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -850,7 +850,7 @@ DEF_TEST(Codec_pngChunkReader, r) {
if (decodedBm.colorType() != bm.colorType()) {
SkBitmap tmp;
- bool success = decodedBm.copyTo(&tmp, bm.colorType());
+ bool success = sk_tool_utils::copy_to(&tmp, bm.colorType(), decodedBm);
REPORTER_ASSERT(r, success);
if (!success) {
return;