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

Side by Side Diff: samplecode/SampleSlides.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 SkCanvas canvas(bm); 683 SkCanvas canvas(bm);
684 SkScalar s = SkIntToScalar(1024) / 640; 684 SkScalar s = SkIntToScalar(1024) / 640;
685 canvas.scale(s, s); 685 canvas.scale(s, s);
686 for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); i++) { 686 for (size_t i = 0; i < SK_ARRAY_COUNT(gProc); i++) {
687 canvas.save(); 687 canvas.save();
688 canvas.drawColor(BG_COLOR); 688 canvas.drawColor(BG_COLOR);
689 gProc[i](&canvas); 689 gProc[i](&canvas);
690 canvas.restore(); 690 canvas.restore();
691 SkString str; 691 SkString str;
692 str.printf("/skimages/slide_" SK_SIZE_T_SPECIFIER ".png", i); 692 str.printf("/skimages/slide_" SK_SIZE_T_SPECIFIER ".png", i);
693 SkImageEncoder::EncodeFile(str.c_str(), bm, SkImageEncoder::kPNG_Typ e, 100); 693 SkImageEncoder::EncodeFile(str.c_str(), bm, kPNG_SkEncodedFormat, 10 0);
694 } 694 }
695 this->setBGColor(BG_COLOR); 695 this->setBGColor(BG_COLOR);
696 } 696 }
697 697
698 protected: 698 protected:
699 // overrides from SkEventSink 699 // overrides from SkEventSink
700 bool onQuery(SkEvent* evt) SK_OVERRIDE { 700 bool onQuery(SkEvent* evt) SK_OVERRIDE {
701 if (SampleCode::TitleQ(*evt)) { 701 if (SampleCode::TitleQ(*evt)) {
702 SampleCode::TitleR(evt, "Slides"); 702 SampleCode::TitleR(evt, "Slides");
703 return true; 703 return true;
(...skipping 14 matching lines...) Expand all
718 } 718 }
719 719
720 private: 720 private:
721 typedef SampleView INHERITED; 721 typedef SampleView INHERITED;
722 }; 722 };
723 723
724 ////////////////////////////////////////////////////////////////////////////// 724 //////////////////////////////////////////////////////////////////////////////
725 725
726 static SkView* MyFactory() { return new SlideView; } 726 static SkView* MyFactory() { return new SlideView; }
727 static SkViewRegister reg(MyFactory); 727 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698