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