Remove SkBaseDevice::flush

Another small step in removing SkCanvas::flush

Change-Id: I6f17edcd1996e1009dad7cc96a97be3b0c4664f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334417
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2020-11-16 09:35:18 -05:00 committed by Skia Commit-Bot
parent 9f94f31cc0
commit 971b19d0c6
8 changed files with 18 additions and 21 deletions

View File

@ -23,6 +23,8 @@ Milestone 89
a MTLDevice and MTLCommandQueue is deprecated.
https://review.skia.org/334426
* SkCanvas::flush has been deprecated.
* * *
Milestone 88

View File

@ -254,6 +254,8 @@ public:
If SkCanvas is associated with GPU surface, resolves all pending GPU operations.
If SkCanvas is associated with raster surface, has no effect; raster draw
operations are never deferred.
DEPRECATED: Replace usage with GrDirectContext::flush()
*/
void flush();

View File

@ -51,6 +51,7 @@
#include <new>
#if SK_SUPPORT_GPU
#include "include/gpu/GrDirectContext.h"
#include "src/gpu/SkGr.h"
#endif
@ -602,10 +603,14 @@ void SkCanvas::flush() {
}
void SkCanvas::onFlush() {
SkBaseDevice* device = this->getDevice();
if (device) {
device->flush();
#if SK_SUPPORT_GPU
auto dContext = GrAsDirectContext(this->recordingContext());
if (dContext) {
dContext->flush();
dContext->submit();
}
#endif
}
SkSurface* SkCanvas::getSurface() const {

View File

@ -444,10 +444,6 @@ private:
this->setDeviceCoordinateSystem(SkMatrix::I(), globalCTM, x, y);
}
/** Causes any deferred drawing to the device to be completed.
*/
virtual void flush() {}
virtual SkImageFilterCache* getImageFilterCache() { return nullptr; }
friend class SkNoPixelsDevice;

View File

@ -1028,16 +1028,6 @@ void SkGpuDevice::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix, SkC
///////////////////////////////////////////////////////////////////////////////
void SkGpuDevice::flush() {
auto direct = fContext->asDirectContext();
if (!direct) {
return;
}
direct->priv().flushSurface(fRenderTargetContext->asSurfaceProxy());
direct->submit();
}
bool SkGpuDevice::wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores,
bool deleteSemaphoresAfterWait) {
ASSERT_SINGLE_OWNER

View File

@ -130,7 +130,6 @@ public:
sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override;
sk_sp<SkSpecialImage> snapSpecial(const SkIRect&, bool = false) override;
void flush() override;
bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores,
bool deleteSemaphoresAfterWait);

View File

@ -62,7 +62,12 @@ SkCanvas* GrVkSecondaryCBDrawContext::getCanvas() {
}
void GrVkSecondaryCBDrawContext::flush() {
fDevice->flush();
auto dContext = GrAsDirectContext(fDevice->recordingContext());
if (dContext) {
dContext->priv().flushSurface(fDevice->accessRenderTargetContext()->asSurfaceProxy());
dContext->submit();
}
}
bool GrVkSecondaryCBDrawContext::wait(int numSemaphores,

View File

@ -25,7 +25,6 @@ static void test_basic(skiatest::Reporter* reporter) {
SkPaint paint;
paint.setColor(SK_ColorBLUE);
canvas->drawOval(SkRect::MakeLTRB(1,1,99,99), paint);
canvas->flush();
auto picture1 = rec.finishRecordingAsPicture();
SkIRect dirtyRectFull = SkIRect::MakeLTRB(0, 0, layerWidth, layerHeight);
@ -34,7 +33,6 @@ static void test_basic(skiatest::Reporter* reporter) {
canvas = rec2.beginRecording(layerWidth, layerHeight);
paint.setColor(SK_ColorGREEN);
canvas->drawOval(SkRect::MakeLTRB(40,40,60,60), paint);
canvas->flush();
auto picture2 = rec2.finishRecordingAsPicture();
SkIRect dirtyRectPartial = SkIRect::MakeLTRB(40,40,60,60);