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

Side by Side Diff: gm/pathopsinverse.cpp

Issue 140593005: add legacy/helper allocN32Pixels, and convert gm to use it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « gm/optimizations.cpp ('k') | gm/samplerstress.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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 18 matching lines...) Expand all
29 makePaint(&fOpPaint[kIntersect_PathOp], blendColor); 29 makePaint(&fOpPaint[kIntersect_PathOp], blendColor);
30 makePaint(&fOpPaint[kUnion_PathOp], 0xFFc0FFc0); 30 makePaint(&fOpPaint[kUnion_PathOp], 0xFFc0FFc0);
31 makePaint(&fOpPaint[kReverseDifference_PathOp], twoColor); 31 makePaint(&fOpPaint[kReverseDifference_PathOp], twoColor);
32 makePaint(&fOpPaint[kXOR_PathOp], 0xFFa0FFe0); 32 makePaint(&fOpPaint[kXOR_PathOp], 0xFFa0FFe0);
33 makePaint(&fOutlinePaint, 0xFF000000); 33 makePaint(&fOutlinePaint, 0xFF000000);
34 fOutlinePaint.setStyle(SkPaint::kStroke_Style); 34 fOutlinePaint.setStyle(SkPaint::kStroke_Style);
35 } 35 }
36 36
37 SkColor blend(SkColor one, SkColor two) { 37 SkColor blend(SkColor one, SkColor two) {
38 SkBitmap temp; 38 SkBitmap temp;
39 temp.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); 39 temp.allocN32Pixels(1, 1);
40 temp.allocPixels();
41 SkCanvas canvas(temp); 40 SkCanvas canvas(temp);
42 canvas.drawColor(one); 41 canvas.drawColor(one);
43 canvas.drawColor(two); 42 canvas.drawColor(two);
44 void* pixels = temp.getPixels(); 43 void* pixels = temp.getPixels();
45 return *(SkColor*) pixels; 44 return *(SkColor*) pixels;
46 } 45 }
47 46
48 void makePaint(SkPaint* paint, SkColor color) { 47 void makePaint(SkPaint* paint, SkColor color) {
49 paint->setAntiAlias(true); 48 paint->setAntiAlias(true);
50 paint->setStyle(SkPaint::kFill_Style); 49 paint->setStyle(SkPaint::kFill_Style);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 SkPaint fOpPaint[kReverseDifference_PathOp - kDifference_PathOp + 1]; 105 SkPaint fOpPaint[kReverseDifference_PathOp - kDifference_PathOp + 1];
107 typedef GM INHERITED; 106 typedef GM INHERITED;
108 }; 107 };
109 108
110 ////////////////////////////////////////////////////////////////////////////// 109 //////////////////////////////////////////////////////////////////////////////
111 110
112 static GM* MyFactory(void*) { return new PathOpsInverseGM; } 111 static GM* MyFactory(void*) { return new PathOpsInverseGM; }
113 static GMRegistry reg(MyFactory); 112 static GMRegistry reg(MyFactory);
114 113
115 } 114 }
OLDNEW
« no previous file with comments | « gm/optimizations.cpp ('k') | gm/samplerstress.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698