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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/gm.h ('k') | gm/rrects.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gm.cpp
diff --git a/gm/gm.cpp b/gm/gm.cpp
index ff17644fffc09bd2c7fcd0140565ac4eac28e72d..19222841da811e93f0152621fa1da150b08d7fdd 100644
--- a/gm/gm.cpp
+++ b/gm/gm.cpp
@@ -6,7 +6,7 @@
*/
#include "gm.h"
-
+#include "SkShader.h"
using namespace skiagm;
GM::GM() {
@@ -64,6 +64,29 @@ void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) {
canvas->drawRect(r, paint);
}
+void GM::drawGpuOnlyMessage(SkCanvas* canvas) {
+ SkBitmap bmp;
+ bmp.allocN32Pixels(128, 64);
+ SkCanvas bmpCanvas(bmp);
+ bmpCanvas.drawColor(SK_ColorWHITE);
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(20);
+ paint.setColor(SK_ColorRED);
+ static const char kTxt[] = "GPU Only";
+ bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint);
+ SkMatrix localM;
+ localM.setRotate(35.f);
+ localM.postTranslate(10.f, 0.f);
+ SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(bmp, SkShader::kMirror_TileMode,
+ SkShader::kMirror_TileMode,
+ &localM));
+ paint.setShader(shader);
+ paint.setFilterQuality(kMedium_SkFilterQuality);
+ canvas->drawPaint(paint);
+ return;
+}
+
// need to explicitly declare this, or we get some weird infinite loop llist
template GMRegistry* GMRegistry::gHead;
« 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