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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 SkAutoTDelete<SkBBHFactory> factory(this->getFactory()); | 356 SkAutoTDelete<SkBBHFactory> factory(this->getFactory()); |
357 SkPictureRecorder recorder; | 357 SkPictureRecorder recorder; |
358 SkCanvas* canvas = recorder.beginRecording(this->getViewWidth(), this->getVi
ewHeight(), | 358 SkCanvas* canvas = recorder.beginRecording(this->getViewWidth(), this->getVi
ewHeight(), |
359 factory.get(), | 359 factory.get(), |
360 this->recordFlags()); | 360 this->recordFlags()); |
361 this->scaleToScaleFactor(canvas); | 361 this->scaleToScaleFactor(canvas); |
362 fPicture->draw(canvas); | 362 fPicture->draw(canvas); |
363 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 363 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
364 if (!fWritePath.isEmpty()) { | 364 if (!fWritePath.isEmpty()) { |
365 // Record the new picture as a new SKP with PNG encoded bitmaps. | 365 // Record the new picture as a new SKP with PNG encoded bitmaps. |
366 SkString skpPath = SkOSPath::SkPathJoin(fWritePath.c_str(), fInputFilena
me.c_str()); | 366 SkString skpPath = SkOSPath::Join(fWritePath.c_str(), fInputFilename.c_s
tr()); |
367 SkFILEWStream stream(skpPath.c_str()); | 367 SkFILEWStream stream(skpPath.c_str()); |
368 picture->serialize(&stream, &encode_bitmap_to_data); | 368 picture->serialize(&stream, &encode_bitmap_to_data); |
369 return true; | 369 return true; |
370 } | 370 } |
371 return false; | 371 return false; |
372 } | 372 } |
373 | 373 |
374 SkString RecordPictureRenderer::getConfigNameInternal() { | 374 SkString RecordPictureRenderer::getConfigNameInternal() { |
375 return SkString("record"); | 375 return SkString("record"); |
376 } | 376 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 virtual SkString getConfigNameInternal() SK_OVERRIDE { | 758 virtual SkString getConfigNameInternal() SK_OVERRIDE { |
759 return SkString("gather_pixelrefs"); | 759 return SkString("gather_pixelrefs"); |
760 } | 760 } |
761 }; | 761 }; |
762 | 762 |
763 PictureRenderer* CreateGatherPixelRefsRenderer() { | 763 PictureRenderer* CreateGatherPixelRefsRenderer() { |
764 return SkNEW(GatherRenderer); | 764 return SkNEW(GatherRenderer); |
765 } | 765 } |
766 | 766 |
767 } // namespace sk_tools | 767 } // namespace sk_tools |
OLD | NEW |