diff options
author | Matt Sarett <msarett@google.com> | 2017-04-27 20:08:39 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-27 20:08:45 +0000 |
commit | 0122af08f6af0dee490e1a4f35b552377d0d4753 (patch) | |
tree | dc2a227b525f067fe8c837cc8d4c5c3480cb69de /tests/BitmapCopyTest.cpp | |
parent | 4b32ab1b7cac09f42b0867f6c63cd8656dd9918d (diff) |
Revert "Delete copyTo(Allocator), hide copyTo() behind flag"
This reverts commit d4a338f4d0a0cdc08d7d3668931c60997f0fa971.
Reason for revert: Looks like I missed something I was supposed to delete in Android.
Original change's description:
> 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>
>
TBR=msarett@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I4d252940cc6a2462b030007055ea6c229471fc6e
Reviewed-on: https://skia-review.googlesource.com/14602
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'tests/BitmapCopyTest.cpp')
-rw-r--r-- | tests/BitmapCopyTest.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index dd5bf1afde..aadf192285 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -9,7 +9,6 @@ #include "SkRect.h" #include "SkTemplates.h" #include "Test.h" -#include "sk_tool_utils.h" static void init_src(const SkBitmap& bitmap) { if (bitmap.getPixels()) { @@ -113,7 +112,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 = sk_tool_utils::copy_to(©, gPairs[j].fColorType, subset); + bool success = subset.copyTo(©, gPairs[j].fColorType); if (!success) { // Skip checking that success matches fValid, which is redundant // with the code below. @@ -237,3 +236,20 @@ 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(©, kN32_SkColorType); + REPORTER_ASSERT(r, success); + REPORTER_ASSERT(r, cs.get() == copy.colorSpace()); +} |