| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 360 |
| 361 // Encodes to PNG, unless there is already encoded data, in which case that gets | 361 // Encodes to PNG, unless there is already encoded data, in which case that gets |
| 362 // used. | 362 // used. |
| 363 // FIXME: Share with PictureTest.cpp? | 363 // FIXME: Share with PictureTest.cpp? |
| 364 | 364 |
| 365 class PngPixelSerializer : public SkPixelSerializer { | 365 class PngPixelSerializer : public SkPixelSerializer { |
| 366 public: | 366 public: |
| 367 bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; } | 367 bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; } |
| 368 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, | 368 SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, |
| 369 size_t rowBytes) SK_OVERRIDE { | 369 size_t rowBytes) SK_OVERRIDE { |
| 370 return SkImageEncoder::EncodeData(info, pixels, rowBytes, SkImageEncoder
::kPNG_Type, 100); | 370 return SkImageEncoder::EncodeData(info, pixels, rowBytes, kPNG_SkEncoded
Format, 100); |
| 371 } | 371 } |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 bool RecordPictureRenderer::render(SkBitmap** out) { | 374 bool RecordPictureRenderer::render(SkBitmap** out) { |
| 375 SkAutoTDelete<SkBBHFactory> factory(this->getFactory()); | 375 SkAutoTDelete<SkBBHFactory> factory(this->getFactory()); |
| 376 SkPictureRecorder recorder; | 376 SkPictureRecorder recorder; |
| 377 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(this->getViewWidth(
)), | 377 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(this->getViewWidth(
)), |
| 378 SkIntToScalar(this->getViewHeight
()), | 378 SkIntToScalar(this->getViewHeight
()), |
| 379 factory.get(), | 379 factory.get(), |
| 380 this->recordFlags()); | 380 this->recordFlags()); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 case kNone_BBoxHierarchyType: | 825 case kNone_BBoxHierarchyType: |
| 826 return NULL; | 826 return NULL; |
| 827 case kRTree_BBoxHierarchyType: | 827 case kRTree_BBoxHierarchyType: |
| 828 return SkNEW(SkRTreeFactory); | 828 return SkNEW(SkRTreeFactory); |
| 829 } | 829 } |
| 830 SkASSERT(0); // invalid bbhType | 830 SkASSERT(0); // invalid bbhType |
| 831 return NULL; | 831 return NULL; |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace sk_tools | 834 } // namespace sk_tools |
| OLD | NEW |