c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
/*
|
|
* Copyright 2015 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "include/core/SkImage.h"
|
|
#include "include/core/SkRegion.h"
|
|
#include "include/effects/SkAlphaThresholdFilter.h"
|
|
#include "tests/Test.h"
|
|
|
|
static void test_flattenable(skiatest::Reporter* r,
|
|
const SkFlattenable* f,
|
|
const char* desc) {
|
|
if (f) {
|
|
SkFlattenable::Factory factory = f->getFactory();
|
|
REPORTER_ASSERT(r, factory);
|
|
if (factory) {
|
|
if (!SkFlattenable::FactoryToName(factory)) {
|
|
ERRORF(r, "SkFlattenable::FactoryToName() fails with %s.", desc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
DEF_TEST(FlattenableFactoryToName, r) {
|
|
SkIRect rects[2];
|
|
rects[0] = SkIRect::MakeXYWH(0, 150, 500, 200);
|
|
rects[1] = SkIRect::MakeXYWH(150, 0, 200, 500);
|
|
SkRegion region;
|
|
region.setRects(rects, 2);
|
|
sk_sp<SkImageFilter> filter(SkAlphaThresholdFilter::Make(region, 0.2f, 0.7f, nullptr));
|
|
test_flattenable(r, filter.get(), "SkAlphaThresholdFilter()");
|
|
|
|
SkBitmap bm;
|
|
bm.allocN32Pixels(8, 8);
|
|
bm.eraseColor(SK_ColorCYAN);
|
|
sk_sp<SkImage> image(SkImage::MakeFromBitmap(bm));
|
|
test_flattenable(r, image->makeShader().get(), "SkImage::newShader()");
|
|
}
|