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

Side by Side Diff: gm/badpaint.cpp

Issue 1097433002: Don't serialize anything for SkEmptyShader. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 8 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 | « no previous file | src/core/SkEmptyShader.h » ('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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkShader.h" 10 #include "SkShader.h"
(...skipping 12 matching lines...) Expand all
23 void onOnceBeforeDraw() override { 23 void onOnceBeforeDraw() override {
24 SkBitmap emptyBmp; 24 SkBitmap emptyBmp;
25 25
26 SkBitmap blueBmp; 26 SkBitmap blueBmp;
27 blueBmp.allocN32Pixels(10, 10); 27 blueBmp.allocN32Pixels(10, 10);
28 blueBmp.eraseColor(SK_ColorBLUE); 28 blueBmp.eraseColor(SK_ColorBLUE);
29 29
30 SkMatrix badMatrix; 30 SkMatrix badMatrix;
31 badMatrix.setAll(0, 0, 0, 0, 0, 0, 0, 0, 0); 31 badMatrix.setAll(0, 0, 0, 0, 0, 0, 0, 0, 0);
32 32
33 #if 0 // This crashes pipe!
34 // Empty bitmap. 33 // Empty bitmap.
35 fPaints.push_back().setColor(SK_ColorGREEN); 34 fPaints.push_back().setColor(SK_ColorGREEN);
36 fPaints.back().setShader(SkShader::CreateBitmapShader(emptyBmp, SkShader ::kClamp_TileMode, 35 fPaints.back().setShader(SkShader::CreateBitmapShader(emptyBmp, SkShader ::kClamp_TileMode,
37 SkShader::kClamp_T ileMode))->unref(); 36 SkShader::kClamp_T ileMode))->unref();
38 #endif
39 37
40 // Non-invertible local matrix. 38 // Non-invertible local matrix.
41 fPaints.push_back().setColor(SK_ColorGREEN); 39 fPaints.push_back().setColor(SK_ColorGREEN);
42 fPaints.back().setShader(SkShader::CreateBitmapShader(blueBmp, SkShader: :kClamp_TileMode, 40 fPaints.back().setShader(SkShader::CreateBitmapShader(blueBmp, SkShader: :kClamp_TileMode,
43 SkShader::kClamp_T ileMode, 41 SkShader::kClamp_T ileMode,
44 &badMatrix))->unre f(); 42 &badMatrix))->unre f();
45 } 43 }
46 44
47 void onDraw(SkCanvas* canvas) override { 45 void onDraw(SkCanvas* canvas) override {
48 SkRect rect = SkRect::MakeXYWH(10, 10, 80, 80); 46 SkRect rect = SkRect::MakeXYWH(10, 10, 80, 80);
49 for (int i = 0; i < fPaints.count(); ++i) { 47 for (int i = 0; i < fPaints.count(); ++i) {
50 canvas->drawRect(rect, fPaints[i]); 48 canvas->drawRect(rect, fPaints[i]);
51 } 49 }
52 } 50 }
53 51
54 private: 52 private:
55 SkTArray<SkPaint> fPaints; 53 SkTArray<SkPaint> fPaints;
56 54
57 typedef skiagm::GM INHERITED; 55 typedef skiagm::GM INHERITED;
58 }; 56 };
59 57
60 //////////////////////////////////////////////////////////////////////////////// ///// 58 //////////////////////////////////////////////////////////////////////////////// /////
61 59
62 DEF_GM( return SkNEW(BadPaintGM); ) 60 DEF_GM( return SkNEW(BadPaintGM); )
OLDNEW
« no previous file with comments | « no previous file | src/core/SkEmptyShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698