Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1658823002: Remove deferred clear from SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix ptr->bool warning on windows Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/batches/GrClearBatch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 4fdd4aea8a4df2ff11167d60da1e635f7a3ec274..10c41d8a8e5e42b200b6c0a5731da465eb1addf4 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -66,13 +66,6 @@ enum { kDefaultImageFilterCacheSize = 32 * 1024 * 1024 };
#define CHECK_SHOULD_DRAW(draw) this->prepareDraw(draw)
#endif
-#define DO_DEFERRED_CLEAR() \
- do { \
- if (fNeedClear) { \
- this->clearAll(); \
- } \
- } while (false) \
-
///////////////////////////////////////////////////////////////////////////////
#define CHECK_FOR_ANNOTATION(paint) \
@@ -175,7 +168,6 @@ SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height,
: INHERITED(SkSurfacePropsCopyOrDefault(props))
, fContext(SkRef(rt->getContext()))
, fRenderTarget(SkRef(rt)) {
- fNeedClear = SkToBool(flags & kNeedClear_Flag);
fOpaque = SkToBool(flags & kIsOpaque_Flag);
SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
@@ -185,6 +177,9 @@ SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height,
fLegacyBitmap.setPixelRef(pr)->unref();
fDrawContext.reset(this->context()->drawContext(rt, &this->surfaceProps()));
+ if (flags & kNeedClear_Flag) {
+ this->clearAll();
+ }
}
GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::Budgeted budgeted,
@@ -231,7 +226,6 @@ GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B
bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int x, int y) {
ASSERT_SINGLE_OWNER
- DO_DEFERRED_CLEAR();
// TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo);
@@ -269,13 +263,11 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz
const SkBitmap& SkGpuDevice::onAccessBitmap() {
ASSERT_SINGLE_OWNER
- DO_DEFERRED_CLEAR();
return fLegacyBitmap;
}
bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) {
ASSERT_SINGLE_OWNER
- DO_DEFERRED_CLEAR();
// For compatibility with clients the know we're backed w/ a bitmap, and want to inspect its
// genID. When we can hide/remove that fact, we can eliminate this call to notify.
// ... ugh.
@@ -307,13 +299,10 @@ void SkGpuDevice::prepareDraw(const SkDraw& draw) {
SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack);
fClip.setClipStack(fClipStack, &this->getOrigin());
-
- DO_DEFERRED_CLEAR();
}
GrRenderTarget* SkGpuDevice::accessRenderTarget() {
ASSERT_SINGLE_OWNER
- DO_DEFERRED_CLEAR();
return fRenderTarget;
}
@@ -323,13 +312,10 @@ void SkGpuDevice::clearAll() {
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext);
SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
fDrawContext->clear(&rect, color, true);
- fNeedClear = false;
}
void SkGpuDevice::replaceRenderTarget(bool shouldRetainContent) {
ASSERT_SINGLE_OWNER
- // Caller must have accessed the render target, because it knows the rt must be replaced.
- SkASSERT(!fNeedClear);
SkSurface::Budgeted budgeted =
fRenderTarget->resourcePriv().isBudgeted() ? SkSurface::kYes_Budgeted
@@ -1310,10 +1296,6 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDevice", fContext);
SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
- // TODO: If the source device covers the whole of this device, we could
- // omit fNeedsClear -related flushing.
- // TODO: if source needs clear, we could maybe omit the draw fully.
-
// drawDevice is defined to be in device coords.
CHECK_SHOULD_DRAW(draw);
@@ -1769,7 +1751,6 @@ bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const {
void SkGpuDevice::flush() {
ASSERT_SINGLE_OWNER
- DO_DEFERRED_CLEAR();
// Clear batch debugging output
// TODO not exactly sure where this should live
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/batches/GrClearBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698