Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: tools/PictureRenderer.cpp

Issue 1018953003: Add SkEncodedFormat, used by SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use a common enum for SkImageEncoder and SkImageDecoder and SkCodec Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698