Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index b44f1d78180e94e9d9f5505789024e5db42c4007..e67d4355e4ca4caf4f7605422b2bd73f8b91a3ac 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -2,6 +2,7 @@ |
#include "SamplePipeControllers.h" |
#include "SkCommonFlags.h" |
#include "SkDocument.h" |
+#include "SkError.h" |
#include "SkMultiPictureDraw.h" |
#include "SkNullCanvas.h" |
#include "SkOSFile.h" |
@@ -157,6 +158,8 @@ int GPUSink::enclave() const { |
return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; |
} |
+void PreAbandonGpuContextErrorHandler(SkError, void*) {} |
+ |
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) const { |
GrContextFactory factory; |
const SkISize size = src.size(); |
@@ -167,6 +170,10 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co |
if (!surface) { |
return "Could not create a surface."; |
} |
+ if (FLAGS_preAbandonGpuContext) { |
+ SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, NULL); |
+ factory.abandonContexts(); |
+ } |
SkCanvas* canvas = surface->getCanvas(); |
Error err = src.draw(canvas); |
if (!err.isEmpty()) { |
@@ -178,7 +185,7 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co |
canvas->getGrContext()->dumpGpuStats(log); |
} |
dst->allocPixels(info); |
- canvas->readPixels(dst, 0,0); |
+ canvas->readPixels(dst, 0, 0); |
if (FLAGS_abandonGpuContext) { |
factory.abandonContexts(); |
} |