summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2009-10-02 15:04:50 -0400
committerMike Reed <reed@google.com>2009-10-02 15:07:56 -0400
commit69b9ab686ccfadd429ac9d67474ae44da9df1113 (patch)
tree782f549e8a948a8853c60d5e693bde5ac22adc5b /WebCore/platform/graphics
parent123b7cb28d165aae5c8defbb22c5ad428fc6275c (diff)
downloadexternal_webkit-69b9ab686ccfadd429ac9d67474ae44da9df1113.zip
external_webkit-69b9ab686ccfadd429ac9d67474ae44da9df1113.tar.gz
external_webkit-69b9ab686ccfadd429ac9d67474ae44da9df1113.tar.bz2
only look at globalAlpha when we draw images (not the alpha in fill-color)
http://b/issue?id=1817561
Diffstat (limited to 'WebCore/platform/graphics')
-rw-r--r--WebCore/platform/graphics/GraphicsContext.h2
-rw-r--r--WebCore/platform/graphics/android/GraphicsContextAndroid.cpp13
-rw-r--r--WebCore/platform/graphics/android/ImageAndroid.cpp4
3 files changed, 16 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index b52344d..233c14c 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -204,6 +204,8 @@ namespace WebCore {
void setCMYKAFillColor(float c, float m, float y, float k, float a);
void setCMYKAStrokeColor(float c, float m, float y, float k, float a);
+ // initialize a paint for bitmaps
+ void setupBitmapPaint(SkPaint*);
// initialize a paint for filling
void setupFillPaint(SkPaint*);
// initialize a paint for stroking
diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
index 34b709b..46ac9da 100644
--- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
@@ -247,6 +247,13 @@ public:
paint->setColor(mState->applyAlpha(mState->mFillColor));
}
+ void setup_paint_bitmap(SkPaint* paint) const {
+ this->setup_paint_common(paint);
+ // we only want the global alpha for bitmaps,
+ // so just give applyAlpha opaque black
+ paint->setColor(mState->applyAlpha(0xFF000000));
+ }
+
/* sets up the paint for stroking. Returns true if the style is really
just a dash of squares (the size of the paint's stroke-width.
*/
@@ -831,10 +838,14 @@ void GraphicsContext::endTransparencyLayer()
///////////////////////////////////////////////////////////////////////////
+ void GraphicsContext::setupBitmapPaint(SkPaint* paint) {
+ m_data->setup_paint_bitmap(paint);
+ }
+
void GraphicsContext::setupFillPaint(SkPaint* paint) {
m_data->setup_paint_fill(paint);
}
-
+
void GraphicsContext::setupStrokePaint(SkPaint* paint) {
m_data->setup_paint_stroke(paint, NULL);
}
diff --git a/WebCore/platform/graphics/android/ImageAndroid.cpp b/WebCore/platform/graphics/android/ImageAndroid.cpp
index 16a450f..177aa1f 100644
--- a/WebCore/platform/graphics/android/ImageAndroid.cpp
+++ b/WebCore/platform/graphics/android/ImageAndroid.cpp
@@ -224,7 +224,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
SkCanvas* canvas = ctxt->platformContext()->mCanvas;
SkPaint paint;
- ctxt->setupFillPaint(&paint); // need global alpha among other things
+ ctxt->setupBitmapPaint(&paint); // need global alpha among other things
paint.setFilterBitmap(true);
paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp));
fixPaintForBitmapsThatMaySeam(&paint);
@@ -292,7 +292,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect,
SkCanvas* canvas = ctxt->platformContext()->mCanvas;
SkPaint paint;
- ctxt->setupFillPaint(&paint); // need global alpha among other things
+ ctxt->setupBitmapPaint(&paint); // need global alpha among other things
SkShader* shader = SkShader::CreateBitmapShader(bitmap,
SkShader::kRepeat_TileMode,