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

Unified Diff: src/gpu/effects/GrRectEffect.h

Issue 13521006: First pass at Rect Effect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: fixed overlength lines Created 7 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/effects/GrRectEffect.h
===================================================================
--- src/gpu/effects/GrRectEffect.h (revision 0)
+++ src/gpu/effects/GrRectEffect.h (revision 0)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrRectEffect_DEFINED
+#define GrRectEffect_DEFINED
+
+#include "GrEffect.h"
+
+class GrGLRectEffect;
bsalomon 2013/04/08 15:48:39 What do you think of putting this in the AARectRen
robertphillips 2013/04/08 19:33:20 Done - we can always move it out if line drawing n
+
+/**
+ * The output of this effect is a modulation of the input color and coverage
+ * for an arbitrarily oriented rect. The rect is specified as:
+ * Center of the rect
+ * Unit vector point down the height of the rect
+ * Half width + 0.5
+ * Half height + 0.5
bsalomon 2013/04/08 15:48:39 Maybe comment here on what varying that this effec
robertphillips 2013/04/08 19:33:20 Done.
+ */
+class GrRectEffect : public GrEffect {
+public:
+ static GrEffectRef* Create() {
+ static SkAutoTUnref<GrEffectRef> gRectEffectRef(
+ CreateEffectRef(AutoEffectUnref(SkNEW(GrRectEffect))));
+ gRectEffectRef.get()->ref();
+ return gRectEffectRef;
+ }
+
+ virtual ~GrRectEffect() {}
+
+ static const char* Name() { return "RectEdge"; }
+
+ virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
+
+ typedef GrGLRectEffect GLEffect;
+
+ virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+
+private:
+ GrRectEffect();
+
+ virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE {
+ return true;
+ }
+
+ GR_DECLARE_EFFECT_TEST;
+
+ typedef GrEffect INHERITED;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698