Remove exotic legacy bitmap drawing entry points: Nine, Lattice
follow-ups: - remove associated virtuals in canvas Change-Id: I3efa7a88ed0905ebf080712993e7f43148df36dc Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276282 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
21beacccb9
commit
fdf94044ff
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "bench/Benchmark.h"
|
||||
#include "include/core/SkBitmap.h"
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkString.h"
|
||||
|
||||
class DrawLatticeBench : public Benchmark {
|
||||
public:
|
||||
DrawLatticeBench(int* xDivs, int xCount, int* yDivs, int yCount, const SkISize& srcSize,
|
||||
const SkRect& dst, const char* desc)
|
||||
: fSrcSize(srcSize)
|
||||
, fDst(dst)
|
||||
{
|
||||
fLattice.fXDivs = xDivs;
|
||||
fLattice.fXCount = xCount;
|
||||
fLattice.fYDivs = yDivs;
|
||||
fLattice.fYCount = yCount;
|
||||
fLattice.fRectTypes = nullptr;
|
||||
fLattice.fBounds = nullptr;
|
||||
fLattice.fColors = nullptr;
|
||||
|
||||
fName = SkStringPrintf("DrawLattice_%s", desc);
|
||||
}
|
||||
|
||||
const char* onGetName() override {
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
SkIPoint onGetSize() override {
|
||||
return SkIPoint::Make(1000, 1000);
|
||||
}
|
||||
|
||||
bool isSuitableFor(Backend backend) override {
|
||||
return kRaster_Backend == backend || kGPU_Backend == backend;
|
||||
}
|
||||
|
||||
void onDelayedSetup() override {
|
||||
fBitmap.allocN32Pixels(fSrcSize.width(), fSrcSize.height());
|
||||
fBitmap.eraseColor(0x880000FF);
|
||||
}
|
||||
|
||||
void onDraw(int loops, SkCanvas* canvas) override {
|
||||
for (int i = 0; i < loops; i++) {
|
||||
canvas->drawBitmapLattice(fBitmap, fLattice, fDst);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SkISize fSrcSize;
|
||||
SkCanvas::Lattice fLattice;
|
||||
SkRect fDst;
|
||||
SkString fName;
|
||||
SkBitmap fBitmap;
|
||||
|
||||
typedef Benchmark INHERITED;
|
||||
};
|
||||
|
||||
static int gDivs9[2] = { 25, 75, };
|
||||
DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 100),
|
||||
SkRect::MakeWH(250.0f, 250.0f), "Src100_Dst250_Rects9");)
|
||||
DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 100),
|
||||
SkRect::MakeWH(500.0f, 500.0f), "Src100_Dst500_Rects9");)
|
||||
DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 100),
|
||||
SkRect::MakeWH(1000.0f, 1000.0f), "Src100_Dst1000_Rects9");)
|
||||
static int gDivs15[4] = { 15, 45, 55, 85, };
|
||||
DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100, 100),
|
||||
SkRect::MakeWH(250.0f, 250.0f), "Src100_Dst250_Rects15");)
|
||||
DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100, 100),
|
||||
SkRect::MakeWH(500.0f, 500.0f), "Src100_Dst500_Rects15");)
|
||||
DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100, 100),
|
||||
SkRect::MakeWH(1000.0f, 1000.0f), "Src100_Dst1000_Rects15");)
|
@ -1,37 +0,0 @@
|
||||
// Copyright 2019 Google LLC.
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
#include "tools/fiddle/examples.h"
|
||||
// HASH=c5bfa944e17ba4a4400dc799f032069c
|
||||
REG_FIDDLE(Canvas_drawBitmapLattice, 256, 128, false, 0) {
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkIRect center = { 20, 10, 50, 40 };
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));
|
||||
SkCanvas bitCanvas(bitmap);
|
||||
SkPaint paint;
|
||||
SkColor gray = 0xFF000000;
|
||||
int left = 0;
|
||||
for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {
|
||||
int top = 0;
|
||||
for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {
|
||||
paint.setColor(gray);
|
||||
bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);
|
||||
gray += 0x001f1f1f;
|
||||
top = bottom;
|
||||
}
|
||||
left = right;
|
||||
}
|
||||
const int xDivs[] = { center.fLeft, center.fRight };
|
||||
const int yDivs[] = { center.fTop, center.fBottom };
|
||||
SkCanvas::Lattice::RectType fillTypes[3][3];
|
||||
memset(fillTypes, 0, sizeof(fillTypes));
|
||||
fillTypes[1][1] = SkCanvas::Lattice::kTransparent;
|
||||
SkColor dummy[9]; // temporary pending bug fix
|
||||
SkCanvas::Lattice lattice = { xDivs, yDivs, fillTypes[0], SK_ARRAY_COUNT(xDivs),
|
||||
SK_ARRAY_COUNT(yDivs), nullptr, dummy };
|
||||
for (auto dest: { 20, 30, 40, 60, 90 } ) {
|
||||
canvas->drawBitmapLattice(bitmap, lattice, SkRect::MakeWH(dest, 110 - dest), nullptr);
|
||||
canvas->translate(dest + 4, 0);
|
||||
}
|
||||
}
|
||||
} // END FIDDLE
|
@ -1,29 +0,0 @@
|
||||
// Copyright 2019 Google LLC.
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
#include "tools/fiddle/examples.h"
|
||||
// HASH=e99e7be0d8f67dfacbecf85df585433d
|
||||
REG_FIDDLE(Canvas_drawBitmapNine, 256, 128, false, 0) {
|
||||
void draw(SkCanvas* canvas) {
|
||||
SkIRect center = { 20, 10, 50, 40 };
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocPixels(SkImageInfo::MakeN32Premul(60, 60));
|
||||
SkCanvas bitCanvas(bitmap);
|
||||
SkPaint paint;
|
||||
SkColor gray = 0xFF000000;
|
||||
int left = 0;
|
||||
for (auto right: { center.fLeft, center.fRight, bitmap.width() } ) {
|
||||
int top = 0;
|
||||
for (auto bottom: { center.fTop, center.fBottom, bitmap.height() } ) {
|
||||
paint.setColor(gray);
|
||||
bitCanvas.drawIRect(SkIRect::MakeLTRB(left, top, right, bottom), paint);
|
||||
gray += 0x001f1f1f;
|
||||
top = bottom;
|
||||
}
|
||||
left = right;
|
||||
}
|
||||
for (auto dest: { 20, 30, 40, 60, 90 } ) {
|
||||
canvas->drawBitmapNine(bitmap, center, SkRect::MakeWH(dest, 110 - dest), nullptr);
|
||||
canvas->translate(dest + 4, 0);
|
||||
}
|
||||
}
|
||||
} // END FIDDLE
|
@ -1375,46 +1375,9 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) {
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
SkBitmap img = make_fuzz_bitmap(fuzz);
|
||||
SkIRect center;
|
||||
SkRect dst;
|
||||
bool usePaint;
|
||||
fuzz->next(&usePaint);
|
||||
if (usePaint) {
|
||||
fuzz_paint(fuzz, &paint, depth - 1);
|
||||
}
|
||||
if (make_fuzz_t<bool>(fuzz)) {
|
||||
fuzz->next(¢er);
|
||||
} else { // Make valid center, see SkLatticeIter::Valid().
|
||||
if (img.width() == 0 || img.height() == 0) {
|
||||
// bitmap may not have had its pixels initialized.
|
||||
break;
|
||||
}
|
||||
fuzz->nextRange(¢er.fLeft, 0, img.width() - 1);
|
||||
fuzz->nextRange(¢er.fTop, 0, img.height() - 1);
|
||||
fuzz->nextRange(¢er.fRight, center.fLeft + 1, img.width());
|
||||
fuzz->nextRange(¢er.fBottom, center.fTop + 1, img.height());
|
||||
}
|
||||
fuzz->next(&dst);
|
||||
canvas->drawBitmapNine(img, center, dst, usePaint ? &paint : nullptr);
|
||||
break;
|
||||
}
|
||||
case 43: {
|
||||
SkBitmap img = make_fuzz_bitmap(fuzz);
|
||||
bool usePaint;
|
||||
SkRect dst;
|
||||
fuzz->next(&usePaint, &dst);
|
||||
if (usePaint) {
|
||||
fuzz_paint(fuzz, &paint, depth - 1);
|
||||
}
|
||||
constexpr int kMax = 6;
|
||||
int xDivs[kMax], yDivs[kMax];
|
||||
SkCanvas::Lattice lattice{xDivs, yDivs, nullptr, 0, 0, nullptr, nullptr};
|
||||
fuzz->nextRange(&lattice.fXCount, 2, kMax);
|
||||
fuzz->nextRange(&lattice.fYCount, 2, kMax);
|
||||
fuzz->nextN(xDivs, lattice.fXCount);
|
||||
fuzz->nextN(yDivs, lattice.fYCount);
|
||||
canvas->drawBitmapLattice(img, lattice, dst, usePaint ? &paint : nullptr);
|
||||
break;
|
||||
}
|
||||
case 44: {
|
||||
|
@ -146,7 +146,7 @@ protected:
|
||||
int i = ix * 2 + iy;
|
||||
SkRect r = SkRect::MakeXYWH(x + ix * 60, y + iy * 60,
|
||||
size[i].width(), size[i].height());
|
||||
canvas->drawBitmapLattice(bitmap, lattice, r);
|
||||
canvas->drawImageLattice(image.get(), lattice, r);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,16 +54,9 @@ static sk_sp<SkImage> make_image(SkCanvas* root, SkIRect* center) {
|
||||
return surface->makeImageSnapshot();
|
||||
}
|
||||
|
||||
static void image_to_bitmap(const SkImage* image, SkBitmap* bm) {
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(image->width(), image->height());
|
||||
bm->allocPixels(info);
|
||||
image->readPixels(info, bm->getPixels(), bm->rowBytes(), 0, 0);
|
||||
}
|
||||
|
||||
class NinePatchStretchGM : public skiagm::GM {
|
||||
public:
|
||||
sk_sp<SkImage> fImage;
|
||||
SkBitmap fBitmap;
|
||||
SkIRect fCenter;
|
||||
|
||||
NinePatchStretchGM() {}
|
||||
@ -78,13 +71,12 @@ protected:
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
if (nullptr == fBitmap.pixelRef() || !fImage->isValid(canvas->getGrContext())) {
|
||||
if (!fImage || !fImage->isValid(canvas->getGrContext())) {
|
||||
fImage = make_image(canvas, &fCenter);
|
||||
image_to_bitmap(fImage.get(), &fBitmap);
|
||||
}
|
||||
|
||||
// amount of bm that should not be stretched (unless we have to)
|
||||
const SkScalar fixed = SkIntToScalar(fBitmap.width() - fCenter.width());
|
||||
const SkScalar fixed = SkIntToScalar(fImage->width() - fCenter.width());
|
||||
|
||||
const SkSize size[] = {
|
||||
{ fixed * 4 / 5, fixed * 4 / 5 }, // shrink in both axes
|
||||
@ -93,7 +85,7 @@ protected:
|
||||
{ fixed * 4, fixed * 4 }
|
||||
};
|
||||
|
||||
canvas->drawBitmap(fBitmap, 10, 10, nullptr);
|
||||
canvas->drawImage(fImage, 10, 10, nullptr);
|
||||
|
||||
SkScalar x = SkIntToScalar(100);
|
||||
SkScalar y = SkIntToScalar(100);
|
||||
@ -107,8 +99,7 @@ protected:
|
||||
int i = ix * 2 + iy;
|
||||
SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed,
|
||||
size[i].width(), size[i].height());
|
||||
canvas->drawBitmapNine(fBitmap, fCenter, r, &paint);
|
||||
canvas->drawImageNine(fImage.get(), fCenter, r.makeOffset(360, 0), &paint);
|
||||
canvas->drawImageNine(fImage.get(), fCenter, r, &paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ bench_sources = [
|
||||
"$_bench/DDLRecorderBench.cpp",
|
||||
"$_bench/DisplacementBench.cpp",
|
||||
"$_bench/DrawBitmapAABench.cpp",
|
||||
"$_bench/DrawLatticeBench.cpp",
|
||||
"$_bench/EncodeBench.cpp",
|
||||
"$_bench/FontCacheBench.cpp",
|
||||
"$_bench/FSRectBench.cpp",
|
||||
|
@ -1813,35 +1813,6 @@ public:
|
||||
void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const SkPaint* paint,
|
||||
SrcRectConstraint constraint = kStrict_SrcRectConstraint);
|
||||
|
||||
/** Draws SkBitmap bitmap stretched proportionally to fit into SkRect dst.
|
||||
SkIRect center divides the bitmap into nine sections: four sides, four corners,
|
||||
and the center. Corners are not scaled, or scaled down proportionately if their
|
||||
sides are larger than dst; center and four sides are scaled to fit remaining
|
||||
space, if any.
|
||||
|
||||
Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
|
||||
|
||||
If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
|
||||
SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
|
||||
If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint
|
||||
SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
|
||||
other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
|
||||
Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
|
||||
|
||||
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
|
||||
just as SkShader made from SkShader::MakeBitmapShader with
|
||||
SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
|
||||
outside of its bounds.
|
||||
|
||||
@param bitmap SkBitmap containing pixels, dimensions, and format
|
||||
@param center SkIRect edge of image corners and sides
|
||||
@param dst destination SkRect of image to draw to
|
||||
@param paint SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
|
||||
and so on; or nullptr
|
||||
*/
|
||||
void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint = nullptr);
|
||||
|
||||
/** \struct SkCanvas::Lattice
|
||||
SkCanvas::Lattice divides SkBitmap or SkImage into a rectangular grid.
|
||||
Grid entries on even columns and even rows are fixed; these entries are
|
||||
@ -1872,37 +1843,6 @@ public:
|
||||
const SkColor* fColors; //!< array of colors
|
||||
};
|
||||
|
||||
/** Draws SkBitmap bitmap stretched proportionally to fit into SkRect dst.
|
||||
|
||||
SkCanvas::Lattice lattice divides bitmap into a rectangular grid.
|
||||
Each intersection of an even-numbered row and column is fixed; like the corners
|
||||
of drawBitmapNine(), fixed lattice elements never scale larger than their initial
|
||||
size and shrink proportionately when all fixed elements exceed the bitmap
|
||||
dimension. All other grid elements scale to fill the available space, if any.
|
||||
|
||||
Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
|
||||
|
||||
If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
|
||||
SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
|
||||
If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint
|
||||
SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
|
||||
other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
|
||||
Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
|
||||
|
||||
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
|
||||
just as SkShader made from SkShader::MakeBitmapShader with
|
||||
SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
|
||||
outside of its bounds.
|
||||
|
||||
@param bitmap SkBitmap containing pixels, dimensions, and format
|
||||
@param lattice division of bitmap into fixed and variable rectangles
|
||||
@param dst destination SkRect of image to draw to
|
||||
@param paint SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
|
||||
and so on; or nullptr
|
||||
*/
|
||||
void drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint* paint = nullptr);
|
||||
|
||||
/** Draws SkImage image stretched proportionally to fit into SkRect dst.
|
||||
|
||||
SkCanvas::Lattice lattice divides image into a rectangular grid.
|
||||
@ -2616,10 +2556,12 @@ protected:
|
||||
const SkPaint* paint);
|
||||
virtual void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
|
||||
const SkPaint* paint, SrcRectConstraint constraint);
|
||||
virtual void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint);
|
||||
virtual void onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint);
|
||||
// REMOVE ME
|
||||
virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect&,
|
||||
const SkRect&, const SkPaint*) {}
|
||||
// REMOVE ME
|
||||
virtual void onDrawBitmapLattice(const SkBitmap&, const Lattice&,
|
||||
const SkRect&, const SkPaint*) {}
|
||||
|
||||
virtual void onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect rect[],
|
||||
const SkColor colors[], int count, SkBlendMode mode,
|
||||
|
@ -76,10 +76,6 @@ protected:
|
||||
void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
|
||||
const SkPaint* paint,
|
||||
SkCanvas::SrcRectConstraint constraint) override = 0;
|
||||
void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint) override = 0;
|
||||
void onDrawBitmapLattice(const SkBitmap& bitmap, const SkCanvas::Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint) override = 0;
|
||||
|
||||
void onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect rect[],
|
||||
const SkColor colors[], int count, SkBlendMode mode, const SkRect* cull,
|
||||
|
@ -50,9 +50,6 @@ public:
|
||||
void onDrawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint*) override;
|
||||
void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*,
|
||||
SrcRectConstraint) override;
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, const SkPaint*) override;
|
||||
void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
|
||||
const SkPaint*) override;
|
||||
void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
|
||||
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
|
||||
|
||||
|
@ -50,8 +50,6 @@ protected:
|
||||
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
|
||||
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWVERTS_VIRTUAL
|
||||
void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
|
||||
SkBlendMode, const SkPaint&) override;
|
||||
|
@ -58,13 +58,9 @@ protected:
|
||||
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
|
||||
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
|
||||
const SkPaint*) override;
|
||||
void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&, const SkPaint*) override;
|
||||
void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWVERTS_VIRTUAL
|
||||
void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
|
||||
SkBlendMode, const SkPaint&) override;
|
||||
|
@ -61,12 +61,8 @@ protected:
|
||||
void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
|
||||
SrcRectConstraint) override {}
|
||||
void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*) override {}
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&,
|
||||
const SkPaint*) override {}
|
||||
void onDrawImageLattice(const SkImage*, const Lattice&, const SkRect&,
|
||||
const SkPaint*) override {}
|
||||
void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
|
||||
const SkPaint*) override {}
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWVERTS_VIRTUAL
|
||||
void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
|
||||
SkBlendMode, const SkPaint&) override {}
|
||||
|
@ -63,10 +63,6 @@ protected:
|
||||
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
|
||||
void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
|
||||
SrcRectConstraint) override;
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
void onDrawBitmapLattice(const SkBitmap&, const Lattice&, const SkRect&,
|
||||
const SkPaint*) override;
|
||||
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
|
||||
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
|
@ -2121,42 +2121,6 @@ void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const S
|
||||
constraint);
|
||||
}
|
||||
|
||||
void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
TRACE_EVENT0("skia", TRACE_FUNC);
|
||||
if (bitmap.drawsNothing() || dst.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) {
|
||||
LatticePaint latticePaint(paint);
|
||||
this->onDrawBitmapNine(bitmap, center, dst, latticePaint.get());
|
||||
} else {
|
||||
this->drawBitmapRect(bitmap, dst, paint);
|
||||
}
|
||||
}
|
||||
|
||||
void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
TRACE_EVENT0("skia", TRACE_FUNC);
|
||||
if (bitmap.drawsNothing() || dst.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SkIRect bounds;
|
||||
Lattice latticePlusBounds = lattice;
|
||||
if (!latticePlusBounds.fBounds) {
|
||||
bounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
|
||||
latticePlusBounds.fBounds = &bounds;
|
||||
}
|
||||
|
||||
if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), latticePlusBounds)) {
|
||||
LatticePaint latticePaint(paint);
|
||||
this->onDrawBitmapLattice(bitmap, latticePlusBounds, dst, latticePaint.get());
|
||||
} else {
|
||||
this->drawBitmapRect(bitmap, dst, paint);
|
||||
}
|
||||
}
|
||||
|
||||
void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
|
||||
const SkColor colors[], int count, SkBlendMode mode,
|
||||
const SkRect* cull, const SkPaint* paint) {
|
||||
@ -2708,29 +2672,6 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
|
||||
DRAW_END
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
SkDEBUGCODE(bitmap.validate();)
|
||||
SkPaint realPaint;
|
||||
paint = init_image_paint(&realPaint, paint);
|
||||
|
||||
if (nullptr == paint || paint->canComputeFastBounds()) {
|
||||
SkRect storage;
|
||||
if (this->quickReject(paint ? paint->computeFastBounds(dst, &storage) : dst)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
DRAW_BEGIN(*paint, &dst)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawBitmapNine(bitmap, center, dst, draw.paint());
|
||||
}
|
||||
|
||||
DRAW_END
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
SkPaint realPaint;
|
||||
@ -2753,28 +2694,6 @@ void SkCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice,
|
||||
DRAW_END
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
SkPaint realPaint;
|
||||
paint = init_image_paint(&realPaint, paint);
|
||||
|
||||
if (nullptr == paint || paint->canComputeFastBounds()) {
|
||||
SkRect storage;
|
||||
if (this->quickReject(paint ? paint->computeFastBounds(dst, &storage) : dst)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
DRAW_BEGIN(*paint, &dst)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawBitmapLattice(bitmap, lattice, dst, draw.paint());
|
||||
}
|
||||
|
||||
DRAW_END
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint) {
|
||||
SkRect storage;
|
||||
|
@ -212,17 +212,6 @@ void SkOverdrawCanvas::onDrawBitmapRect(const SkBitmap&, const SkRect*, const Sk
|
||||
fList[0]->onDrawRect(dst, fPaint);
|
||||
}
|
||||
|
||||
void SkOverdrawCanvas::onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect& dst,
|
||||
const SkPaint*) {
|
||||
fList[0]->onDrawRect(dst, fPaint);
|
||||
}
|
||||
|
||||
void SkOverdrawCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, kNever_SkCopyPixelsMode);
|
||||
this->onDrawImageLattice(image.get(), lattice, dst, paint);
|
||||
}
|
||||
|
||||
void SkOverdrawCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
|
||||
drawable->draw(this, matrix);
|
||||
}
|
||||
|
@ -243,14 +243,6 @@ protected:
|
||||
SrcRectConstraint) override {
|
||||
SK_ABORT("not reached");
|
||||
}
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override {
|
||||
SK_ABORT("not reached");
|
||||
}
|
||||
void onDrawBitmapLattice(const SkBitmap&, const SkCanvas::Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint*) override {
|
||||
SK_ABORT("not reached");
|
||||
}
|
||||
|
||||
private:
|
||||
SkTArray<SkPaint> fPaints;
|
||||
|
@ -214,22 +214,6 @@ void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
|
||||
}
|
||||
}
|
||||
|
||||
void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
|
||||
const SkIRect& center,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
|
||||
if (image) {
|
||||
this->onDrawImageNine(image.get(), center, dst, paint);
|
||||
}
|
||||
}
|
||||
|
||||
void SkRecorder::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
|
||||
this->onDrawImageLattice(image.get(), lattice, dst, paint);
|
||||
}
|
||||
|
||||
void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint) {
|
||||
this->append<SkRecords::DrawImage>(this->copy(paint), sk_ref_sp(image), left, top);
|
||||
|
@ -100,12 +100,8 @@ public:
|
||||
const SkPaint*, SrcRectConstraint) override;
|
||||
void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
void onDrawImageLattice(const SkImage*, const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
void onDrawBitmapLattice(const SkBitmap&, const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWVERTS_VIRTUAL
|
||||
void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
|
||||
SkBlendMode, const SkPaint&) override;
|
||||
|
@ -250,14 +250,6 @@ void SkLuaCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, co
|
||||
}
|
||||
}
|
||||
|
||||
void SkLuaCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
AUTO_LUA("drawBitmapNine");
|
||||
if (paint) {
|
||||
lua.pushPaint(*paint, "paint");
|
||||
}
|
||||
}
|
||||
|
||||
void SkLuaCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint* paint) {
|
||||
AUTO_LUA("drawImage");
|
||||
if (paint) {
|
||||
|
@ -256,22 +256,6 @@ void SkNWayCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, c
|
||||
}
|
||||
}
|
||||
|
||||
void SkNWayCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
Iter iter(fList);
|
||||
while (iter.next()) {
|
||||
iter->drawBitmapNine(bitmap, center, dst, paint);
|
||||
}
|
||||
}
|
||||
|
||||
void SkNWayCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
Iter iter(fList);
|
||||
while (iter.next()) {
|
||||
iter->drawBitmapLattice(bitmap, lattice, dst, paint);
|
||||
}
|
||||
}
|
||||
|
||||
void SkNWayCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint) {
|
||||
Iter iter(fList);
|
||||
|
@ -131,22 +131,6 @@ void SkPaintFilterCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src
|
||||
}
|
||||
}
|
||||
|
||||
void SkPaintFilterCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& center,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
AutoPaintFilter apf(this, paint);
|
||||
if (apf.shouldDraw()) {
|
||||
this->SkNWayCanvas::onDrawBitmapNine(bm, center, dst, &apf.paint());
|
||||
}
|
||||
}
|
||||
|
||||
void SkPaintFilterCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
AutoPaintFilter apf(this, paint);
|
||||
if (apf.shouldDraw()) {
|
||||
this->SkNWayCanvas::onDrawBitmapLattice(bitmap, lattice, dst, &apf.paint());
|
||||
}
|
||||
}
|
||||
|
||||
void SkPaintFilterCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint) {
|
||||
AutoPaintFilter apf(this, paint);
|
||||
|
@ -576,18 +576,11 @@ DEF_TEST(Picture, reporter) {
|
||||
static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
|
||||
const SkPaint paint;
|
||||
const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
|
||||
const SkIRect irect = { 2, 2, 3, 3 };
|
||||
int divs[] = { 2, 3 };
|
||||
SkCanvas::Lattice lattice;
|
||||
lattice.fXCount = lattice.fYCount = 2;
|
||||
lattice.fXDivs = lattice.fYDivs = divs;
|
||||
|
||||
// Don't care what these record, as long as they're legal.
|
||||
canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
|
||||
canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRectConstraint);
|
||||
canvas->drawBitmapNine(bitmap, irect, rect, &paint);
|
||||
canvas->drawBitmap(bitmap, 1, 1); // drawSprite
|
||||
canvas->drawBitmapLattice(bitmap, lattice, rect, &paint);
|
||||
}
|
||||
|
||||
static void test_draw_bitmaps(SkCanvas* canvas) {
|
||||
|
@ -453,7 +453,6 @@ static void test_copy_on_write(skiatest::Reporter* reporter, SkSurface* surface)
|
||||
EXPECT_COPY_ON_WRITE(drawPath(testPath, testPaint))
|
||||
EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0))
|
||||
EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, testRect, nullptr))
|
||||
EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, nullptr))
|
||||
EXPECT_COPY_ON_WRITE(drawString(testText, 0, 1, SkFont(), testPaint))
|
||||
}
|
||||
DEF_TEST(SurfaceCopyOnWrite, reporter) {
|
||||
|
@ -374,13 +374,6 @@ void DebugCanvas::onDrawBitmap(const SkBitmap& bitmap,
|
||||
this->addDrawCommand(new DrawBitmapCommand(bitmap, left, top, paint));
|
||||
}
|
||||
|
||||
void DebugCanvas::onDrawBitmapLattice(const SkBitmap& bitmap,
|
||||
const Lattice& lattice,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
this->addDrawCommand(new DrawBitmapLatticeCommand(bitmap, lattice, dst, paint));
|
||||
}
|
||||
|
||||
void DebugCanvas::onDrawBitmapRect(const SkBitmap& bitmap,
|
||||
const SkRect* src,
|
||||
const SkRect& dst,
|
||||
@ -390,13 +383,6 @@ void DebugCanvas::onDrawBitmapRect(const SkBitmap& bitmap,
|
||||
new DrawBitmapRectCommand(bitmap, src, dst, paint, (SrcRectConstraint)constraint));
|
||||
}
|
||||
|
||||
void DebugCanvas::onDrawBitmapNine(const SkBitmap& bitmap,
|
||||
const SkIRect& center,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint) {
|
||||
this->addDrawCommand(new DrawBitmapNineCommand(bitmap, center, dst, paint));
|
||||
}
|
||||
|
||||
void DebugCanvas::onDrawImage(const SkImage* image,
|
||||
SkScalar left,
|
||||
SkScalar top,
|
||||
|
@ -166,10 +166,6 @@ protected:
|
||||
void onDrawPath(const SkPath&, const SkPaint&) override;
|
||||
void onDrawRegion(const SkRegion&, const SkPaint&) override;
|
||||
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
|
||||
void onDrawBitmapLattice(const SkBitmap&,
|
||||
const Lattice&,
|
||||
const SkRect&,
|
||||
const SkPaint*) override;
|
||||
void onDrawBitmapRect(const SkBitmap&,
|
||||
const SkRect* src,
|
||||
const SkRect& dst,
|
||||
@ -185,10 +181,6 @@ protected:
|
||||
const SkRect& dst,
|
||||
const SkPaint*,
|
||||
SrcRectConstraint) override;
|
||||
void onDrawBitmapNine(const SkBitmap&,
|
||||
const SkIRect& center,
|
||||
const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
void onDrawImageNine(const SkImage*,
|
||||
const SkIRect& center,
|
||||
const SkRect& dst,
|
||||
|
@ -219,8 +219,6 @@ const char* DrawCommand::GetCommandString(OpType type) {
|
||||
case kConcat_OpType: return "Concat";
|
||||
case kDrawAnnotation_OpType: return "DrawAnnotation";
|
||||
case kDrawBitmap_OpType: return "DrawBitmap";
|
||||
case kDrawBitmapLattice_OpType: return "DrawBitmapLattice";
|
||||
case kDrawBitmapNine_OpType: return "DrawBitmapNine";
|
||||
case kDrawBitmapRect_OpType: return "DrawBitmapRect";
|
||||
case kDrawDRRect_OpType: return "DrawDRRect";
|
||||
case kDrawImage_OpType: return "DrawImage";
|
||||
@ -1186,85 +1184,6 @@ void DrawBitmapCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataMana
|
||||
}
|
||||
}
|
||||
|
||||
DrawBitmapLatticeCommand::DrawBitmapLatticeCommand(const SkBitmap& bitmap,
|
||||
const SkCanvas::Lattice& lattice,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint)
|
||||
: INHERITED(kDrawBitmapLattice_OpType)
|
||||
, fBitmap(bitmap)
|
||||
, fLattice(lattice)
|
||||
, fDst(dst)
|
||||
, fPaint(paint) {}
|
||||
|
||||
void DrawBitmapLatticeCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->drawBitmapLattice(fBitmap, fLattice, fDst, fPaint.getMaybeNull());
|
||||
}
|
||||
|
||||
bool DrawBitmapLatticeCommand::render(SkCanvas* canvas) const {
|
||||
SkAutoCanvasRestore acr(canvas, true);
|
||||
canvas->clear(0xFFFFFFFF);
|
||||
|
||||
xlate_and_scale_to_bounds(canvas, fDst);
|
||||
|
||||
this->execute(canvas);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrawBitmapLatticeCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const {
|
||||
INHERITED::toJSON(writer, urlDataManager);
|
||||
writer.beginObject(DEBUGCANVAS_ATTRIBUTE_BITMAP);
|
||||
flatten(fBitmap, writer, urlDataManager);
|
||||
writer.endObject(); // bitmap
|
||||
|
||||
writer.appendName(DEBUGCANVAS_ATTRIBUTE_LATTICE);
|
||||
MakeJsonLattice(writer, fLattice);
|
||||
writer.appendName(DEBUGCANVAS_ATTRIBUTE_DST);
|
||||
MakeJsonRect(writer, fDst);
|
||||
if (fPaint.isValid()) {
|
||||
writer.appendName(DEBUGCANVAS_ATTRIBUTE_PAINT);
|
||||
MakeJsonPaint(writer, *fPaint, urlDataManager);
|
||||
}
|
||||
|
||||
SkString desc;
|
||||
writer.appendString(DEBUGCANVAS_ATTRIBUTE_SHORTDESC, str_append(&desc, fDst)->c_str());
|
||||
}
|
||||
|
||||
DrawBitmapNineCommand::DrawBitmapNineCommand(const SkBitmap& bitmap,
|
||||
const SkIRect& center,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint)
|
||||
: INHERITED(kDrawBitmapNine_OpType)
|
||||
, fBitmap(bitmap)
|
||||
, fCenter(center)
|
||||
, fDst(dst)
|
||||
, fPaint(paint) {}
|
||||
|
||||
void DrawBitmapNineCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaint.getMaybeNull());
|
||||
}
|
||||
|
||||
bool DrawBitmapNineCommand::render(SkCanvas* canvas) const {
|
||||
SkRect tmp = SkRect::Make(fCenter);
|
||||
render_bitmap(canvas, fBitmap, &tmp);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrawBitmapNineCommand::toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const {
|
||||
INHERITED::toJSON(writer, urlDataManager);
|
||||
writer.beginObject(DEBUGCANVAS_ATTRIBUTE_BITMAP);
|
||||
flatten(fBitmap, writer, urlDataManager);
|
||||
writer.endObject(); // bitmap
|
||||
|
||||
writer.appendName(DEBUGCANVAS_ATTRIBUTE_CENTER);
|
||||
MakeJsonIRect(writer, fCenter);
|
||||
writer.appendName(DEBUGCANVAS_ATTRIBUTE_DST);
|
||||
MakeJsonRect(writer, fDst);
|
||||
if (fPaint.isValid()) {
|
||||
writer.appendName(DEBUGCANVAS_ATTRIBUTE_PAINT);
|
||||
MakeJsonPaint(writer, *fPaint, urlDataManager);
|
||||
}
|
||||
}
|
||||
|
||||
DrawBitmapRectCommand::DrawBitmapRectCommand(const SkBitmap& bitmap,
|
||||
const SkRect* src,
|
||||
const SkRect& dst,
|
||||
|
@ -38,8 +38,6 @@ public:
|
||||
kConcat_OpType,
|
||||
kDrawAnnotation_OpType,
|
||||
kDrawBitmap_OpType,
|
||||
kDrawBitmapLattice_OpType,
|
||||
kDrawBitmapNine_OpType,
|
||||
kDrawBitmapRect_OpType,
|
||||
kDrawDRRect_OpType,
|
||||
kDrawImage_OpType,
|
||||
@ -253,44 +251,6 @@ private:
|
||||
typedef DrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class DrawBitmapLatticeCommand : public DrawCommand {
|
||||
public:
|
||||
DrawBitmapLatticeCommand(const SkBitmap& bitmap,
|
||||
const SkCanvas::Lattice& lattice,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint);
|
||||
void execute(SkCanvas* canvas) const override;
|
||||
bool render(SkCanvas* canvas) const override;
|
||||
void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
|
||||
|
||||
private:
|
||||
SkBitmap fBitmap;
|
||||
SkCanvas::Lattice fLattice;
|
||||
SkRect fDst;
|
||||
SkTLazy<SkPaint> fPaint;
|
||||
|
||||
typedef DrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class DrawBitmapNineCommand : public DrawCommand {
|
||||
public:
|
||||
DrawBitmapNineCommand(const SkBitmap& bitmap,
|
||||
const SkIRect& center,
|
||||
const SkRect& dst,
|
||||
const SkPaint* paint);
|
||||
void execute(SkCanvas* canvas) const override;
|
||||
bool render(SkCanvas* canvas) const override;
|
||||
void toJSON(SkJSONWriter& writer, UrlDataManager& urlDataManager) const override;
|
||||
|
||||
private:
|
||||
SkBitmap fBitmap;
|
||||
SkIRect fCenter;
|
||||
SkRect fDst;
|
||||
SkTLazy<SkPaint> fPaint;
|
||||
|
||||
typedef DrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class DrawBitmapRectCommand : public DrawCommand {
|
||||
public:
|
||||
DrawBitmapRectCommand(const SkBitmap& bitmap,
|
||||
|
@ -125,8 +125,6 @@
|
||||
#include "../../docs/examples/Canvas_drawAtlas_3.cpp"
|
||||
#include "../../docs/examples/Canvas_drawAtlas_4.cpp"
|
||||
#include "../../docs/examples/Canvas_drawBitmap.cpp"
|
||||
#include "../../docs/examples/Canvas_drawBitmapLattice.cpp"
|
||||
#include "../../docs/examples/Canvas_drawBitmapNine.cpp"
|
||||
#include "../../docs/examples/Canvas_drawBitmapRect.cpp"
|
||||
#include "../../docs/examples/Canvas_drawBitmapRect_2.cpp"
|
||||
#include "../../docs/examples/Canvas_drawBitmapRect_3.cpp"
|
||||
|
Loading…
Reference in New Issue
Block a user