aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageGenerator.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-03-03 11:10:18 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-03 17:40:52 +0000
commit4447b64a88ea141161fca772c2fec28b6141bbc3 (patch)
treefce75d30623892dfe7271acdd671623240302e10 /src/core/SkImageGenerator.cpp
parent3c6d5b0daa8c9ff1137bb2ef9b00a712bb3a47c2 (diff)
Switch SkImageGenerator over to generating GrTextureProxies
It does not seem irrational for generateTexture to always receive a valid GrContext. lockAsBitmap can do as it pleases. This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors) Change-Id: I8aebc813a8a3a7d694b7369c2c9810e2164fe16e Reviewed-on: https://skia-review.googlesource.com/9191 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/core/SkImageGenerator.cpp')
-rw-r--r--src/core/SkImageGenerator.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 77f2c38618..18a6ce2669 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -77,8 +77,11 @@ bool SkImageGenerator::getYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes
return this->onGetYUV8Planes(sizeInfo, planes);
}
-GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, const SkImageInfo& info,
- const SkIPoint& origin) {
+#if SK_SUPPORT_GPU
+#include "GrTextureProxy.h"
+
+sk_sp<GrTextureProxy> SkImageGenerator::generateTexture(GrContext* ctx, const SkImageInfo& info,
+ const SkIPoint& origin) {
SkIRect srcRect = SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height());
if (!SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(srcRect)) {
return nullptr;
@@ -86,6 +89,12 @@ GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, const SkImageInfo&
return this->onGenerateTexture(ctx, info, origin);
}
+sk_sp<GrTextureProxy> SkImageGenerator::onGenerateTexture(GrContext*, const SkImageInfo&,
+ const SkIPoint&) {
+ return nullptr;
+}
+#endif
+
/////////////////////////////////////////////////////////////////////////////////////////////
SkData* SkImageGenerator::onRefEncodedData(GrContext* ctx) {