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

Side by Side Diff: gm/skbug_257.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on Created 4 years, 9 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
« no previous file with comments | « gm/shallowgradient.cpp ('k') | gm/srcmode.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 2015 Google Inc. 2 * Copyright 2015 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 "SkImage.h" 9 #include "SkImage.h"
10 #include "SkRRect.h" 10 #include "SkRRect.h"
11 11
12 static void rotated_checkerboard_shader(SkPaint* paint, 12 static void rotated_checkerboard_shader(SkPaint* paint,
13 SkColor c1, 13 SkColor c1,
14 SkColor c2, 14 SkColor c2,
15 int size) { 15 int size) {
16 SkBitmap bm; 16 SkBitmap bm;
17 bm.allocN32Pixels(2 * size, 2 * size); 17 bm.allocN32Pixels(2 * size, 2 * size);
18 bm.eraseColor(c1); 18 bm.eraseColor(c1);
19 bm.eraseArea(SkIRect::MakeLTRB(0, 0, size, size), c2); 19 bm.eraseArea(SkIRect::MakeLTRB(0, 0, size, size), c2);
20 bm.eraseArea(SkIRect::MakeLTRB(size, size, 2 * size, 2 * size), c2); 20 bm.eraseArea(SkIRect::MakeLTRB(size, size, 2 * size, 2 * size), c2);
21 SkMatrix matrix; 21 SkMatrix matrix;
22 matrix.setScale(0.75f, 0.75f); 22 matrix.setScale(0.75f, 0.75f);
23 matrix.preRotate(30.0f); 23 matrix.preRotate(30.0f);
24 SkAutoTUnref<SkShader> shader( 24 paint->setShader(
25 SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, 25 SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader: :kRepeat_TileMode,
26 SkShader::kRepeat_TileMode, &matrix)); 26 &matrix));
27 paint->setShader(shader);
28 } 27 }
29 28
30 static void exercise_draw_pos_text(SkCanvas* canvas, 29 static void exercise_draw_pos_text(SkCanvas* canvas,
31 const char* text, 30 const char* text,
32 SkScalar x, SkScalar y, 31 SkScalar x, SkScalar y,
33 const SkPaint& paint) { 32 const SkPaint& paint) {
34 size_t textLen = strlen(text); 33 size_t textLen = strlen(text);
35 int count = paint.countText(text, textLen); 34 int count = paint.countText(text, textLen);
36 SkAutoTArray<SkScalar> widths(count); 35 SkAutoTArray<SkScalar> widths(count);
37 paint.getTextWidths(text, textLen, &widths[0]); 36 paint.getTextWidths(text, textLen, &widths[0]);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 SkPaint stroke; 125 SkPaint stroke;
127 stroke.setStyle(SkPaint::kStroke_Style); 126 stroke.setStyle(SkPaint::kStroke_Style);
128 stroke.setStrokeWidth(5); 127 stroke.setStrokeWidth(5);
129 stroke.setColor(SK_ColorCYAN); 128 stroke.setColor(SK_ColorCYAN);
130 canvas->drawCircle(size / 2, size / 2, size / 2 - 10, stroke); 129 canvas->drawCircle(size / 2, size / 2, size / 2 - 10, stroke);
131 canvas->drawCircle(3 * size / 2, size / 2, size / 2 - 10, stroke); 130 canvas->drawCircle(3 * size / 2, size / 2, size / 2 - 10, stroke);
132 canvas->drawCircle(size / 2, 384, size / 2 - 10, stroke); 131 canvas->drawCircle(size / 2, 384, size / 2 - 10, stroke);
133 canvas->translate(size, size); 132 canvas->translate(size, size);
134 test_text(canvas, size, SK_ColorCYAN, 0.0f); 133 test_text(canvas, size, SK_ColorCYAN, 0.0f);
135 } 134 }
OLDNEW
« no previous file with comments | « gm/shallowgradient.cpp ('k') | gm/srcmode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698