aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureShader.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-08-29 08:03:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-29 08:03:56 -0700
commita8d7f0b13cd4c6d773fcf055fe17db75d260fa05 (patch)
tree37e85b212ccd5761b9a736282e75ebf838840798 /src/core/SkPictureShader.cpp
parent77d724c07878b21602e96e095f6a446c429a079a (diff)
Try out scalar picture sizes
This paves the way for removing the 'fTile' parameter from SkPictureShader (although that should be a different CL). If we like this we could also move to providing an entire cull SkRect. R=reed@google.com, mtklein@google.com, fmalita@google.com, fmalita@chromium.org Author: robertphillips@google.com Review URL: https://codereview.chromium.org/513983002
Diffstat (limited to 'src/core/SkPictureShader.cpp')
-rw-r--r--src/core/SkPictureShader.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 3e0eb65f6f..73ab170f11 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]);