OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "sk_tool_utils_flags.h" | 9 #include "sk_tool_utils_flags.h" |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 bitmap.allocPixels(SkImageInfo::MakeS32(w, h, kPremul_SkAlphaType)); | 213 bitmap.allocPixels(SkImageInfo::MakeS32(w, h, kPremul_SkAlphaType)); |
214 SkCanvas canvas(bitmap); | 214 SkCanvas canvas(bitmap); |
215 | 215 |
216 sk_tool_utils::draw_checkerboard(&canvas, c1, c2, checkSize); | 216 sk_tool_utils::draw_checkerboard(&canvas, c1, c2, checkSize); |
217 return bitmap; | 217 return bitmap; |
218 } | 218 } |
219 | 219 |
220 void draw_checkerboard(SkCanvas* canvas, SkColor c1, SkColor c2, int size) { | 220 void draw_checkerboard(SkCanvas* canvas, SkColor c1, SkColor c2, int size) { |
221 SkPaint paint; | 221 SkPaint paint; |
222 paint.setShader(create_checkerboard_shader(c1, c2, size)); | 222 paint.setShader(create_checkerboard_shader(c1, c2, size)); |
223 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 223 paint.setBlendMode(SkBlendMode::kSrc); |
224 canvas->drawPaint(paint); | 224 canvas->drawPaint(paint); |
225 } | 225 } |
226 | 226 |
227 SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y, | 227 SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y, |
228 int textSize, const char* str) { | 228 int textSize, const char* str) { |
229 SkBitmap bitmap; | 229 SkBitmap bitmap; |
230 bitmap.allocN32Pixels(w, h); | 230 bitmap.allocN32Pixels(w, h); |
231 SkCanvas canvas(bitmap); | 231 SkCanvas canvas(bitmap); |
232 | 232 |
233 SkPaint paint; | 233 SkPaint paint; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 const SkVector& ll = rr.radii(SkRRect::kLowerLeft_Corner); | 539 const SkVector& ll = rr.radii(SkRRect::kLowerLeft_Corner); |
540 | 540 |
541 SkScalar maxL = SkTMax(ul.fX, ll.fX); | 541 SkScalar maxL = SkTMax(ul.fX, ll.fX); |
542 SkScalar maxR = SkTMax(ur.fX, lr.fX); | 542 SkScalar maxR = SkTMax(ur.fX, lr.fX); |
543 | 543 |
544 return SkRect::MakeLTRB(r.fLeft + maxL, r.fTop, r.fRight - maxR, r.fBottom); | 544 return SkRect::MakeLTRB(r.fLeft + maxL, r.fTop, r.fRight - maxR, r.fBottom); |
545 } | 545 } |
546 | 546 |
547 | 547 |
548 } // namespace sk_tool_utils | 548 } // namespace sk_tool_utils |
OLD | NEW |