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

Side by Side Diff: gm/bitmapfilters.cpp

Issue 1184123002: Revert of make gm background colors 565 compatible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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/bitmapcopy.cpp ('k') | gm/blurs.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 2011 Google Inc. 2 * Copyright 2011 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 "sk_tool_utils.h" 9 #include "sk_tool_utils.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { 48 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) {
49 SkAutoCanvasRestore acr(canvas, true); 49 SkAutoCanvasRestore acr(canvas, true);
50 50
51 SkPaint paint; 51 SkPaint paint;
52 SkScalar x = 0; 52 SkScalar x = 0;
53 const int scale = 32; 53 const int scale = 32;
54 54
55 paint.setAntiAlias(true); 55 paint.setAntiAlias(true);
56 sk_tool_utils::set_portable_typeface_always(&paint); 56 sk_tool_utils::set_portable_typeface(&paint);
57 const char* name = sk_tool_utils::colortype_name(bm.colorType()); 57 const char* name = sk_tool_utils::colortype_name(bm.colorType());
58 canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8 , 58 canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8 ,
59 paint); 59 paint);
60 canvas->translate(SkIntToScalar(48), 0); 60 canvas->translate(SkIntToScalar(48), 0);
61 61
62 canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale)); 62 canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale));
63 63
64 x += draw_set(canvas, bm, 0, &paint); 64 x += draw_set(canvas, bm, 0, &paint);
65 paint.reset(); 65 paint.reset();
66 paint.setAlpha(0x80); 66 paint.setAlpha(0x80);
67 draw_set(canvas, bm, x, &paint); 67 draw_set(canvas, bm, x, &paint);
68 return x * scale / 3; 68 return x * scale / 3;
69 } 69 }
70 70
71 class FilterGM : public skiagm::GM { 71 class FilterGM : public skiagm::GM {
72 void onOnceBeforeDraw() override { 72 void onOnceBeforeDraw() override {
73 make_bm(&fBM8); 73 make_bm(&fBM8);
74 fBM8.copyTo(&fBM4444, kARGB_4444_SkColorType); 74 fBM8.copyTo(&fBM4444, kARGB_4444_SkColorType);
75 fBM8.copyTo(&fBM16, kRGB_565_SkColorType); 75 fBM8.copyTo(&fBM16, kRGB_565_SkColorType);
76 fBM8.copyTo(&fBM32, kN32_SkColorType); 76 fBM8.copyTo(&fBM32, kN32_SkColorType);
77 } 77 }
78 78
79 public: 79 public:
80 SkBitmap fBM8, fBM4444, fBM16, fBM32; 80 SkBitmap fBM8, fBM4444, fBM16, fBM32;
81 81
82 FilterGM() { 82 FilterGM() {
83 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); 83 this->setBGColor(0xFFDDDDDD);
84 } 84 }
85 85
86 protected: 86 protected:
87 SkString onShortName() override { 87 SkString onShortName() override {
88 return SkString("bitmapfilters"); 88 return SkString("bitmapfilters");
89 } 89 }
90 90
91 SkISize onISize() override { 91 SkISize onISize() override {
92 return SkISize::Make(540, 330); 92 return SkISize::Make(540, 330);
93 } 93 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 canvas->drawBitmap(fBitmap, 10, 10, &paint); // should stay blue (ign ore paint's color) 153 canvas->drawBitmap(fBitmap, 10, 10, &paint); // should stay blue (ign ore paint's color)
154 canvas->drawBitmap(fAlpha, 120, 10, &paint); // should draw red 154 canvas->drawBitmap(fAlpha, 120, 10, &paint); // should draw red
155 } 155 }
156 156
157 private: 157 private:
158 typedef skiagm::GM INHERITED; 158 typedef skiagm::GM INHERITED;
159 }; 159 };
160 DEF_GM( return new TestExtractAlphaGM; ) 160 DEF_GM( return new TestExtractAlphaGM; )
161 161
OLDNEW
« no previous file with comments | « gm/bitmapcopy.cpp ('k') | gm/blurs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698