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

Side by Side Diff: samplecode/SampleFatBits.cpp

Issue 137993012: use some helper Make functions to initialize SkImageInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void setWHZ(int width, int height, int zoom) { 100 void setWHZ(int width, int height, int zoom) {
101 fW = width; 101 fW = width;
102 fH = height; 102 fH = height;
103 fZoom = zoom; 103 fZoom = zoom;
104 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo om)); 104 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo om));
105 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); 105 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom));
106 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); 106 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
107 fShader->setLocalMatrix(fMatrix); 107 fShader->setLocalMatrix(fMatrix);
108 108
109 SkImageInfo info = { 109 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
110 width, height, kPMColor_SkColorType, kPremul_SkAlphaType
111 };
112 fMinSurface.reset(SkSurface::NewRaster(info)); 110 fMinSurface.reset(SkSurface::NewRaster(info));
113 info.fWidth *= zoom; 111 info.fWidth *= zoom;
114 info.fHeight *= zoom; 112 info.fHeight *= zoom;
115 fMaxSurface.reset(SkSurface::NewRaster(info)); 113 fMaxSurface.reset(SkSurface::NewRaster(info));
116 } 114 }
117 115
118 void drawBG(SkCanvas*); 116 void drawBG(SkCanvas*);
119 void drawFG(SkCanvas*); 117 void drawFG(SkCanvas*);
120 void drawLine(SkCanvas*, SkPoint pts[2]); 118 void drawLine(SkCanvas*, SkPoint pts[2]);
121 void drawRect(SkCanvas* canvas, SkPoint pts[2]); 119 void drawRect(SkCanvas* canvas, SkPoint pts[2]);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 523
526 private: 524 private:
527 525
528 typedef SampleView INHERITED; 526 typedef SampleView INHERITED;
529 }; 527 };
530 528
531 ////////////////////////////////////////////////////////////////////////////// 529 //////////////////////////////////////////////////////////////////////////////
532 530
533 static SkView* MyFactory() { return new DrawLineView; } 531 static SkView* MyFactory() { return new DrawLineView; }
534 static SkViewRegister reg(MyFactory); 532 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp ('k') | src/core/SkImageFilterUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698