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

Side by Side Diff: samplecode/SampleFatBits.cpp

Issue 24130009: promote SkImage::AlphaType to SkAlphaType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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
« no previous file with comments | « include/core/SkSurface.h ('k') | src/image/SkImagePriv.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 void setWHZ(int width, int height, int zoom) { 85 void setWHZ(int width, int height, int zoom) {
86 fW = width; 86 fW = width;
87 fH = height; 87 fH = height;
88 fZoom = zoom; 88 fZoom = zoom;
89 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo om)); 89 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo om));
90 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); 90 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom));
91 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); 91 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
92 fShader->setLocalMatrix(fMatrix); 92 fShader->setLocalMatrix(fMatrix);
93 93
94 SkImage::Info info = { 94 fMinSurface.reset(SkSurface::NewRasterPMColor(width, height));
95 width, height, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaTy pe 95 width *= zoom;
96 }; 96 height *= zoom;
97 fMinSurface.reset(SkSurface::NewRaster(info)); 97 fMaxSurface.reset(SkSurface::NewRasterPMColor(width, height));
98 info.fWidth *= zoom;
99 info.fHeight *= zoom;
100 fMaxSurface.reset(SkSurface::NewRaster(info));
101 } 98 }
102 99
103 void drawBG(SkCanvas*); 100 void drawBG(SkCanvas*);
104 void drawFG(SkCanvas*); 101 void drawFG(SkCanvas*);
105 void drawLine(SkCanvas*, SkPoint pts[2]); 102 void drawLine(SkCanvas*, SkPoint pts[2]);
106 void drawRect(SkCanvas* canvas, SkPoint pts[2]); 103 void drawRect(SkCanvas* canvas, SkPoint pts[2]);
107 104
108 private: 105 private:
109 bool fAA, fGrid, fShowSkeleton, fUseGPU, fUseClip, fRectAsOval; 106 bool fAA, fGrid, fShowSkeleton, fUseGPU, fUseClip, fRectAsOval;
110 Style fStyle; 107 Style fStyle;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 456
460 private: 457 private:
461 458
462 typedef SampleView INHERITED; 459 typedef SampleView INHERITED;
463 }; 460 };
464 461
465 ////////////////////////////////////////////////////////////////////////////// 462 //////////////////////////////////////////////////////////////////////////////
466 463
467 static SkView* MyFactory() { return new DrawLineView; } 464 static SkView* MyFactory() { return new DrawLineView; }
468 static SkViewRegister reg(MyFactory); 465 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | src/image/SkImagePriv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698