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

Unified Diff: src/gpu/GrContext.cpp

Issue 680413005: Don't allow renderTarget==NULL to GrContext::clear() and friends. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years, 1 month 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/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c1fee0acb82b5a17b338b735e4fc0f66dd5a0a5e..8c5abe78357eebb08731b3c887d603f4b56ca9ff 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -580,6 +580,8 @@ void GrContext::clear(const SkIRect* rect,
bool canIgnoreRect,
GrRenderTarget* renderTarget) {
ASSERT_OWNED_RESOURCE(renderTarget);
+ SkASSERT(renderTarget);
+
AutoRestoreEffects are;
AutoCheckFlush acf(this);
GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::clear", this);
@@ -753,7 +755,7 @@ void GrContext::drawRect(const GrPaint& paint,
// Will it blend?
GrColor clearColor;
if (paint.isOpaqueAndConstantColor(&clearColor)) {
- target->clear(NULL, clearColor, true);
+ target->clear(NULL, clearColor, true, fRenderTarget);
return;
}
}
@@ -1400,13 +1402,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
GrPixelConfig dstConfig, void* buffer, size_t rowBytes,
uint32_t flags) {
ASSERT_OWNED_RESOURCE(target);
-
- if (NULL == target) {
- target = fRenderTarget.get();
- if (NULL == target) {
- return false;
- }
- }
+ SkASSERT(target);
if (!(kDontFlush_PixelOpsFlag & flags) && target->surfacePriv().hasPendingWrite()) {
this->flush();
@@ -1541,10 +1537,12 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
void GrContext::resolveRenderTarget(GrRenderTarget* target) {
SkASSERT(target);
ASSERT_OWNED_RESOURCE(target);
- // In the future we may track whether there are any pending draws to this
- // target. We don't today so we always perform a flush. We don't promise
- // this to our clients, though.
- this->flush();
+ if (!target->needsResolve()) {
+ return;
+ }
+ if (target->surfacePriv().hasPendingIO()) {
+ this->flush();
+ }
if (fGpu) {
fGpu->resolveRenderTarget(target);
}
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698