Bitmap.asImage()

... and lots and lots of IWYU

Change-Id: Ie5157dcdd2e6d29b95c71b39153278ab48ef4eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2020-12-23 10:11:33 -05:00 committed by Skia Commit-Bot
parent cd228e25c7
commit ac9f0c9e27
85 changed files with 120 additions and 54 deletions

View File

@ -6,6 +6,7 @@
*/
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"

View File

@ -6,6 +6,7 @@
*/
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkString.h"

View File

@ -6,6 +6,7 @@
*/
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkSurface.h"

View File

@ -27,9 +27,7 @@ static constexpr int kS = 25;
static void make_images(sk_sp<SkImage> imgs[], int cnt) {
for (int i = 0; i < cnt; ++i) {
SkBitmap bmp =
ToolUtils::create_checkerboard_bitmap(kS, kS, SK_ColorBLACK, SK_ColorCYAN, 10);
imgs[i] = SkImage::MakeFromBitmap(bmp);
imgs[i] = ToolUtils::create_checkerboard_image(kS, kS, SK_ColorBLACK, SK_ColorCYAN, 10);
}
}

View File

@ -7,6 +7,7 @@
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkExecutor.h"
#include "include/core/SkImage.h"

View File

@ -6,6 +6,7 @@
*/
#include "bench/Benchmark.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkString.h"
#include "tools/ToolUtils.h"

View File

@ -6,6 +6,7 @@
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"

View File

@ -181,7 +181,7 @@ sk_sp<SkImage> make_not_native32_color_wheel() {
static_assert(ct != kN32_SkColorType, "BRGA!=RGBA");
SkAssertResult(ToolUtils::copy_to(&notN32bitmap, ct, n32bitmap));
SkASSERT(notN32bitmap.colorType() == ct);
return SkImage::MakeFromBitmap(notN32bitmap);
return notN32bitmap.asImage();
}
DEF_SIMPLE_GM(not_native32_bitmap_config, canvas, SCALE, SCALE) {

View File

@ -41,7 +41,7 @@ static sk_sp<SkColorFilter> make_color_filter() {
}
DEF_SIMPLE_GM(alpha_image, canvas, 256, 256) {
auto image = SkImage::MakeFromBitmap(make_alpha_image(96, 96));
auto image = make_alpha_image(96, 96).asImage();
SkPaint paint;
paint.setColorFilter(make_color_filter());
@ -72,7 +72,7 @@ DEF_SIMPLE_GM(alpha_image_alpha_tint, canvas, 152, 80) {
}
}
bm.setImmutable();
auto image = SkImage::MakeFromBitmap(bm);
auto image = bm.asImage();
SkPaint paint;
paint.setColor4f({ 0, 1, 0, 0.5f });

View File

@ -102,7 +102,7 @@ std::tuple<sk_sp<SkImage>, SkIRect> make_ringed_image(int width, int height) {
scanline[x] = kOuterRingColor;
}
bitmap.setImmutable();
return {SkImage::MakeFromBitmap(bitmap), {2, 2, width - 2, height - 2}};
return {bitmap.asImage(), {2, 2, width - 2, height - 2}};
}
/**

View File

@ -386,7 +386,7 @@ private:
*bmp.getAddr8(x, y) = SkToU8(sk_float_round2int(255.f * result));
}
}
return SkImage::MakeFromBitmap(bmp);
return bmp.asImage();
};
// Number of times to subsample (in both X and Y). If fRecalcMasksForAnimation is true

View File

@ -69,7 +69,7 @@ protected:
SkIntToScalar(y), SK_Scalar1, SK_Scalar1), paint);
}
}
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
// creates a bitmap with shades of transparent gray.
@ -85,7 +85,7 @@ protected:
paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2,
SkTileMode::kClamp));
canvas.drawRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), paint);
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
void onDraw(SkCanvas* canvas) override {

View File

@ -272,8 +272,8 @@ DEF_SIMPLE_GM(composeshader_bitmap2, canvas, 200, 200) {
imageInfo = SkImageInfo::Make(width, height,
SkColorType::kAlpha_8_SkColorType, kPremul_SkAlphaType);
skMask.installPixels(imageInfo, dst8Storage.begin(), width, nullptr, nullptr);
sk_sp<SkImage> skSrc = SkImage::MakeFromBitmap(skBitmap);
sk_sp<SkImage> skMaskImage = SkImage::MakeFromBitmap(skMask);
sk_sp<SkImage> skSrc = skBitmap.asImage();
sk_sp<SkImage> skMaskImage = skMask.asImage();
paint.setShader(
SkShaders::Blend(SkBlendMode::kSrcIn,
skMaskImage->makeShader(SkSamplingOptions()),

View File

@ -1007,7 +1007,7 @@ static SkTArray<sk_sp<ClipTileRenderer>> make_shader_renderers() {
SkBitmap bm;
bm.allocPixels(info);
bm.eraseColor(SK_ColorWHITE);
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bm);
sk_sp<SkImage> image = bm.asImage();
SkTArray<sk_sp<ClipTileRenderer>> renderers;
renderers.push_back(TextureSetRenderer::MakeShader("Gradient", image, gradient, false));

View File

@ -242,8 +242,7 @@ protected:
kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5))));
sk_sp<SkImage> image(SkImage::MakeFromBitmap(bm));
fProc(canvas, image.get(), bm, srcRect, dstRect, &paint);
fProc(canvas, bm.asImage().get(), bm, srcRect, dstRect, &paint);
}
}

View File

@ -38,7 +38,7 @@ static sk_sp<SkImage> make_image(int firstBlackRow, int lastBlackRow) {
bm.setAlphaType(SkAlphaType::kOpaque_SkAlphaType);
bm.setImmutable();
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
// GM to reproduce crbug.com/673261.

View File

@ -329,7 +329,7 @@ DEF_SIMPLE_GPU_GM(new_texture_image, context, rtc, canvas, 280, 60) {
std::function<sk_sp<SkImage>()> imageFactories[] = {
// Create sw raster image.
[bmp] {
return SkImage::MakeFromBitmap(bmp);
return bmp.asImage();
},
// Create encoded image.
[bmp] {

View File

@ -6,6 +6,7 @@
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorSpace.h"
@ -161,7 +162,7 @@ DEF_GM( return new ImageShaderGM; )
static sk_sp<SkImage> make_checker_img(int w, int h, SkColor c0, SkColor c1, int size) {
SkBitmap bm = ToolUtils::create_checkerboard_bitmap(w, h, c0, c1, size);
bm.setImmutable();
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
DEF_SIMPLE_GM(drawimage_sampling, canvas, 500, 500) {

View File

@ -186,7 +186,7 @@ static sk_sp<SkImage> make_img() {
rect.inset(25, 25);
}
return SkImage::MakeFromBitmap(bitmap);
return bitmap.asImage();
}
DEF_SIMPLE_GM_BG(imagealphathreshold_image, canvas, WIDTH * 2, HEIGHT, SK_ColorBLACK) {

View File

@ -6,6 +6,7 @@
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkImage.h"
@ -147,7 +148,7 @@ DEF_SIMPLE_GM(imageblurrepeatunclipped, canvas, 256, 128) {
bmp.eraseArea(SkIRect::MakeWH(100, 10), SK_ColorRED);
bmp.eraseArea(SkIRect::MakeXYWH(0, 10, 100, 10), SK_ColorBLUE);
auto img = SkImage::MakeFromBitmap(bmp);
auto img = bmp.asImage();
auto filter = SkImageFilters::Blur(0, 10, SkTileMode::kRepeat, nullptr);
SkPaint paint;
paint.setImageFilter(std::move(filter));

View File

@ -88,8 +88,8 @@ protected:
}
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap(
ToolUtils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fCheckerboard =
ToolUtils::create_checkerboard_image(64, 64, 0xFFA0A0A0, 0xFF404040, 8);
fGradientCircle = make_gradient_circle(64, 64);
}

View File

@ -38,8 +38,7 @@ protected:
SkISize onISize() override { return SkISize::Make(600, 150); }
void onOnceBeforeDraw() override {
fImage = SkImage::MakeFromBitmap(
ToolUtils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e"));
fImage = ToolUtils::create_string_image(100, 100, SK_ColorWHITE, 20, 70, 96, "e");
}
void onDraw(SkCanvas* canvas) override {

View File

@ -72,8 +72,7 @@ protected:
}
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap(
ToolUtils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fCheckerboard = ToolUtils::create_checkerboard_image(64, 64, 0xFFA0A0A0, 0xFF404040, 8);
fGradientCircle = make_gradient_circle(64, 64);
}

View File

@ -70,8 +70,8 @@ protected:
SkISize onISize() override { return SkISize::Make(420, 240); }
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap(
ToolUtils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fCheckerboard =
ToolUtils::create_checkerboard_image(64, 64, 0xFFA0A0A0, 0xFF404040, 8);
fGradientCircle = make_gradient_circle(64, 64);
}

View File

@ -73,7 +73,7 @@ static sk_sp<SkImage> make_img() {
result.setInfo(SkImageInfo::MakeS32(WIDTH_HEIGHT, WIDTH_HEIGHT, kPremul_SkAlphaType));
result.setPixelRef(sk_ref_sp(bitmap.pixelRef()), 0, 0);
return SkImage::MakeFromBitmap(result);
return result.asImage();
}
DEF_SIMPLE_GM_BG(imagemagnifier_cropped, canvas, WIDTH_HEIGHT, WIDTH_HEIGHT, SK_ColorBLACK) {

View File

@ -48,8 +48,7 @@ protected:
SkISize onISize() override { return SkISize::Make(500, 150); }
void onOnceBeforeDraw() override {
SkBitmap bm = ToolUtils::create_string_bitmap(100, 100, 0xFFFFFFFF, 20, 70, 96, "e");
fImage = SkImage::MakeFromBitmap(bm);
fImage = ToolUtils::create_string_image(100, 100, 0xFFFFFFFF, 20, 70, 96, "e");
}
void onDraw(SkCanvas* canvas) override {

View File

@ -6,6 +6,7 @@
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
@ -119,7 +120,7 @@ DEF_SIMPLE_GM(localmatrixshader_persp, canvas, 542, 266) {
downsized.allocPixels(image->imageInfo().makeWH(128, 128));
image->scalePixels(downsized.pixmap(), SkSamplingOptions(SkFilterMode::kLinear,
SkMipmapMode::kNone));
image = SkImage::MakeFromBitmap(downsized);
image = downsized.asImage();
SkRect imgRect = SkRect::MakeIWH(image->width(), image->height());
// scale matrix

View File

@ -32,7 +32,7 @@ sk_sp<SkImage> make_raster_image(const char* path) {
bitmap.allocPixels(codec->getInfo());
codec->getPixels(codec->getInfo(), bitmap.getPixels(), bitmap.rowBytes());
return SkImage::MakeFromBitmap(bitmap);
return bitmap.asImage();
}
sk_sp<SkImage> make_color_space(

View File

@ -70,7 +70,7 @@ static sk_sp<SkImage> make(sk_sp<SkColorSpace> cs) {
}
}
bm.setImmutable();
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
static void show_mips(SkCanvas* canvas, SkImage* img) {
@ -119,7 +119,7 @@ static sk_sp<SkImage> make_g8_gradient(sk_sp<SkColorSpace> cs) {
}
}
bm.setImmutable();
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
static void show_mips_only(SkCanvas* canvas, SkImage* img) {

View File

@ -44,8 +44,7 @@ protected:
}
void onOnceBeforeDraw() override {
fBitmap = SkImage::MakeFromBitmap(
ToolUtils::create_string_bitmap(80, 80, 0xD000D000, 15, 65, 96, "e"));
fBitmap = ToolUtils::create_string_image(80, 80, 0xD000D000, 15, 65, 96, "e");
fCheckerboard = ToolUtils::create_checkerboard_image(80, 80, 0xFFA0A0A0, 0xFF404040, 8);
}

View File

@ -47,7 +47,7 @@ static sk_sp<SkImage> make_raster_image(SkColorType colorType) {
bitmap.allocPixels(info);
codec->getPixels(info, bitmap.getPixels(), bitmap.rowBytes());
bitmap.setImmutable();
return SkImage::MakeFromBitmap(bitmap);
return bitmap.asImage();
}
static sk_sp<SkImage> make_codec_image() {

View File

@ -6,6 +6,7 @@
*/
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkData.h"
#include "include/core/SkFont.h"

View File

@ -60,7 +60,7 @@ static sk_sp<SkImage> make_image(GrRecordingContext* context, int size, GrSurfac
*bm.getAddr32(2, 1) = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF);
*bm.getAddr32(1, 2) = SkPackARGB32(0xFF, 0x00, 0xFF, 0xFF);
*bm.getAddr32(2, 2) = SkPackARGB32(0xFF, 0x88, 0x88, 0x88);
return SkImage::MakeFromBitmap(bm);
return bm.asImage();
}
/*

View File

@ -47,11 +47,9 @@ protected:
}
void onOnceBeforeDraw() override {
fBitmap = SkImage::MakeFromBitmap(
ToolUtils::create_string_bitmap(50, 50, 0xD000D000, 10, 45, 50, "e"));
fBitmap = ToolUtils::create_string_image(50, 50, 0xD000D000, 10, 45, 50, "e");
fCheckerboard = SkImage::MakeFromBitmap(
ToolUtils::create_checkerboard_bitmap(80, 80, 0xFFA0A0A0, 0xFF404040, 8));
fCheckerboard = ToolUtils::create_checkerboard_image(80, 80, 0xFFA0A0A0, 0xFF404040, 8);
}
void onDraw(SkCanvas* canvas) override {

View File

@ -1066,7 +1066,7 @@ protected:
for (int opaque : { 0, 1 }) {
int y = kPad;
auto raster = SkImage::MakeFromBitmap(fOriginalBMs[opaque])
auto raster = fOriginalBMs[opaque].asImage()
->makeColorSpace(fTargetColorSpace, nullptr);
canvas->drawImage(raster, x, y);
y += kTileWidthHeight + kPad;

View File

@ -48,8 +48,7 @@ protected:
void onOnceBeforeDraw() override {
fBitmap = ToolUtils::create_string_bitmap(80, 80, 0xD000D000, 15, 65, 96, "e");
fCheckerboard = SkImage::MakeFromBitmap(
ToolUtils::create_checkerboard_bitmap(80, 80, 0xFFA0A0A0, 0xFF404040, 8));
fCheckerboard = ToolUtils::create_checkerboard_image(80, 80, 0xFFA0A0A0, 0xFF404040, 8);
}
void onDraw(SkCanvas* canvas) override {
@ -119,7 +118,7 @@ protected:
SkRect clipRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() + 4),
SkIntToScalar(fBitmap.height() + 4));
// Test offsets on SrcMode (uses fixed-function blend)
sk_sp<SkImage> bitmapImage(SkImage::MakeFromBitmap(fBitmap));
sk_sp<SkImage> bitmapImage(fBitmap.asImage());
sk_sp<SkImageFilter> foreground(SkImageFilters::Image(std::move(bitmapImage)));
sk_sp<SkImageFilter> offsetForeground(SkImageFilters::Offset(4, -4, foreground));
sk_sp<SkImageFilter> offsetBackground(SkImageFilters::Offset(4, 4, background));

View File

@ -37,7 +37,6 @@ static sk_sp<SkImage> make_image(GrRecordingContext* rContext) {
}
}
bmp.notifyPixelsChanged();
SkImage::MakeFromBitmap(bmp);
SkDynamicMemoryWStream stream;
SkJpegEncoder::Options options;
options.fDownsample = SkJpegEncoder::Downsample::k420;

View File

@ -17,6 +17,7 @@
#include "include/core/SkShader.h"
#include "include/core/SkTileMode.h"
class SkBitmap;
struct SkMask;
class SkMipmap;
struct SkIRect;
@ -1141,6 +1142,13 @@ public:
return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, localMatrix);
}
#endif
/**
* Returns a new image from the bitmap. If the bitmap is marked immutable, this will
* share the pixel buffer. If not, it will make a copy of the pixels for the image.
*/
sk_sp<SkImage> asImage() const;
/** Asserts if internal values are illegal or inconsistent. Only available if
SK_DEBUG is defined at compile time.
*/

View File

@ -8,11 +8,16 @@
#ifndef SkImageEncoder_DEFINED
#define SkImageEncoder_DEFINED
// TODO: update clients so we can remove this include, they should IWYU
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkEncodedImageFormat.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkStream.h"
class SkBitmap;
/**
* Encode SkPixmap in the given binary image format.
*
@ -39,10 +44,7 @@ SK_API bool SkEncodeImage(SkWStream* dst, const SkPixmap& src,
/**
* The following helper function wraps SkEncodeImage().
*/
inline bool SkEncodeImage(SkWStream* dst, const SkBitmap& src, SkEncodedImageFormat f, int q) {
SkPixmap pixmap;
return src.peekPixels(&pixmap) && SkEncodeImage(dst, pixmap, f, q);
}
SK_API bool SkEncodeImage(SkWStream* dst, const SkBitmap& src, SkEncodedImageFormat f, int q);
/**
* Encode SkPixmap in the given binary image format.

View File

@ -8,6 +8,7 @@
#include "modules/skresources/include/SkResources.h"
#include "include/codec/SkCodec.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkImage.h"
#include "include/private/SkTPin.h"

View File

@ -7,6 +7,7 @@
#include "samplecode/Sample.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFont.h"

View File

@ -617,3 +617,7 @@ bool SkBitmap::peekPixels(SkPixmap* pmap) const {
}
return false;
}
sk_sp<SkImage> SkBitmap::asImage() const {
return SkImage::MakeFromBitmap(*this);
}

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkPathBuilder.h"
#include "include/core/SkRRect.h"

View File

@ -7,6 +7,7 @@
#include "src/core/SkCompressedDataUtils.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkData.h"
#include "include/private/SkColorData.h"

View File

@ -7,6 +7,7 @@
#include "src/core/SkDraw.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "src/core/SkDraw.h"
#include "src/core/SkFontPriv.h"
#include "src/core/SkMatrixProvider.h"

View File

@ -7,6 +7,7 @@
#include "src/core/SkGpuBlurUtils.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkRect.h"
#if SK_SUPPORT_GPU

View File

@ -12,6 +12,8 @@
#include "include/core/SkSurface.h"
#include "include/core/SkTileMode.h"
class SkPixelRef;
enum SkCopyPixelsMode {
kIfMutable_SkCopyPixelsMode, //!< only copy src pixels if they are marked mutable
kAlways_SkCopyPixelsMode, //!< always copy src pixels (even if they are marked immutable)

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkString.h"
#include "include/effects/SkShaderMaskFilter.h"

View File

@ -7,6 +7,7 @@
#include "include/effects/SkArithmeticImageFilter.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/effects/SkXfermodeImageFilter.h"
#include "include/private/SkNx.h"

View File

@ -7,6 +7,7 @@
#include "src/image/SkImage_GpuBase.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkPromiseImageTexture.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPaint.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/encode/SkJpegEncoder.h"
#include "include/encode/SkPngEncoder.h"
#include "include/encode/SkWebpEncoder.h"
@ -28,6 +29,11 @@ std::unique_ptr<SkEncoder> SkPngEncoder::Make(SkWStream*, const SkPixmap&, const
bool SkWebpEncoder::Encode(SkWStream*, const SkPixmap&, const Options&) { return false; }
#endif
bool SkEncodeImage(SkWStream* dst, const SkBitmap& src, SkEncodedImageFormat f, int q) {
SkPixmap pixmap;
return src.peekPixels(&pixmap) && SkEncodeImage(dst, pixmap, f, q);
}
bool SkEncodeImage(SkWStream* dst, const SkPixmap& src,
SkEncodedImageFormat format, int quality) {
#ifdef SK_USE_CG_ENCODER

View File

@ -7,6 +7,7 @@
#include "src/pdf/SkPDFBitmap.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkExecutor.h"
#include "include/core/SkImage.h"

View File

@ -7,6 +7,7 @@
#include "src/pdf/SkPDFUtils.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"

View File

@ -12,6 +12,7 @@
#undef GetGlyphIndices
#include "include/codec/SkCodec.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkFontMetrics.h"
#include "include/core/SkPath.h"
#include "include/private/SkMutex.h"

View File

@ -7,6 +7,7 @@
#include "include/effects/SkPerlinNoiseShader.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkShader.h"
#include "include/core/SkString.h"

View File

@ -7,6 +7,7 @@
#include "include/utils/SkCanvasStateUtils.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "src/core/SkClipOpPriv.h"
#include "src/core/SkDevice.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkImage.h"
#include "include/core/SkRegion.h"
#include "include/effects/SkImageFilters.h"

View File

@ -7,6 +7,7 @@
#include "tests/Test.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkTypeface.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkFontMgr.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
#include "include/core/SkSurfaceCharacterization.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrDirectContext.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTextBlob.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkShader.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkShader.h"

View File

@ -6,6 +6,7 @@
*/
#include "tests/Test.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkExecutor.h"
#include "include/core/SkStream.h"

View File

@ -6,6 +6,7 @@
*/
#include "tests/Test.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkStream.h"

View File

@ -13,6 +13,7 @@ using namespace sk_gpu_test;
#include "tools/gpu/GrContextFactory.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrDirectContext.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrDirectContext.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkImageFilters.h"

View File

@ -5,8 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkTypes.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrDirectContext.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "src/core/SkImagePriv.h"
#include "tests/Test.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkGraphics.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTextBlob.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSemaphore.h"

View File

@ -9,6 +9,7 @@
#include <string>
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFontMgr.h"
#include "include/core/SkGraphics.h"

View File

@ -9,6 +9,7 @@
#include "tests/Test.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkImage.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrDirectContext.h"

View File

@ -13,6 +13,7 @@
#include "include/gpu/vk/GrVkVulkan.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkDrawable.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendDrawableInfo.h"

View File

@ -11,6 +11,7 @@
#if SK_SUPPORT_GPU && defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 && defined(SK_VULKAN)
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"

View File

@ -6,6 +6,7 @@
*/
#include "include/codec/SkCodec.h"
#include "include/core/SkBitmap.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSurface.h"

View File

@ -183,6 +183,11 @@ create_string_bitmap(int w, int h, SkColor c, int x, int y, int textSize, const
return result;
}
sk_sp<SkImage> create_string_image(int w, int h, SkColor c, int x, int y, int textSize,
const char* str) {
return create_string_bitmap(w, h, c, x, y, textSize, str).asImage();
}
void add_to_text_blob_w_len(SkTextBlobBuilder* builder,
const char* text,
size_t len,

View File

@ -114,6 +114,7 @@ inline void draw_checkerboard(SkCanvas* canvas) {
}
SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y, int textSize, const char* str);
sk_sp<SkImage> create_string_image(int w, int h, SkColor c, int x, int y, int textSize, const char* str);
// If the canvas does't make a surface (e.g. recording), make a raster surface
sk_sp<SkSurface> makeSurface(SkCanvas*, const SkImageInfo&, const SkSurfaceProps* = nullptr);

View File

@ -7,6 +7,7 @@
#include "tools/gpu/ManagedBackendTexture.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkImageInfo.h"
#include "include/private/GrTypesPriv.h"
#include "src/core/SkMipmap.h"