1// Copyright 2020 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" 4REG_FIDDLE(crbug_918512, 256, 256, false, 0) { 5// https://crbug.com/918512 6// Verify that PDF draws correctly. 7void draw(SkCanvas* canvas) { 8 canvas->drawColor(SK_ColorYELLOW); 9 { 10 SkAutoCanvasRestore autoCanvasRestore1(canvas, false); 11 canvas->saveLayer(nullptr, nullptr); 12 canvas->drawColor(SK_ColorCYAN); 13 { 14 SkAutoCanvasRestore autoCanvasRestore2(canvas, false); 15 SkPaint lumaFilter; 16 lumaFilter.setBlendMode(SkBlendMode::kDstIn); 17 lumaFilter.setColorFilter(SkLumaColorFilter::Make()); 18 canvas->saveLayer(nullptr, &lumaFilter); 19 20 canvas->drawColor(SK_ColorTRANSPARENT); 21 SkPaint paint; 22 paint.setColor(SK_ColorGRAY); 23 canvas->drawRect(SkRect{0, 0, 128, 256}, paint); 24 } 25 } 26} 27} // END FIDDLE 28