am 8ca30207: Merge "Minor cleanups around color usage" into lmp-dev

* commit '8ca3020778727ad35f305fb84611c1e43c3c8a92':
  Minor cleanups around color usage
This commit is contained in:
Chris Craik
2014-07-17 19:37:46 +00:00
committed by Android Git Automerger
3 changed files with 13 additions and 8 deletions

View File

@@ -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) {

View File

@@ -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

View File

@@ -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);