aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/image.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-02-07 12:31:02 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 18:28:37 +0000
commite8827d254f48ce12df8cd280df3e427170519f47 (patch)
treea826be60d181dc637f75407672fcb299727f61b9 /gm/image.cpp
parent76fff8661f6c3a9133ac9903e0e6d515234598ce (diff)
Address feedback on makeTextureImage
BUG=skia: Whitespace change in public API. Change-Id: Iaab7b0ed6b157b1c246eae5f0f0440b0ae4d72ab Reviewed-on: https://skia-review.googlesource.com/8130 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'gm/image.cpp')
-rw-r--r--gm/image.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/gm/image.cpp b/gm/image.cpp
index 1a4b712491..2b92dfd60e 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -428,11 +428,8 @@ private:
};
DEF_GM( return new ScaleGeneratorGM; )
-DEF_SIMPLE_GM(new_texture_image, canvas, 225, 60) {
- GrContext* context = nullptr;
-#if SK_SUPPORT_GPU
- context = canvas->getGrContext();
-#endif
+DEF_SIMPLE_GM(new_texture_image, canvas, 280, 60) {
+ GrContext* context = canvas->getGrContext();
if (!context) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
@@ -468,6 +465,12 @@ DEF_SIMPLE_GM(new_texture_image, canvas, 225, 60) {
sk_tool_utils::EncodeImageToData(bmp, SkEncodedImageFormat::kPNG, 100));
return SkImage::MakeFromEncoded(std::move(src));
},
+ // Create YUV encoded image.
+ [bmp] {
+ sk_sp<SkData> src(
+ sk_tool_utils::EncodeImageToData(bmp, SkEncodedImageFormat::kJPEG, 100));
+ return SkImage::MakeFromEncoded(std::move(src));
+ },
// Create a picture image.
[render_image] {
SkPictureRecorder recorder;
@@ -495,10 +498,7 @@ DEF_SIMPLE_GM(new_texture_image, canvas, 225, 60) {
canvas->translate(kPad, kPad);
for (auto factory : imageFactories) {
auto image(factory());
- if (!image) {
- continue;
- }
- if (context) {
+ if (image) {
sk_sp<SkImage> texImage(image->makeTextureImage(context,
canvas->imageInfo().colorSpace()));
if (texImage) {