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

Side by Side Diff: gm/downsamplebitmap.cpp

Issue 19335002: Production quality fast image up/downsampler (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: camel case and if-statement braces Created 7 years, 5 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 | « no previous file | gyp/core.gypi » ('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 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 paint.setFlags( paint.getFlags() | SkPaint::kHighQualityFilterBitmap _Flag ); 68 paint.setFlags( paint.getFlags() | SkPaint::kHighQualityFilterBitmap _Flag );
69 69
70 canvas->save(); 70 canvas->save();
71 canvas->translate( (SkScalar) curX, 0.f ); 71 canvas->translate( (SkScalar) curX, 0.f );
72 canvas->drawBitmapMatrix( fBM, matrix, &paint ); 72 canvas->drawBitmapMatrix( fBM, matrix, &paint );
73 canvas->restore(); 73 canvas->restore();
74 74
75 curWidth = (int) (fBM.width() * curScale + 2); 75 curWidth = (int) (fBM.width() * curScale + 2);
76 curX += curWidth; 76 curX += curWidth;
77 curScale *= 0.75f; 77 curScale *= 0.75f;
78 } while (curX < 4*fBM.width()); 78 } while (curWidth >= 2 && curX < 4*fBM.width());
79 } 79 }
80 80
81 private: 81 private:
82 typedef skiagm::GM INHERITED; 82 typedef skiagm::GM INHERITED;
83 }; 83 };
84 84
85 class DownsampleBitmapTextGM: public DownsampleBitmapGM { 85 class DownsampleBitmapTextGM: public DownsampleBitmapGM {
86 public: 86 public:
87 DownsampleBitmapTextGM(float textSize) 87 DownsampleBitmapTextGM(float textSize)
88 : fTextSize(textSize) 88 : fTextSize(textSize)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 private: 193 private:
194 typedef DownsampleBitmapGM INHERITED; 194 typedef DownsampleBitmapGM INHERITED;
195 }; 195 };
196 196
197 ////////////////////////////////////////////////////////////////////////////// 197 //////////////////////////////////////////////////////////////////////////////
198 198
199 DEF_GM( return new DownsampleBitmapTextGM(72); ) 199 DEF_GM( return new DownsampleBitmapTextGM(72); )
200 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256); ) 200 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256); )
201 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png"); ) 201 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png"); )
OLDNEW
« no previous file with comments | « no previous file | gyp/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698