| Index: src/core/SkPictureShader.cpp
|
| diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
|
| index 3e0eb65f6fff115286ae9b4a3aa907c2ef8ad50c..73ab170f119cd15948c74fa71b0cde1191b57e56 100644
|
| --- a/src/core/SkPictureShader.cpp
|
| +++ b/src/core/SkPictureShader.cpp
|
| @@ -22,10 +22,9 @@ SkPictureShader::SkPictureShader(const SkPicture* picture, TileMode tmx, TileMod
|
| const SkMatrix* localMatrix, const SkRect* tile)
|
| : INHERITED(localMatrix)
|
| , fPicture(SkRef(picture))
|
| + , fTile(NULL != tile ? *tile : picture->cullRect())
|
| , fTmx(tmx)
|
| , fTmy(tmy) {
|
| - fTile = tile ? *tile : SkRect::MakeWH(SkIntToScalar(picture->width()),
|
| - SkIntToScalar(picture->height()));
|
| }
|
|
|
| #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
|
| @@ -43,8 +42,7 @@ SkPictureShader::~SkPictureShader() {
|
|
|
| SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMode tmy,
|
| const SkMatrix* localMatrix, const SkRect* tile) {
|
| - if (!picture || 0 == picture->width() || 0 == picture->height()
|
| - || (NULL != tile && tile->isEmpty())) {
|
| + if (!picture || picture->cullRect().isEmpty() || (NULL != tile && tile->isEmpty())) {
|
| return NULL;
|
| }
|
| return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile));
|
| @@ -70,7 +68,7 @@ void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
|
| }
|
|
|
| SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatrix* localM) const {
|
| - SkASSERT(fPicture && fPicture->width() > 0 && fPicture->height() > 0);
|
| + SkASSERT(fPicture && !fPicture->cullRect().isEmpty());
|
|
|
| SkMatrix m;
|
| m.setConcat(matrix, this->getLocalMatrix());
|
| @@ -201,9 +199,11 @@ void SkPictureShader::toString(SkString* str) const {
|
| "clamp", "repeat", "mirror"
|
| };
|
|
|
| - str->appendf("PictureShader: [%d:%d] ",
|
| - fPicture ? fPicture->width() : 0,
|
| - fPicture ? fPicture->height() : 0);
|
| + str->appendf("PictureShader: [%f:%f:%f:%f] ",
|
| + fPicture ? fPicture->cullRect().fLeft : 0,
|
| + fPicture ? fPicture->cullRect().fTop : 0,
|
| + fPicture ? fPicture->cullRect().fRight : 0,
|
| + fPicture ? fPicture->cullRect().fBottom : 0);
|
|
|
| str->appendf("(%s, %s)", gTileModeName[fTmx], gTileModeName[fTmy]);
|
|
|
|
|