| Index: src/core/SkCanvas.cpp
|
| diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
|
| index 14372611f8cfbed8a667a0a3b9eeedaf853aa17f..1ce0a30534e40c206ed184963049d27152de9111 100644
|
| --- a/src/core/SkCanvas.cpp
|
| +++ b/src/core/SkCanvas.cpp
|
| @@ -1801,6 +1801,39 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPai
|
| this->onDrawSprite(bitmap, left, top, paint);
|
| }
|
|
|
| +#include "SkRSXform.h"
|
| +void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
|
| + const SkColor colors[], int n, const SkRect* cull, const SkPaint* paint) {
|
| +// this->drawImage(atlas, 0, 0, paint);
|
| +
|
| + SkPaint pnt;
|
| + if (paint) {
|
| + pnt = *paint;
|
| + }
|
| +// pnt.setStyle(SkPaint::kStroke_Style);
|
| +
|
| + SkPath path;
|
| + for (int i = 0; i < n; ++i) {
|
| + SkPoint quad[4];
|
| + xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
|
| +
|
| + SkMatrix localM;
|
| + localM.setRSXform(xform[i]);
|
| + localM.preTranslate(-tex[i].left(), -tex[i].top());
|
| +
|
| + pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode,
|
| + &localM))->unref();
|
| + if (colors) {
|
| + pnt.setColorFilter(SkColorFilter::CreateModeFilter(colors[i],
|
| + SkXfermode::kModulate_Mode))->unref();
|
| + }
|
| +
|
| + path.rewind();
|
| + path.addPoly(quad, 4, true);
|
| + this->drawPath(path, pnt);
|
| + }
|
| +}
|
| +
|
| //////////////////////////////////////////////////////////////////////////////
|
| // These are the virtual drawing methods
|
| //////////////////////////////////////////////////////////////////////////////
|
|
|