Make GM::onGpuSetup take a GrDirectContext
This should, hopefully, clarify the role of onGpuSetup vis a vis onDraw.
The remaining tools are updated in:
https://skia-review.googlesource.com/c/skia/+/300220/ (Update remaining tools to GrDirectContext)
Change-Id: I19d6eec4d16cb9ebad8924763a18225cc871f0f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300172
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index 96186d8..324e190 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -23,12 +23,11 @@
#include "include/core/SkTypes.h"
#include "include/core/SkYUVAIndex.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/SkTo.h"
#include "src/core/SkMathPriv.h"
#include "src/core/SkYUVMath.h"
-#include "src/gpu/GrContextPriv.h"
#include "tools/Resources.h"
#include "tools/gpu/YUVUtils.h"
@@ -120,7 +119,7 @@
return rgbaBmp;
}
- static bool CreateYUVBackendTextures(GrContext* context, SkBitmap bmps[4],
+ static bool CreateYUVBackendTextures(GrDirectContext* context, SkBitmap bmps[4],
SkYUVAIndex indices[4],
YUVABackendReleaseContext* beContext) {
for (int i = 0; i < 4; ++i) {
@@ -150,7 +149,7 @@
return true;
}
- sk_sp<SkImage> makeYUVAImage(GrContext* context) {
+ sk_sp<SkImage> makeYUVAImage(GrDirectContext* context) {
auto releaseContext = new YUVABackendReleaseContext(context);
SkYUVAIndex indices[4];
@@ -170,7 +169,7 @@
releaseContext);
}
- sk_sp<SkImage> createReferenceImage(GrContext* context) {
+ sk_sp<SkImage> createReferenceImage(GrDirectContext* context) {
auto planeReleaseContext = new YUVABackendReleaseContext(context);
SkYUVAIndex indices[4];
@@ -210,13 +209,11 @@
return tmp;
}
- DrawResult onGpuSetup(GrContext* context, SkString* errorMsg) override {
+ DrawResult onGpuSetup(GrDirectContext* context, SkString* errorMsg) override {
if (!context || context->abandoned()) {
return DrawResult::kSkip;
}
- SkASSERT(context->asDirectContext());
-
fRGBABmp = CreateBmpAndPlanes("images/mandrill_32.png", fYUVABmps);
// We make a version of this image for each draw because, if any draw flattens it to