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

Unified Diff: src/gpu/GrPipelineBuilder.h

Issue 1101663007: Make non-AA hairline stroke rects snap to pixels centers so they close. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/gpu/GrPipeline.cpp ('k') | src/gpu/GrPipelineBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPipelineBuilder.h
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index ae9ca9b067b585795a921241c735833dd4f1aa0f..24d72e80aa04e419124839c3f4a3c2e0435f4ef4 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -275,49 +275,56 @@ public:
* Flags that affect rendering. Controlled using enable/disableState(). All
* default to disabled.
*/
- enum StateBits {
+ enum Flags {
/**
* Perform dithering. TODO: Re-evaluate whether we need this bit
*/
- kDither_StateBit = 0x01,
+ kDither_Flag = 0x01,
/**
* Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target,
* or smooth-line rendering if a line primitive is drawn and line smoothing is supported by
* the 3D API.
*/
- kHWAntialias_StateBit = 0x02,
+ kHWAntialias_Flag = 0x02,
- kLast_StateBit = kHWAntialias_StateBit,
+ /**
+ * Modifies the vertex shader so that vertices will be positioned at pixel centers.
+ */
+ kSnapVerticesToPixelCenters_Flag = 0x04,
+
+ kLast_Flag = kSnapVerticesToPixelCenters_Flag,
};
- bool isDither() const { return 0 != (fFlagBits & kDither_StateBit); }
- bool isHWAntialias() const { return 0 != (fFlagBits & kHWAntialias_StateBit); }
+ bool isDither() const { return SkToBool(fFlags & kDither_Flag); }
+ bool isHWAntialias() const { return SkToBool(fFlags & kHWAntialias_Flag); }
+ bool snapVerticesToPixelCenters() const {
+ return SkToBool(fFlags & kSnapVerticesToPixelCenters_Flag); }
/**
* Enable render state settings.
*
- * @param stateBits bitfield of StateBits specifying the states to enable
+ * @param flags bitfield of Flags specifying the states to enable
*/
- void enableState(uint32_t stateBits) { fFlagBits |= stateBits; }
-
+ void enableState(uint32_t flags) { fFlags |= flags; }
+
/**
* Disable render state settings.
*
- * @param stateBits bitfield of StateBits specifying the states to disable
+ * @param flags bitfield of Flags specifying the states to disable
*/
- void disableState(uint32_t stateBits) { fFlagBits &= ~(stateBits); }
+ void disableState(uint32_t flags) { fFlags &= ~(flags); }
/**
- * Enable or disable stateBits based on a boolean.
+ * Enable or disable flags based on a boolean.
*
- * @param stateBits bitfield of StateBits to enable or disable
+ * @param flags bitfield of Flags to enable or disable
* @param enable if true enable stateBits, otherwise disable
*/
- void setState(uint32_t stateBits, bool enable) {
+ void setState(uint32_t flags, bool enable) {
if (enable) {
- this->enableState(stateBits);
+ this->enableState(flags);
} else {
- this->disableState(stateBits);
+ this->disableState(flags);
}
}
@@ -422,7 +429,7 @@ private:
typedef SkSTArray<4, GrFragmentStage> FragmentStageArray;
SkAutoTUnref<GrRenderTarget> fRenderTarget;
- uint32_t fFlagBits;
+ uint32_t fFlags;
GrStencilSettings fStencilSettings;
DrawFace fDrawFace;
mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
« no previous file with comments | « src/gpu/GrPipeline.cpp ('k') | src/gpu/GrPipelineBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698