diff options
author | John Reck <jreck@google.com> | 2012-05-29 20:59:13 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-29 20:59:13 -0700 |
commit | 1d51221cb2f00354a8d78776caaaa04347e9b61b (patch) | |
tree | 07426737c1d36c5c184d1723d7645c4d89660cfe | |
parent | 07e81ac8f155f768bd769b95efd758c6acb9d6a6 (diff) | |
parent | 4a0b0816608c283488485073839d944a077b15e8 (diff) | |
download | external_webkit-1d51221cb2f00354a8d78776caaaa04347e9b61b.zip external_webkit-1d51221cb2f00354a8d78776caaaa04347e9b61b.tar.gz external_webkit-1d51221cb2f00354a8d78776caaaa04347e9b61b.tar.bz2 |
am 4a0b0816: Merge "Don\'t use setupPaintFill for drawBitmap" into jb-dev
* commit '4a0b0816608c283488485073839d944a077b15e8':
Don't use setupPaintFill for drawBitmap
3 files changed, 15 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp index bb5d990..ce9ce5a 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp @@ -229,6 +229,16 @@ void PlatformGraphicsContext::setAlpha(float alpha) m_state->alpha = alpha; } +int PlatformGraphicsContext::getNormalizedAlpha() const +{ + int alpha = roundf(m_state->alpha * 256); + if (alpha > 255) + alpha = 255; + else if (alpha < 0) + alpha = 0; + return alpha; +} + void PlatformGraphicsContext::setCompositeOperation(CompositeOperator op) { m_state->mode = WebCoreCompositeToSkiaComposite(op); diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h index 601de0f..1916014 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h @@ -59,6 +59,7 @@ public: // State values virtual void setAlpha(float alpha); + int getNormalizedAlpha() const; virtual void setCompositeOperation(CompositeOperator op); virtual void setFillColor(const Color& c); virtual void setFillShader(SkShader* fillShader); diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp index 9b32726..f00bb02 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp @@ -234,7 +234,8 @@ void PlatformGraphicsContextSkia::drawBitmapPattern( SkShader::kRepeat_TileMode); shader->setLocalMatrix(matrix); SkPaint paint; - setupPaintFill(&paint); + setupPaintCommon(&paint); + paint.setAlpha(getNormalizedAlpha()); paint.setShader(shader); paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp)); fixPaintForBitmapsThatMaySeam(&paint); @@ -246,7 +247,8 @@ void PlatformGraphicsContextSkia::drawBitmapRect(const SkBitmap& bitmap, CompositeOperator op) { SkPaint paint; - setupPaintFill(&paint); + setupPaintCommon(&paint); + paint.setAlpha(getNormalizedAlpha()); paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op)); fixPaintForBitmapsThatMaySeam(&paint); |