Guard GPU parts of ToolUtils

This was breaking:
bazel build //tools/skdiff --config=clang

which does not compile with any GPU backend.

Change-Id: I0f95ebbab6542f7ae5ea8f8a87ea2a5a5d01d993
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532760
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2022-04-22 09:09:07 -04:00 committed by SkCQ
parent 7dd8c705a5
commit ce5ec016e4
2 changed files with 13 additions and 5 deletions

View File

@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
#include "tools/ToolUtils.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
@ -21,15 +23,10 @@
#include "include/core/SkShader.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTextBlob.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/ports/SkTypeface_win.h"
#include "include/private/SkColorData.h"
#include "include/private/SkFloatingPoint.h"
#include "src/core/SkFontPriv.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "tools/ToolUtils.h"
#include <cmath>
#include <cstring>
@ -40,6 +37,13 @@
#include "src/xml/SkDOM.h"
#endif
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#endif
namespace ToolUtils {
const char* alphatype_name(SkAlphaType at) {
@ -521,6 +525,7 @@ void sniff_paths(const char filepath[], std::function<PathSniffCallback> callbac
}
}
#if SK_SUPPORT_GPU
sk_sp<SkImage> MakeTextureImage(SkCanvas* canvas, sk_sp<SkImage> orig) {
if (!orig) {
return nullptr;
@ -547,5 +552,6 @@ sk_sp<SkImage> MakeTextureImage(SkCanvas* canvas, sk_sp<SkImage> orig) {
return orig;
}
#endif
} // namespace ToolUtils

View File

@ -300,7 +300,9 @@ using PathSniffCallback = void(const SkMatrix&, const SkPath&, const SkPaint&);
// Supported file formats are .svg and .skp.
void sniff_paths(const char filepath[], std::function<PathSniffCallback>);
#if SK_SUPPORT_GPU
sk_sp<SkImage> MakeTextureImage(SkCanvas* canvas, sk_sp<SkImage> orig);
#endif
} // namespace ToolUtils