aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-10-03 11:02:53 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-04 15:04:37 +0000
commitb25c3522446c9f84369dec2327ed9995fdb326de (patch)
treed70c97848f983c8f8d6bac4e120784fbc47221c5 /src/core
parenta35c68d52ad2694ef6f620a166baf93d4ef45b5b (diff)
SkLiteDL: much simpler to eliminate bitmaps in recorder.
This shouldn't be any significant change in behavior or performance, but it leaves the code in SkLiteDL a bit simpler. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2863 Change-Id: Ifb0023d56f7e9dae172d8021fb956b8fc9281b15 Reviewed-on: https://skia-review.googlesource.com/2863 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkLiteDL.cpp40
-rw-r--r--src/core/SkLiteDL.h16
-rw-r--r--src/core/SkLiteRecorder.cpp16
3 files changed, 21 insertions, 51 deletions
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp
index 701e9bd38f..ea9180bb82 100644
--- a/src/core/SkLiteDL.cpp
+++ b/src/core/SkLiteDL.cpp
@@ -654,48 +654,24 @@ void SkLiteDL::drawShadowedPicture(const SkPicture* picture, const SkMatrix* mat
push<DrawShadowedPicture>(0, picture, matrix, paint, params);
}
-void SkLiteDL::drawBitmap(const SkBitmap& bm, SkScalar x, SkScalar y, const SkPaint* paint) {
- this->push<DrawImage>(0, SkImage::MakeFromBitmap(bm), x,y, paint);
+void SkLiteDL::drawImage(sk_sp<const SkImage> image, SkScalar x, SkScalar y, const SkPaint* paint) {
+ this->push<DrawImage>(0, std::move(image), x,y, paint);
}
-void SkLiteDL::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint) {
- this->push<DrawImageNine>(0, SkImage::MakeFromBitmap(bm), center, dst, paint);
-}
-void SkLiteDL::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst,
- const SkPaint* paint, SkCanvas::SrcRectConstraint constraint) {
- this->push<DrawImageRect>(0, SkImage::MakeFromBitmap(bm), src, dst, paint, constraint);
-}
-void SkLiteDL::drawBitmapLattice(const SkBitmap& bm, const SkCanvas::Lattice& lattice,
- const SkRect& dst, const SkPaint* paint) {
- int xs = lattice.fXCount, ys = lattice.fYCount;
- int fs = lattice.fFlags ? (xs + 1) * (ys + 1) : 0;
- size_t bytes = (xs + ys) * sizeof(int) + fs * sizeof(SkCanvas::Lattice::Flags);
- SkASSERT(lattice.fBounds);
- void* pod = this->push<DrawImageLattice>(bytes, SkImage::MakeFromBitmap(bm), xs, ys, fs,
- *lattice.fBounds, dst, paint);
- copy_v(pod, lattice.fXDivs, xs,
- lattice.fYDivs, ys,
- lattice.fFlags, fs);
-}
-
-void SkLiteDL::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint* paint) {
- this->push<DrawImage>(0, sk_ref_sp(image), x,y, paint);
-}
-void SkLiteDL::drawImageNine(const SkImage* image, const SkIRect& center,
+void SkLiteDL::drawImageNine(sk_sp<const SkImage> image, const SkIRect& center,
const SkRect& dst, const SkPaint* paint) {
- this->push<DrawImageNine>(0, sk_ref_sp(image), center, dst, paint);
+ this->push<DrawImageNine>(0, std::move(image), center, dst, paint);
}
-void SkLiteDL::drawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+void SkLiteDL::drawImageRect(sk_sp<const SkImage> image, const SkRect* src, const SkRect& dst,
const SkPaint* paint, SkCanvas::SrcRectConstraint constraint) {
- this->push<DrawImageRect>(0, sk_ref_sp(image), src, dst, paint, constraint);
+ this->push<DrawImageRect>(0, std::move(image), src, dst, paint, constraint);
}
-void SkLiteDL::drawImageLattice(const SkImage* image, const SkCanvas::Lattice& lattice,
+void SkLiteDL::drawImageLattice(sk_sp<const SkImage> image, const SkCanvas::Lattice& lattice,
const SkRect& dst, const SkPaint* paint) {
int xs = lattice.fXCount, ys = lattice.fYCount;
int fs = lattice.fFlags ? (xs + 1) * (ys + 1) : 0;
size_t bytes = (xs + ys) * sizeof(int) + fs * sizeof(SkCanvas::Lattice::Flags);
SkASSERT(lattice.fBounds);
- void* pod = this->push<DrawImageLattice>(bytes, sk_ref_sp(image), xs, ys, fs, *lattice.fBounds,
+ void* pod = this->push<DrawImageLattice>(bytes, std::move(image), xs, ys, fs, *lattice.fBounds,
dst, paint);
copy_v(pod, lattice.fXDivs, xs,
lattice.fYDivs, ys,
diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h
index 9ed1365b70..3e9eb5e294 100644
--- a/src/core/SkLiteDL.h
+++ b/src/core/SkLiteDL.h
@@ -70,18 +70,12 @@ public:
void drawTextRSXform(const void*, size_t, const SkRSXform[], const SkRect*, const SkPaint&);
void drawTextBlob (const SkTextBlob*, SkScalar,SkScalar, const SkPaint&);
- void drawBitmap (const SkBitmap&, SkScalar, SkScalar, const SkPaint*);
- void drawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&, const SkPaint*);
- void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint*,
- SkCanvas::SrcRectConstraint);
- void drawBitmapLattice(const SkBitmap&, const SkCanvas::Lattice&, const SkRect&,
- const SkPaint*);
-
- void drawImage (const SkImage*, SkScalar,SkScalar, const SkPaint*);
- void drawImageNine(const SkImage*, const SkIRect&, const SkRect&, const SkPaint*);
- void drawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
+ void drawImage (sk_sp<const SkImage>, SkScalar,SkScalar, const SkPaint*);
+ void drawImageNine(sk_sp<const SkImage>, const SkIRect&, const SkRect&, const SkPaint*);
+ void drawImageRect(sk_sp<const SkImage>, const SkRect*, const SkRect&, const SkPaint*,
SkCanvas::SrcRectConstraint);
- void drawImageLattice(const SkImage*, const SkCanvas::Lattice&, const SkRect&, const SkPaint*);
+ void drawImageLattice(sk_sp<const SkImage>, const SkCanvas::Lattice&,
+ const SkRect&, const SkPaint*);
void drawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4],
SkXfermode*, const SkPaint&);
diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp
index 77a1bd7ff3..49b1984c44 100644
--- a/src/core/SkLiteRecorder.cpp
+++ b/src/core/SkLiteRecorder.cpp
@@ -129,43 +129,43 @@ void SkLiteRecorder::onDrawTextBlob(const SkTextBlob* blob,
void SkLiteRecorder::onDrawBitmap(const SkBitmap& bm,
SkScalar x, SkScalar y,
const SkPaint* paint) {
- fDL->drawBitmap(bm, x,y, paint);
+ fDL->drawImage(SkImage::MakeFromBitmap(bm), x,y, paint);
}
void SkLiteRecorder::onDrawBitmapNine(const SkBitmap& bm,
const SkIRect& center, const SkRect& dst,
const SkPaint* paint) {
- fDL->drawBitmapNine(bm, center, dst, paint);
+ fDL->drawImageNine(SkImage::MakeFromBitmap(bm), center, dst, paint);
}
void SkLiteRecorder::onDrawBitmapRect(const SkBitmap& bm,
const SkRect* src, const SkRect& dst,
const SkPaint* paint, SrcRectConstraint constraint) {
- fDL->drawBitmapRect(bm, src, dst, paint, constraint);
+ fDL->drawImageRect(SkImage::MakeFromBitmap(bm), src, dst, paint, constraint);
}
void SkLiteRecorder::onDrawBitmapLattice(const SkBitmap& bm,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint* paint) {
- fDL->drawBitmapLattice(bm, lattice, dst, paint);
+ fDL->drawImageLattice(SkImage::MakeFromBitmap(bm), lattice, dst, paint);
}
void SkLiteRecorder::onDrawImage(const SkImage* img,
SkScalar x, SkScalar y,
const SkPaint* paint) {
- fDL->drawImage(img, x,y, paint);
+ fDL->drawImage(sk_ref_sp(img), x,y, paint);
}
void SkLiteRecorder::onDrawImageNine(const SkImage* img,
const SkIRect& center, const SkRect& dst,
const SkPaint* paint) {
- fDL->drawImageNine(img, center, dst, paint);
+ fDL->drawImageNine(sk_ref_sp(img), center, dst, paint);
}
void SkLiteRecorder::onDrawImageRect(const SkImage* img,
const SkRect* src, const SkRect& dst,
const SkPaint* paint, SrcRectConstraint constraint) {
- fDL->drawImageRect(img, src, dst, paint, constraint);
+ fDL->drawImageRect(sk_ref_sp(img), src, dst, paint, constraint);
}
void SkLiteRecorder::onDrawImageLattice(const SkImage* img,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint* paint) {
- fDL->drawImageLattice(img, lattice, dst, paint);
+ fDL->drawImageLattice(sk_ref_sp(img), lattice, dst, paint);
}