| Index: src/core/SkDevice.cpp
|
| diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
|
| index 15cd7eef3b53f66c76e46dd6e804da079346890a..8f7f50c86368ce0639501e0b902a3f33abd4068c 100644
|
| --- a/src/core/SkDevice.cpp
|
| +++ b/src/core/SkDevice.cpp
|
| @@ -5,6 +5,7 @@
|
| * found in the LICENSE file.
|
| */
|
|
|
| +#include "SkColorFilter.h"
|
| #include "SkDevice.h"
|
| #include "SkDraw.h"
|
| #include "SkDrawFilter.h"
|
| @@ -13,6 +14,7 @@
|
| #include "SkPatchUtils.h"
|
| #include "SkPathMeasure.h"
|
| #include "SkRasterClip.h"
|
| +#include "SkRSXform.h"
|
| #include "SkShader.h"
|
| #include "SkTextBlob.h"
|
| #include "SkTextToPathIter.h"
|
| @@ -159,6 +161,37 @@ void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
|
| }
|
| }
|
|
|
| +void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRSXform xform[],
|
| + const SkRect tex[], const SkColor colors[], int count,
|
| + SkXfermode::Mode mode, const SkPaint& paint) {
|
| + SkPath path;
|
| + path.setIsVolatile(true);
|
| +
|
| + for (int i = 0; i < count; ++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());
|
| +
|
| + SkPaint pnt(paint);
|
| + pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode,
|
| + &localM))->unref();
|
| + if (colors && colors[i] != SK_ColorWHITE) {
|
| + SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[i], mode));
|
| + pnt.setColorFilter(cf);
|
| + }
|
| +
|
| + path.rewind();
|
| + path.addPoly(quad, 4, true);
|
| + path.setConvexity(SkPath::kConvex_Convexity);
|
| + this->drawPath(draw, path, pnt, NULL, true);
|
| + }
|
| +}
|
| +
|
| +///////////////////////////////////////////////////////////////////////////////////////////////////
|
| +
|
| bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowBytes, int x, int y) {
|
| #ifdef SK_DEBUG
|
| SkASSERT(info.width() > 0 && info.height() > 0);
|
|
|