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

Side by Side Diff: gm/gm.cpp

Issue 869393007: Add standard way to indicate GM is GPU-only. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add include Created 5 years, 10 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/gm.h ('k') | gm/rrects.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 9 #include "SkShader.h"
10 using namespace skiagm; 10 using namespace skiagm;
11 11
12 GM::GM() { 12 GM::GM() {
13 fMode = kGM_Mode; 13 fMode = kGM_Mode;
14 fBGColor = SK_ColorWHITE; 14 fBGColor = SK_ColorWHITE;
15 fCanvasIsDeferred = false; 15 fCanvasIsDeferred = false;
16 fHaveCalledOnceBeforeDraw = false; 16 fHaveCalledOnceBeforeDraw = false;
17 fStarterMatrix.reset(); 17 fStarterMatrix.reset();
18 } 18 }
19 19
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { 58 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) {
59 SkISize size = this->getISize(); 59 SkISize size = this->getISize();
60 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), 60 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
61 SkIntToScalar(size.height())); 61 SkIntToScalar(size.height()));
62 SkPaint paint; 62 SkPaint paint;
63 paint.setColor(color); 63 paint.setColor(color);
64 canvas->drawRect(r, paint); 64 canvas->drawRect(r, paint);
65 } 65 }
66 66
67 void GM::drawGpuOnlyMessage(SkCanvas* canvas) {
68 SkBitmap bmp;
69 bmp.allocN32Pixels(128, 64);
70 SkCanvas bmpCanvas(bmp);
71 bmpCanvas.drawColor(SK_ColorWHITE);
72 SkPaint paint;
73 paint.setAntiAlias(true);
74 paint.setTextSize(20);
75 paint.setColor(SK_ColorRED);
76 static const char kTxt[] = "GPU Only";
77 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint);
78 SkMatrix localM;
79 localM.setRotate(35.f);
80 localM.postTranslate(10.f, 0.f);
81 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(bmp, SkShader::kM irror_TileMode,
82 SkShader::kMirror _TileMode,
83 &localM));
84 paint.setShader(shader);
85 paint.setFilterQuality(kMedium_SkFilterQuality);
86 canvas->drawPaint(paint);
87 return;
88 }
89
67 // need to explicitly declare this, or we get some weird infinite loop llist 90 // need to explicitly declare this, or we get some weird infinite loop llist
68 template GMRegistry* GMRegistry::gHead; 91 template GMRegistry* GMRegistry::gHead;
69 92
70 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { 93 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) {
71 fDrawProc(canvas); 94 fDrawProc(canvas);
72 } 95 }
73 96
74 SkISize skiagm::SimpleGM::onISize() { 97 SkISize skiagm::SimpleGM::onISize() {
75 return fSize; 98 return fSize;
76 } 99 }
77 100
78 SkString skiagm::SimpleGM::onShortName() { 101 SkString skiagm::SimpleGM::onShortName() {
79 return fName; 102 return fName;
80 } 103 }
OLDNEW
« no previous file with comments | « gm/gm.h ('k') | gm/rrects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698