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

Side by Side Diff: samplecode/SampleMipMap.cpp

Issue 20344002: use dynamic hash to speed up scaledimagecache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 | src/core/SkScaledImageCache.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 /* 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 "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 MipMapView() { 45 MipMapView() {
46 fOnce = false; 46 fOnce = false;
47 } 47 }
48 48
49 void init() { 49 void init() {
50 if (fOnce) { 50 if (fOnce) {
51 return; 51 return;
52 } 52 }
53 fOnce = true; 53 fOnce = true;
54 54
55 fBitmap = createBitmap(N); 55 fBitmap = createBitmap(N*5);
56 56
57 fWidth = N; 57 fWidth = N;
58 } 58 }
59 59
60 protected: 60 protected:
61 // overrides from SkEventSink 61 // overrides from SkEventSink
62 virtual bool onQuery(SkEvent* evt) { 62 virtual bool onQuery(SkEvent* evt) {
63 if (SampleCode::TitleQ(*evt)) { 63 if (SampleCode::TitleQ(*evt)) {
64 SampleCode::TitleR(evt, "MipMaps"); 64 SampleCode::TitleR(evt, "MipMaps");
65 return true; 65 return true;
(...skipping 14 matching lines...) Expand all
80 SkPaint paint; 80 SkPaint paint;
81 81
82 for (size_t i = 0; i < SK_ARRAY_COUNT(gLevel); ++i) { 82 for (size_t i = 0; i < SK_ARRAY_COUNT(gLevel); ++i) {
83 SkScalar x = 10.0f + i * 100; 83 SkScalar x = 10.0f + i * 100;
84 SkScalar y = 10.0f; 84 SkScalar y = 10.0f;
85 85
86 paint.setFilterLevel(gLevel[i]); 86 paint.setFilterLevel(gLevel[i]);
87 87
88 canvas->drawBitmap(fBitmap, x, y, &paint); 88 canvas->drawBitmap(fBitmap, x, y, &paint);
89 } 89 }
90 this->inval(NULL); 90 // this->inval(NULL);
91 } 91 }
92 92
93 private: 93 private:
94 int fWidth; 94 int fWidth;
95 95
96 typedef SampleView INHERITED; 96 typedef SampleView INHERITED;
97 }; 97 };
98 98
99 ////////////////////////////////////////////////////////////////////////////// 99 //////////////////////////////////////////////////////////////////////////////
100 100
101 static SkView* MyFactory() { return new MipMapView; } 101 static SkView* MyFactory() { return new MipMapView; }
102 static SkViewRegister reg(MyFactory); 102 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698