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

Side by Side Diff: samplecode/SampleRegion.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/SamplePath.cpp ('k') | samplecode/SampleRepeatTile.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"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 #include "SkPath.h" 12 #include "SkPath.h"
13 #include "SkRegion.h" 13 #include "SkRegion.h"
14 #include "SkShader.h" 14 #include "SkShader.h"
15 #include "SkUtils.h" 15 #include "SkUtils.h"
16 #include "SkImageDecoder.h" 16 #include "SkImageDecoder.h"
17 17
18 static void test_strokerect(SkCanvas* canvas) { 18 static void test_strokerect(SkCanvas* canvas) {
19 int width = 100; 19 int width = 100;
20 int height = 100; 20 int height = 100;
21 21
22 SkBitmap bitmap; 22 SkBitmap bitmap;
23 bitmap.setConfig(SkBitmap::kA8_Config, width*2, height*2); 23 bitmap.allocPixels(SkImageInfo::MakeA8(width*2, height*2));
24 bitmap.allocPixels();
25 bitmap.eraseColor(SK_ColorTRANSPARENT); 24 bitmap.eraseColor(SK_ColorTRANSPARENT);
26 25
27 SkScalar dx = 20; 26 SkScalar dx = 20;
28 SkScalar dy = 20; 27 SkScalar dy = 20;
29 28
30 SkPath path; 29 SkPath path;
31 path.addRect(0.0f, 0.0f, 30 path.addRect(0.0f, 0.0f,
32 SkIntToScalar(width), SkIntToScalar(height), 31 SkIntToScalar(width), SkIntToScalar(height),
33 SkPath::kCW_Direction); 32 SkPath::kCW_Direction);
34 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); 33 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 private: 409 private:
411 SkIRect fBase, fRect; 410 SkIRect fBase, fRect;
412 411
413 typedef SampleView INHERITED; 412 typedef SampleView INHERITED;
414 }; 413 };
415 414
416 ////////////////////////////////////////////////////////////////////////////// 415 //////////////////////////////////////////////////////////////////////////////
417 416
418 static SkView* MyFactory() { return new RegionView; } 417 static SkView* MyFactory() { return new RegionView; }
419 static SkViewRegister reg(MyFactory); 418 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SamplePath.cpp ('k') | samplecode/SampleRepeatTile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698