aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureImageGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-12-09 16:51:55 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-12 15:15:15 +0000
commitc87f99ef0649a525471971c4edd8b57fc0f7ef3c (patch)
treea8e06d78794ace90cf2f7c1d6fd0f1c6f082e4e9 /src/core/SkPictureImageGenerator.cpp
parent0e18de9ed6af37ba729fea9696344fb8d3a0fbd2 (diff)
Make subset param to texture generation API non-optional
We were always already supplying this, makes it simpler BUG=skia: Change-Id: I36ac35205df5ab2a0fb7ec26e83ddb1547154816 Reviewed-on: https://skia-review.googlesource.com/5778 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkPictureImageGenerator.cpp')
-rw-r--r--src/core/SkPictureImageGenerator.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index b15fadd818..bf6d53feec 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -26,7 +26,7 @@ protected:
bool onGenerateScaledPixels(const SkISize&, const SkIPoint&, const SkPixmap&) override;
#if SK_SUPPORT_GPU
- GrTexture* onGenerateTexture(GrContext*, const SkIRect*) override;
+ GrTexture* onGenerateTexture(GrContext*, const SkIRect&) override;
#endif
private:
@@ -132,9 +132,9 @@ SkImageGenerator* SkImageGenerator::NewFromPicture(const SkISize& size, const Sk
#if SK_SUPPORT_GPU
#include "GrTexture.h"
-GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const SkIRect* subset) {
+GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const SkIRect& subset) {
const SkImageInfo& info = this->getInfo();
- SkImageInfo surfaceInfo = subset ? info.makeWH(subset->width(), subset->height()) : info;
+ SkImageInfo surfaceInfo = info.makeWH(subset.width(), subset.height());
//
// TODO: respect the usage, by possibly creating a different (pow2) surface
@@ -145,9 +145,7 @@ GrTexture* SkPictureImageGenerator::onGenerateTexture(GrContext* ctx, const SkIR
}
SkMatrix matrix = fMatrix;
- if (subset) {
- matrix.postTranslate(-subset->x(), -subset->y());
- }
+ matrix.postTranslate(-subset.x(), -subset.y());
surface->getCanvas()->clear(0); // does NewRenderTarget promise to do this for us?
surface->getCanvas()->drawPicture(fPicture.get(), &matrix, fPaint.getMaybeNull());
sk_sp<SkImage> image(surface->makeImageSnapshot());