Make SkGpuDevice hold a GrRecordingContext (take 2)
This makes the code reflect what is actually going on. During DDL
recording the SkGpuDevice only holds a recording context.
This can't land until the following Chrome-side CL lands:
https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Change-Id: I6ef3896f5a270a4fa7af37f9121f68a66653cce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300896
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 3f5a645..6dee700 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -8,6 +8,8 @@
#include "src/gpu/SkGpuDevice.h"
#include "include/core/SkYUVAIndex.h"
+#include "include/gpu/GrDirectContext.h"
+#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkDraw.h"
#include "src/core/SkMaskFilterBase.h"
#include "src/gpu/GrBitmapTextureMaker.h"
@@ -15,6 +17,7 @@
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrImageTextureMaker.h"
+#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrStyle.h"
#include "src/gpu/GrTextureAdjuster.h"
@@ -153,7 +156,7 @@
}
// tileSize and clippedSubset are valid if true is returned
-static bool should_tile_image_id(GrContext* context,
+static bool should_tile_image_id(GrRecordingContext* context,
SkISize rtSize,
const GrClip* clip,
uint32_t imageID,
@@ -185,14 +188,15 @@
// and theoretically, the resource cache's limits could be being changed on another thread, so
// even having access to just the limit wouldn't be a reliable test during recording here.
// Instead, we will just upload the entire image to be on the safe side and not tile.
- if (!context->asDirectContext()) {
+ auto direct = context->asDirectContext();
+ if (!direct) {
return false;
}
// assumption here is that sw bitmap size is a good proxy for its size as
// a texture
size_t bmpSize = area * sizeof(SkPMColor); // assume 32bit pixels
- size_t cacheSize = context->getResourceCacheLimit();
+ size_t cacheSize = direct->getResourceCacheLimit();
if (bmpSize < cacheSize / 2) {
return false;
}
@@ -381,7 +385,7 @@
}
// Assumes srcRect and dstRect have already been optimized to fit the proxy.
-static void draw_texture_producer(GrContext* context,
+static void draw_texture_producer(GrRecordingContext* context,
GrRenderTargetContext* rtc,
const GrClip* clip,
const SkMatrixProvider& matrixProvider,
@@ -510,7 +514,7 @@
}
}
-void draw_tiled_bitmap(GrContext* context,
+void draw_tiled_bitmap(GrRecordingContext* context,
GrRenderTargetContext* rtc,
const GrClip* clip,
const SkBitmap& bitmap,