diff options
author | Chris Craik <ccraik@google.com> | 2014-07-17 12:25:11 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-07-17 12:25:11 -0700 |
commit | 98d608dba6a0b3c15fb08f1fa2c8b9d170124c7c (patch) | |
tree | cba2372b4abff4dae433df57662e7a7a27611ff2 /libs/hwui | |
parent | 889fc94ffa70633e510e812b9da86723f4eee384 (diff) | |
download | frameworks_base-98d608dba6a0b3c15fb08f1fa2c8b9d170124c7c.zip frameworks_base-98d608dba6a0b3c15fb08f1fa2c8b9d170124c7c.tar.gz frameworks_base-98d608dba6a0b3c15fb08f1fa2c8b9d170124c7c.tar.bz2 |
Minor cleanups around color usage
Change-Id: I56733cbe933a58d5977c032f056abb35265ee252
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DisplayListOp.h | 15 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/PathCache.cpp | 3 |
3 files changed, 13 insertions, 8 deletions
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index 75d52b4..9f66904 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -21,6 +21,7 @@ #define LOG_TAG "OpenGLRenderer" #endif +#include <SkColor.h> #include <SkPath.h> #include <SkPathOps.h> #include <SkXfermode.h> @@ -1315,7 +1316,7 @@ public: FontRenderer& fontRenderer = renderer.getCaches().fontRenderer->getFontRenderer(paint); fontRenderer.precache(paint, mText, mCount, SkMatrix::I()); - deferInfo.batchId = mPaint->getColor() == 0xff000000 ? + deferInfo.batchId = mPaint->getColor() == SK_ColorBLACK ? DeferredDisplayList::kOpBatch_Text : DeferredDisplayList::kOpBatch_ColorText; } @@ -1385,17 +1386,19 @@ public: fontRenderer.precache(paint, mText, mCount, transform); mPrecacheTransform = transform; } - deferInfo.batchId = mPaint->getColor() == 0xff000000 ? + deferInfo.batchId = mPaint->getColor() == SK_ColorBLACK ? DeferredDisplayList::kOpBatch_Text : DeferredDisplayList::kOpBatch_ColorText; deferInfo.mergeId = reinterpret_cast<mergeid_t>(mPaint->getColor()); // don't merge decorated text - the decorations won't draw in order - bool noDecorations = !(mPaint->getFlags() & (SkPaint::kUnderlineText_Flag | - SkPaint::kStrikeThruText_Flag)); - deferInfo.mergeable = state.mMatrix.isPureTranslate() && noDecorations && - OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode; + bool hasDecorations = mPaint->getFlags() + & (SkPaint::kUnderlineText_Flag | SkPaint::kStrikeThruText_Flag); + + deferInfo.mergeable = state.mMatrix.isPureTranslate() + && !hasDecorations + && OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode; } virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 7fa1975..e468a75 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -21,6 +21,7 @@ #include <sys/types.h> #include <SkCanvas.h> +#include <SkColor.h> #include <SkShader.h> #include <SkTypeface.h> @@ -1462,7 +1463,7 @@ void OpenGLRenderer::setStencilFromClip() { mSkipOutlineClip = true; SkPaint paint; - paint.setColor(0xff000000); + paint.setColor(SK_ColorBLACK); paint.setXfermodeMode(SkXfermode::kSrc_Mode); // NOTE: We could use the region contour path to generate a smaller mesh diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index ae48608..9ba8854 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -19,6 +19,7 @@ #include <SkBitmap.h> #include <SkCanvas.h> +#include <SkColor.h> #include <SkPaint.h> #include <SkPath.h> #include <SkRect.h> @@ -111,7 +112,7 @@ static void initBitmap(SkBitmap& bitmap, uint32_t width, uint32_t height) { static void initPaint(SkPaint& paint) { // Make sure the paint is opaque, color, alpha, filter, etc. // will be applied later when compositing the alpha8 texture - paint.setColor(0xff000000); + paint.setColor(SK_ColorBLACK); paint.setAlpha(255); paint.setColorFilter(NULL); paint.setMaskFilter(NULL); |