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

Unified Diff: src/core/SkPictureShader.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698