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

Side by Side Diff: samplecode/SampleFatBits.cpp

Issue 169063002: use SkColorType instead of SkBitmap::Config in samplecode (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « samplecode/SampleEncode.cpp ('k') | samplecode/SampleFilter.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 21 matching lines...) Expand all
32 } 32 }
33 33
34 static void erase(SkSurface* surface) { 34 static void erase(SkSurface* surface) {
35 surface->getCanvas()->clear(SK_ColorTRANSPARENT); 35 surface->getCanvas()->clear(SK_ColorTRANSPARENT);
36 } 36 }
37 37
38 static SkShader* createChecker() { 38 static SkShader* createChecker() {
39 // SkColor colors[] = { 0xFFFDFDFD, 0xFFF4F4F4 }; 39 // SkColor colors[] = { 0xFFFDFDFD, 0xFFF4F4F4 };
40 SkColor colors[] = { 0xFFFFFFFF, 0xFFFFFFFF }; 40 SkColor colors[] = { 0xFFFFFFFF, 0xFFFFFFFF };
41 SkBitmap bm; 41 SkBitmap bm;
42 bm.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); 42 bm.allocN32Pixels(2, 2);
43 bm.allocPixels();
44 bm.lockPixels(); 43 bm.lockPixels();
45 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = SkPreMultiplyColor(colors[0]); 44 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = SkPreMultiplyColor(colors[0]);
46 *bm.getAddr32(0, 1) = *bm.getAddr32(1, 0) = SkPreMultiplyColor(colors[1]); 45 *bm.getAddr32(0, 1) = *bm.getAddr32(1, 0) = SkPreMultiplyColor(colors[1]);
47 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, 46 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
48 SkShader::kRepeat_TileMode); 47 SkShader::kRepeat_TileMode);
49 48
50 SkMatrix m; 49 SkMatrix m;
51 m.setScale(12, 12); 50 m.setScale(12, 12);
52 s->setLocalMatrix(m); 51 s->setLocalMatrix(m);
53 return s; 52 return s;
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 522
524 private: 523 private:
525 524
526 typedef SampleView INHERITED; 525 typedef SampleView INHERITED;
527 }; 526 };
528 527
529 ////////////////////////////////////////////////////////////////////////////// 528 //////////////////////////////////////////////////////////////////////////////
530 529
531 static SkView* MyFactory() { return new DrawLineView; } 530 static SkView* MyFactory() { return new DrawLineView; }
532 static SkViewRegister reg(MyFactory); 531 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleEncode.cpp ('k') | samplecode/SampleFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698