skia2/docs/examples/Image_MakeCrossContextFromPixmap.cpp
Brian Osman 4c3fd34e00 Remove MakeCrossContextFromEncoded, unused argument from ...FromPixmap
Change-Id: I962e923a4994eb549a9c1002323f33d05b936b84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234912
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-08-15 17:10:28 +00:00

15 lines
568 B
C++

// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
// HASH=45bca8747b8f49b5be34b520897ef048
REG_FIDDLE(Image_MakeCrossContextFromPixmap, 256, 64, false, 4) {
void draw(SkCanvas* canvas) {
GrContext* context = canvas->getGrContext();
SkPixmap pixmap;
if (source.peekPixels(&pixmap)) {
sk_sp<SkImage> image = SkImage::MakeCrossContextFromPixmap(context, pixmap, false);
canvas->drawImage(image, 0, 0);
}
}
} // END FIDDLE