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

Side by Side Diff: gm/bicubicfilter.cpp

Issue 51033004: add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | « bench/TileBench.cpp ('k') | gm/bigmatrix.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 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 "SkColor.h" 9 #include "SkColor.h"
10 #include "SkBicubicImageFilter.h" 10 #include "SkBicubicImageFilter.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 if (!fInitialized) { 50 if (!fInitialized) {
51 make_checkerboard(4, 4); 51 make_checkerboard(4, 4);
52 fInitialized = true; 52 fInitialized = true;
53 } 53 }
54 SkScalar sk32 = SkIntToScalar(32); 54 SkScalar sk32 = SkIntToScalar(32);
55 canvas->clear(0x00000000); 55 canvas->clear(0x00000000);
56 SkPaint bilinearPaint, bicubicPaint; 56 SkPaint bilinearPaint, bicubicPaint;
57 SkSize scale = SkSize::Make(sk32, sk32); 57 SkSize scale = SkSize::Make(sk32, sk32);
58 canvas->save(); 58 canvas->save();
59 canvas->scale(sk32, sk32); 59 canvas->scale(sk32, sk32);
60 bilinearPaint.setFilterBitmap(true); 60 bilinearPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
61 canvas->drawBitmap(fCheckerboard, 0, 0, &bilinearPaint); 61 canvas->drawBitmap(fCheckerboard, 0, 0, &bilinearPaint);
62 canvas->restore(); 62 canvas->restore();
63 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell (scale)); 63 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell (scale));
64 bicubicPaint.setImageFilter(bicubic); 64 bicubicPaint.setImageFilter(bicubic);
65 SkRect srcBounds; 65 SkRect srcBounds;
66 fCheckerboard.getBounds(&srcBounds); 66 fCheckerboard.getBounds(&srcBounds);
67 canvas->translate(SkIntToScalar(140), 0); 67 canvas->translate(SkIntToScalar(140), 0);
68 canvas->saveLayer(&srcBounds, &bicubicPaint); 68 canvas->saveLayer(&srcBounds, &bicubicPaint);
69 canvas->drawBitmap(fCheckerboard, 0, 0); 69 canvas->drawBitmap(fCheckerboard, 0, 0);
70 canvas->restore(); 70 canvas->restore();
71 } 71 }
72 72
73 private: 73 private:
74 typedef GM INHERITED; 74 typedef GM INHERITED;
75 SkBitmap fCheckerboard; 75 SkBitmap fCheckerboard;
76 bool fInitialized; 76 bool fInitialized;
77 }; 77 };
78 78
79 ////////////////////////////////////////////////////////////////////////////// 79 //////////////////////////////////////////////////////////////////////////////
80 80
81 static GM* MyFactory(void*) { return new BicubicGM; } 81 static GM* MyFactory(void*) { return new BicubicGM; }
82 static GMRegistry reg(MyFactory); 82 static GMRegistry reg(MyFactory);
83 83
84 } 84 }
OLDNEW
« no previous file with comments | « bench/TileBench.cpp ('k') | gm/bigmatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698