Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: src/core/SkLiteDL.cpp

Issue 2205273003: Add onDrawBitmapLattice(), avoid unnecessary bitmap->image copy (Closed) Base URL: https://skia.googlesource.com/skia.git@copypaste
Patch Set: Add support for SkLiteRecorder Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkImageFilter.h" 10 #include "SkImageFilter.h"
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 this->push<DrawImage>(0, SkImage::MakeFromBitmap(bm), x,y, paint); 617 this->push<DrawImage>(0, SkImage::MakeFromBitmap(bm), x,y, paint);
618 } 618 }
619 void SkLiteDL::drawBitmapNine(const SkBitmap& bm, const SkIRect& center, 619 void SkLiteDL::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
620 const SkRect& dst, const SkPaint* paint) { 620 const SkRect& dst, const SkPaint* paint) {
621 this->push<DrawImageNine>(0, SkImage::MakeFromBitmap(bm), center, dst, paint ); 621 this->push<DrawImageNine>(0, SkImage::MakeFromBitmap(bm), center, dst, paint );
622 } 622 }
623 void SkLiteDL::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRec t& dst, 623 void SkLiteDL::drawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRec t& dst,
624 const SkPaint* paint, SkCanvas::SrcRectConstraint constraint) { 624 const SkPaint* paint, SkCanvas::SrcRectConstraint constraint) {
625 this->push<DrawImageRect>(0, SkImage::MakeFromBitmap(bm), src, dst, paint, c onstraint); 625 this->push<DrawImageRect>(0, SkImage::MakeFromBitmap(bm), src, dst, paint, c onstraint);
626 } 626 }
627 void SkLiteDL::drawBitmapLattice(const SkBitmap& bm, const SkCanvas::Lattice& la ttice,
628 const SkRect& dst, const SkPaint* paint) {
629 int xs = lattice.fXCount, ys = lattice.fYCount;
reed1 2016/08/16 11:28:47 minor nit: possibly just call drawImageLattice,so
mtklein 2016/08/16 12:36:05 That can be made correct but will wobble the ref c
msarett 2016/08/16 14:45:37 Will leave as is in this CL.
630 size_t bytes = (xs + ys) * sizeof(int);
631 void* pod = this->push<DrawImageLattice>(bytes, SkImage::MakeFromBitmap(bm), xs, ys, dst,
632 paint);
633 copy_v(pod, lattice.fXDivs, xs,
634 lattice.fYDivs, ys);
635 }
627 636
628 void SkLiteDL::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkP aint* paint) { 637 void SkLiteDL::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkP aint* paint) {
629 this->push<DrawImage>(0, sk_ref_sp(image), x,y, paint); 638 this->push<DrawImage>(0, sk_ref_sp(image), x,y, paint);
630 } 639 }
631 void SkLiteDL::drawImageNine(const SkImage* image, const SkIRect& center, 640 void SkLiteDL::drawImageNine(const SkImage* image, const SkIRect& center,
632 const SkRect& dst, const SkPaint* paint) { 641 const SkRect& dst, const SkPaint* paint) {
633 this->push<DrawImageNine>(0, sk_ref_sp(image), center, dst, paint); 642 this->push<DrawImageNine>(0, sk_ref_sp(image), center, dst, paint);
634 } 643 }
635 void SkLiteDL::drawImageRect(const SkImage* image, const SkRect* src, const SkRe ct& dst, 644 void SkLiteDL::drawImageRect(const SkImage* image, const SkRect* src, const SkRe ct& dst,
636 const SkPaint* paint, SkCanvas::SrcRectConstraint c onstraint) { 645 const SkPaint* paint, SkCanvas::SrcRectConstraint c onstraint) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 } 818 }
810 819
811 void SkLiteDL::PurgeFreelist() { 820 void SkLiteDL::PurgeFreelist() {
812 SkAutoMutexAcquire lock(gFreeStackLock); 821 SkAutoMutexAcquire lock(gFreeStackLock);
813 while (gFreeStack) { 822 while (gFreeStack) {
814 SkLiteDL* top = gFreeStack; 823 SkLiteDL* top = gFreeStack;
815 gFreeStack = gFreeStack->fNext; 824 gFreeStack = gFreeStack->fNext;
816 delete top; // Calling unref() here would just put it back on the list ! 825 delete top; // Calling unref() here would just put it back on the list !
817 } 826 }
818 } 827 }
OLDNEW
« no previous file with comments | « src/core/SkLiteDL.h ('k') | src/core/SkLiteRecorder.h » ('j') | src/pdf/SkPDFCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698