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

Side by Side Diff: gm/skbug_257.cpp

Issue 1790353002: Revert of more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 paint->setShader( 24 SkAutoTUnref<SkShader> shader(
25 SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader: :kRepeat_TileMode, 25 SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
26 &matrix)); 26 SkShader::kRepeat_TileMode, &matrix));
27 paint->setShader(shader);
27 } 28 }
28 29
29 static void exercise_draw_pos_text(SkCanvas* canvas, 30 static void exercise_draw_pos_text(SkCanvas* canvas,
30 const char* text, 31 const char* text,
31 SkScalar x, SkScalar y, 32 SkScalar x, SkScalar y,
32 const SkPaint& paint) { 33 const SkPaint& paint) {
33 size_t textLen = strlen(text); 34 size_t textLen = strlen(text);
34 int count = paint.countText(text, textLen); 35 int count = paint.countText(text, textLen);
35 SkAutoTArray<SkScalar> widths(count); 36 SkAutoTArray<SkScalar> widths(count);
36 paint.getTextWidths(text, textLen, &widths[0]); 37 paint.getTextWidths(text, textLen, &widths[0]);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 SkPaint stroke; 126 SkPaint stroke;
126 stroke.setStyle(SkPaint::kStroke_Style); 127 stroke.setStyle(SkPaint::kStroke_Style);
127 stroke.setStrokeWidth(5); 128 stroke.setStrokeWidth(5);
128 stroke.setColor(SK_ColorCYAN); 129 stroke.setColor(SK_ColorCYAN);
129 canvas->drawCircle(size / 2, size / 2, size / 2 - 10, stroke); 130 canvas->drawCircle(size / 2, size / 2, size / 2 - 10, stroke);
130 canvas->drawCircle(3 * size / 2, size / 2, size / 2 - 10, stroke); 131 canvas->drawCircle(3 * size / 2, size / 2, size / 2 - 10, stroke);
131 canvas->drawCircle(size / 2, 384, size / 2 - 10, stroke); 132 canvas->drawCircle(size / 2, 384, size / 2 - 10, stroke);
132 canvas->translate(size, size); 133 canvas->translate(size, size);
133 test_text(canvas, size, SK_ColorCYAN, 0.0f); 134 test_text(canvas, size, SK_ColorCYAN, 0.0f);
134 } 135 }
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