xref: /aosp_15_r20/external/skia/src/gpu/ganesh/d3d/GrD3DUtil.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "src/gpu/ganesh/d3d/GrD3DUtil.h"
9 
10 #include "src/gpu/ganesh/GrDataUtils.h"
11 #include "src/gpu/ganesh/GrDirectContextPriv.h"
12 #include "src/gpu/ganesh/d3d/GrD3DGpu.h"
13 #include "src/sksl/SkSLCompiler.h"
14 
GrDxgiFormatIsCompressed(DXGI_FORMAT format)15 bool GrDxgiFormatIsCompressed(DXGI_FORMAT format) {
16     switch (format) {
17         case DXGI_FORMAT_BC1_UNORM:
18             return true;
19         default:
20             return false;
21     }
22     SkUNREACHABLE;
23 }
24 
GrD3DMultiByteToWide(const std::string & str)25 std::wstring GrD3DMultiByteToWide(const std::string& str) {
26     int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), nullptr, 0);
27     std::wstring wstr(size_needed, 0);
28     MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstr[0], size_needed);
29     return wstr;
30 }
31