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

Side by Side Diff: samplecode/SamplePicture.cpp

Issue 110503003: PixelRef now returns (nearly) everything that is currently in SkBitmap. The goal is to refactor bit… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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/images/SkImageRef_GlobalPool.h ('k') | src/core/SkBitmap.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 "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 22 matching lines...) Expand all
33 #include "SkImageRef_GlobalPool.h" 33 #include "SkImageRef_GlobalPool.h"
34 34
35 static SkBitmap load_bitmap() { 35 static SkBitmap load_bitmap() {
36 SkBitmap bm; 36 SkBitmap bm;
37 SkStreamAsset* stream = SkStream::NewFromFile("/skimages/sesame_street_ensem ble-hp.jpg"); 37 SkStreamAsset* stream = SkStream::NewFromFile("/skimages/sesame_street_ensem ble-hp.jpg");
38 if (stream) { 38 if (stream) {
39 SkAutoUnref aur(stream); 39 SkAutoUnref aur(stream);
40 40
41 if (SkImageDecoder::DecodeStream(stream, &bm, SkBitmap::kNo_Config, 41 if (SkImageDecoder::DecodeStream(stream, &bm, SkBitmap::kNo_Config,
42 SkImageDecoder::kDecodeBounds_Mode)) { 42 SkImageDecoder::kDecodeBounds_Mode)) {
43 SkPixelRef* pr = new SkImageRef_GlobalPool(stream, bm.config(), 1); 43 SkImageInfo info;
44 bm.asImageInfo(&info);
45 SkPixelRef* pr = new SkImageRef_GlobalPool(info, stream, 1);
44 bm.setPixelRef(pr)->unref(); 46 bm.setPixelRef(pr)->unref();
45 } 47 }
46 } 48 }
47 return bm; 49 return bm;
48 } 50 }
49 51
50 static void drawCircle(SkCanvas* canvas, int r, SkColor color) { 52 static void drawCircle(SkCanvas* canvas, int r, SkColor color) {
51 SkPaint paint; 53 SkPaint paint;
52 paint.setAntiAlias(true); 54 paint.setAntiAlias(true);
53 paint.setColor(color); 55 paint.setColor(color);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 SkPicture* fPicture; 193 SkPicture* fPicture;
192 SkPicture* fSubPicture; 194 SkPicture* fSubPicture;
193 195
194 typedef SampleView INHERITED; 196 typedef SampleView INHERITED;
195 }; 197 };
196 198
197 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
198 200
199 static SkView* MyFactory() { return new PictureView; } 201 static SkView* MyFactory() { return new PictureView; }
200 static SkViewRegister reg(MyFactory); 202 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/images/SkImageRef_GlobalPool.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698