| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "PictureRenderer.h" | 8 #include "PictureRenderer.h" |
| 9 #include "picture_utils.h" | 9 #include "picture_utils.h" |
| 10 #include "SamplePipeControllers.h" | 10 #include "SamplePipeControllers.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return write(canvas, &pathWithNumber, jsonSummaryPtr); | 333 return write(canvas, &pathWithNumber, jsonSummaryPtr); |
| 334 } | 334 } |
| 335 | 335 |
| 336 ////////////////////////////////////////////////////////////////////////////////
/////////////// | 336 ////////////////////////////////////////////////////////////////////////////////
/////////////// |
| 337 | 337 |
| 338 SkCanvas* RecordPictureRenderer::setupCanvas(int width, int height) { | 338 SkCanvas* RecordPictureRenderer::setupCanvas(int width, int height) { |
| 339 // defer the canvas setup until the render step | 339 // defer the canvas setup until the render step |
| 340 return NULL; | 340 return NULL; |
| 341 } | 341 } |
| 342 | 342 |
| 343 static SkData* encode_bitmap_to_data(size_t* offset, const SkBitmap& bm) { | 343 // the size_t* parameter is deprecated, so we ignore it |
| 344 SkPixelRef* pr = bm.pixelRef(); | 344 static SkData* encode_bitmap_to_data(size_t*, const SkBitmap& bm) { |
| 345 if (pr != NULL) { | |
| 346 SkData* data = pr->refEncodedData(); | |
| 347 if (data != NULL) { | |
| 348 *offset = bm.pixelRefOffset(); | |
| 349 return data; | |
| 350 } | |
| 351 } | |
| 352 *offset = 0; | |
| 353 return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); | 345 return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); |
| 354 } | 346 } |
| 355 | 347 |
| 356 bool RecordPictureRenderer::render(const SkString* path, SkBitmap** out) { | 348 bool RecordPictureRenderer::render(const SkString* path, SkBitmap** out) { |
| 357 SkAutoTUnref<SkPicture> replayer(this->createPicture()); | 349 SkAutoTUnref<SkPicture> replayer(this->createPicture()); |
| 358 SkCanvas* recorder = replayer->beginRecording(this->getViewWidth(), this->ge
tViewHeight(), | 350 SkCanvas* recorder = replayer->beginRecording(this->getViewWidth(), this->ge
tViewHeight(), |
| 359 this->recordFlags()); | 351 this->recordFlags()); |
| 360 this->scaleToScaleFactor(recorder); | 352 this->scaleToScaleFactor(recorder); |
| 361 fPicture->draw(recorder); | 353 fPicture->draw(recorder); |
| 362 replayer->endRecording(); | 354 replayer->endRecording(); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 virtual SkString getConfigNameInternal() SK_OVERRIDE { | 942 virtual SkString getConfigNameInternal() SK_OVERRIDE { |
| 951 return SkString("picture_clone"); | 943 return SkString("picture_clone"); |
| 952 } | 944 } |
| 953 }; | 945 }; |
| 954 | 946 |
| 955 PictureRenderer* CreatePictureCloneRenderer() { | 947 PictureRenderer* CreatePictureCloneRenderer() { |
| 956 return SkNEW(PictureCloneRenderer); | 948 return SkNEW(PictureCloneRenderer); |
| 957 } | 949 } |
| 958 | 950 |
| 959 } // namespace sk_tools | 951 } // namespace sk_tools |
| OLD | NEW |