diff options
author | Brian Osman <brianosman@google.com> | 2016-12-14 15:42:36 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-14 21:14:52 +0000 |
commit | 222e9ad98be456c1aa5ef7be38a7ea11a3e3a7f1 (patch) | |
tree | 8d53ea576b8fd8ac99f11a39e2e377b9d380c150 /gm/image_pict.cpp | |
parent | 31c2608e859b1f1c25eeea429f5ab2fee1529fac (diff) |
Make picture backed images sRGB by default
This adds support for playing back a picture image in a different
color space. This is currently limited to just the original space
(sRGB) or legacy mode. I think the best next step is to make them
fully flexible (playing back in the destination surface's space),
but that's going to involve changes to caching logic. I'd like to
keep that separate.
BUG=skia:
Change-Id: I15e6d44e977328b06a4da008ff7b2ed88d851a0b
Reviewed-on: https://skia-review.googlesource.com/5777
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'gm/image_pict.cpp')
-rw-r--r-- | gm/image_pict.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp index 3a84905a9b..7f9454923f 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -221,7 +221,8 @@ public: } } protected: - GrTexture* onGenerateTexture(GrContext* ctx, const SkIRect& subset) override { + GrTexture* onGenerateTexture(GrContext* ctx, const SkImageInfo& info, + const SkIPoint& origin) override { if (ctx) { SkASSERT(ctx == fCtx.get()); } @@ -232,11 +233,13 @@ protected: // need to copy the subset into a new texture GrSurfaceDesc desc = fTexture->desc(); - desc.fWidth = subset.width(); - desc.fHeight = subset.height(); + desc.fWidth = info.width(); + desc.fHeight = info.height(); GrTexture* dst = fCtx->textureProvider()->createTexture(desc, SkBudgeted::kNo); - fCtx->copySurface(dst, fTexture.get(), subset, SkIPoint::Make(0, 0)); + fCtx->copySurface(dst, fTexture.get(), + SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height()), + SkIPoint::Make(0, 0)); return dst; } private: |