1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2021 Google LLC 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci#include "tests/Test.h" 9cb93a386Sopenharmony_ci 10cb93a386Sopenharmony_ci#include "include/core/SkCanvas.h" 11cb93a386Sopenharmony_ci#include "include/core/SkSurface.h" 12cb93a386Sopenharmony_ci#include "include/gpu/GrDirectContext.h" 13cb93a386Sopenharmony_ci 14cb93a386Sopenharmony_ciDEF_GPUTEST_FOR_ALL_CONTEXTS(skbug12214, r, contextInfo) { 15cb93a386Sopenharmony_ci auto imageInfo = SkImageInfo::Make(/*width=*/32, /*height=*/32, kRGBA_8888_SkColorType, 16cb93a386Sopenharmony_ci kPremul_SkAlphaType); 17cb93a386Sopenharmony_ci sk_sp<SkSurface> surface1 = SkSurface::MakeRenderTarget(contextInfo.directContext(), 18cb93a386Sopenharmony_ci SkBudgeted::kNo, imageInfo); 19cb93a386Sopenharmony_ci sk_sp<SkSurface> surface2 = SkSurface::MakeRaster(imageInfo); 20cb93a386Sopenharmony_ci 21cb93a386Sopenharmony_ci // The test succeeds if this draw does not crash. (See skia:12214) 22cb93a386Sopenharmony_ci surface1->draw(surface2->getCanvas(), /*x=*/0, /*y=*/0); 23cb93a386Sopenharmony_ci} 24