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

Unified Diff: gm/coloremoji.cpp

Issue 820523002: initial changes to add local matrix to primitive processor (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup-ccm-above-context
Patch Set: clean up of comment around get_transform_matrix Created 6 years 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 | « no previous file | include/gpu/GrPaint.h » ('j') | src/gpu/GrGeometryProcessor.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/coloremoji.cpp
diff --git a/gm/coloremoji.cpp b/gm/coloremoji.cpp
index 2eab864c0df1fb96ec6e3e8117cabb5d6d7d5fa7..825003a60b9df5ad92b3acf01063b457b0a4f5be 100644
--- a/gm/coloremoji.cpp
+++ b/gm/coloremoji.cpp
@@ -12,6 +12,19 @@
#include "SkStream.h"
#include "SkTypeface.h"
+#include "SkGradientShader.h"
+
+/*
+ * Spits out a dummy gradient to test blur with shader on paint
+ */
+static SkShader* MakeLinear() {
+ static const SkPoint kPts[] = { { 0, 0 }, { 32, 32 } };
+ static const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
+ static const SkColor kColors[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
+ return SkGradientShader::CreateLinear(kPts, kColors, kPos,
+ SK_ARRAY_COUNT(kColors), SkShader::kClamp_TileMode);
+}
+
namespace skiagm {
class ColorEmojiGM : public GM {
@@ -40,7 +53,7 @@ protected:
}
virtual SkISize onISize() {
- return SkISize::Make(640, 480);
+ return SkISize::Make(640, 540);
}
virtual void onDraw(SkCanvas* canvas) {
@@ -53,16 +66,21 @@ protected:
const char* text = "hamburgerfons";
// draw text at different point sizes
- const int textSize[] = { 10, 30, 50 };
- const int textYOffset[] = { 10, 40, 100};
+ const int textSize[] = { 10, 10, 30, 30, 50, 50 };
+ const int textYOffset[] = { 10, 25, 50, 85, 130, 190};
SkASSERT(sizeof(textSize) == sizeof(textYOffset));
- for (size_t y = 0; y < sizeof(textSize) / sizeof(int); ++y) {
- paint.setTextSize(SkIntToScalar(textSize[y]));
- canvas->drawText(text, strlen(text), 10, SkIntToScalar(textYOffset[y]), paint);
+ for (size_t y = 0; y < sizeof(textSize) / sizeof(int); y += 2) {
+ SkPaint localPaint;
+ localPaint.setTypeface(fTypeface);
+ localPaint.setTextSize(SkIntToScalar(textSize[y]));
+ canvas->drawText(text, strlen(text), 10, SkIntToScalar(textYOffset[y]), localPaint);
+ // attach a shader to the paint to test fall back
+ localPaint.setShader(MakeLinear())->unref();
+ canvas->drawText(text, strlen(text), 10, SkIntToScalar(textYOffset[y + 1]), localPaint);
}
// setup work needed to draw text with different clips
- canvas->translate(10, 160);
+ canvas->translate(10, 250);
paint.setTextSize(40);
// compute the bounds of the text
« no previous file with comments | « no previous file | include/gpu/GrPaint.h » ('j') | src/gpu/GrGeometryProcessor.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698