OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Request.h" | 8 #include "Request.h" |
9 | 9 |
10 #include "png.h" | 10 #include "png.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 fprintf(stderr, "Could not create picture from stream.\n"); | 143 fprintf(stderr, "Could not create picture from stream.\n"); |
144 return false; | 144 return false; |
145 } | 145 } |
146 | 146 |
147 // pour picture into debug canvas | 147 // pour picture into debug canvas |
148 fDebugCanvas.reset(new SkDebugCanvas(kImageWidth, Request::kImageHeight)); | 148 fDebugCanvas.reset(new SkDebugCanvas(kImageWidth, Request::kImageHeight)); |
149 fDebugCanvas->drawPicture(fPicture); | 149 fDebugCanvas->drawPicture(fPicture); |
150 | 150 |
151 // for some reason we need to 'flush' the debug canvas by drawing all of the
ops | 151 // for some reason we need to 'flush' the debug canvas by drawing all of the
ops |
152 fDebugCanvas->drawTo(this->getCanvas(), this->getLastOp()); | 152 fDebugCanvas->drawTo(this->getCanvas(), this->getLastOp()); |
| 153 this->getCanvas()->flush(); |
153 return true; | 154 return true; |
154 } | 155 } |
155 | 156 |
156 GrAuditTrail* Request::getAuditTrail(SkCanvas* canvas) { | 157 GrAuditTrail* Request::getAuditTrail(SkCanvas* canvas) { |
157 GrAuditTrail* at = nullptr; | 158 GrAuditTrail* at = nullptr; |
158 #if SK_SUPPORT_GPU | 159 #if SK_SUPPORT_GPU |
159 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); | 160 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); |
160 if (rt) { | 161 if (rt) { |
161 GrContext* ctx = rt->getContext(); | 162 GrContext* ctx = rt->getContext(); |
162 if (ctx) { | 163 if (ctx) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 SkIRect clip = fDebugCanvas->getCurrentClip(); | 228 SkIRect clip = fDebugCanvas->getCurrentClip(); |
228 Json::Value info(Json::objectValue); | 229 Json::Value info(Json::objectValue); |
229 info["ViewMatrix"] = SkDrawCommand::MakeJsonMatrix(vm); | 230 info["ViewMatrix"] = SkDrawCommand::MakeJsonMatrix(vm); |
230 info["ClipRect"] = SkDrawCommand::MakeJsonIRect(clip); | 231 info["ClipRect"] = SkDrawCommand::MakeJsonIRect(clip); |
231 | 232 |
232 std::string json = Json::FastWriter().write(info); | 233 std::string json = Json::FastWriter().write(info); |
233 | 234 |
234 // We don't want the null terminator so strlen is correct | 235 // We don't want the null terminator so strlen is correct |
235 return SkData::NewWithCopy(json.c_str(), strlen(json.c_str())); | 236 return SkData::NewWithCopy(json.c_str(), strlen(json.c_str())); |
236 } | 237 } |
OLD | NEW |